Oas bot 32343214600/ufw - #10410
Conversation
- added ufw examples - added ufw waiters and unit tests
# Conflicts: # services/ufw/go.mod # services/ufw/oas_commit
|
Metadata files:
|
| RuleStatusCreating RuleStatus = "Creating" | ||
| RuleStatusUpdating RuleStatus = "Updating" | ||
| RuleStatusPending RuleStatus = "Pending" | ||
| RuleStatusDeleting RuleStatus = "Deleting" |
There was a problem hiding this comment.
unused constants, pls remove
| ufw "github.com/stackitcloud/stackit-sdk-go/services/ufw/v1api" | ||
| ) | ||
|
|
||
| type RuleStatus string |
There was a problem hiding this comment.
would it be possible to declare RuleResponse.Status as enum with the possible values in the API spec? This would save us from using undocumented literals here and in the other SDKs
There was a problem hiding this comment.
Sure, I just modified in the stackit-api repo, but I think we will need another PR in this case
| if ruleResp == nil { | ||
| return "", errors.New("empty response") | ||
| } | ||
| if ruleResp.Status == nil { |
There was a problem hiding this comment.
out of curiosity: when would this be the case? What's the meaning of a nil Status?
There was a problem hiding this comment.
just for testing, however I removed it
| return handler | ||
| } | ||
|
|
||
| func UpdateRuleWaitHandler(ctx context.Context, a ufw.DefaultAPI, projectId, region, ruleId string) *wait.AsyncActionHandler[ufw.RuleResponse] { |
There was a problem hiding this comment.
function body is a duplicate of CreateRuleHandler please introduce a private createOrUpdateRuleWaitHandler function with this implementation and call it from Create... and Update....
Your intuition was correct here to create two separate functions, this gives us some flexibility in the future. With the private helper function we can keep two public funcs, in case the API evolves, but share the implementation in the meantime.
There was a problem hiding this comment.
examples/ufw/go.sum missing, pleas run go mod tidy in the example dir
- removed nil status checking - removed unused statuses - added a shared method for all wait handlers
|
Closed in favor of 10428 |
Description
relates to #1234
Checklist
make fmtexamples/directory)make test(will be checked by CI)make lint(will be checked by CI)