Oas bot 32696593591/ufw - #10628
Conversation
- added ufw examples - added ufw waiters and unit tests
# Conflicts: # services/ufw/go.mod # services/ufw/oas_commit
- removed nil status checking - removed unused statuses - added a shared method for all wait handlers
# Conflicts: # services/ufw/go.mod # services/ufw/oas_commit # services/ufw/v1api/model_rule_response.go
# Conflicts: # services/ufw/go.mod # services/ufw/oas_commit # services/ufw/v1api/model_rule_response.go
|
| - `v1api`: **Improvement:** Add validation for `Description` field | ||
| - `ufw`: | ||
| - [v1.0.0](services/ufw/CHANGELOG.md#v100) | ||
| - **New:** STACKIT UFW service |
There was a problem hiding this comment.
| - **New:** STACKIT UFW service | |
| - **New:** STACKIT Unified Firewall (UFW) service |
| @@ -0,0 +1 @@ | |||
| v1.0.0 No newline at end of file | |||
There was a problem hiding this comment.
Do we really want to start with v1? Other services mostly start with v0.1.0
| @@ -0,0 +1,3 @@ | |||
| ## v1.0.0 | |||
| - **New:** STACKIT UFW service | |||
There was a problem hiding this comment.
| - **New:** STACKIT UFW service | |
| - **New:** STACKIT Unified Firewall (UFW) service |
| region := "eu01" // Region where the resources will be created | ||
| projectId := "PROJECT_ID" // UUID of your STACKIT project | ||
| instanceId := "INSTANCE_ID" // UUID of the instance to which the firewall rule will be attached | ||
| productType := "PRODUCT_TYPE" // Type of the instance to which the firewall rule will be attached (e.g. "redis", but you can get them from provider-options route) |
There was a problem hiding this comment.
Is the product type not limited to Edge Cloud for the beginning? If yes, I would prefer that edge is mentioned in the example instead of redis.
| return ruleWaitHandler(ctx, a, projectId, region, ruleId, nil, []int{http.StatusNotFound}) | ||
| } | ||
|
|
||
| func ruleWaitHandler(ctx context.Context, a ufw.DefaultAPI, projectId, region, ruleId string, activeStates []ufw.RuleResponseStatus, deleteHttpErrorStatusCodes []int) *wait.AsyncActionHandler[ufw.RuleResponse] { |
There was a problem hiding this comment.
Can you rename this function to sth like createOrUpdateRuleWaitHandler to keep the standard implementation of SDK. We try to follow this naming convention since some time.
There was a problem hiding this comment.
for example
| } | ||
| } | ||
|
|
||
| func TestCreateRuleWaitHandler(t *testing.T) { |
There was a problem hiding this comment.
You can combine create and update tests into one. e.g
Just need to pay attention to the handlers part.
| } | ||
|
|
||
| createdFirewallRuleId := createdFirewallRule.RefId | ||
| fmt.Printf("Created firewall rule with ID: %s\n", *createdFirewallRuleId) |
There was a problem hiding this comment.
This message is a bit misleading. Actually here the creation is triggered and waiter starts.
So we should write sth like [UFW] Triggered creation of firewall rule with ID.....
| return nil, err | ||
| } | ||
|
|
||
| fmt.Printf("Updated firewall rule with ID: %s\n", *updatedFirewallRule.RefId) |
There was a problem hiding this comment.
| fmt.Printf("Updated firewall rule with ID: %s\n", *updatedFirewallRule.RefId) | |
| fmt.Printf("[UFW] Triggered update of firewall rule with ID: %s\n", *updatedFirewallRule.RefId) |
| return err | ||
| } | ||
|
|
||
| fmt.Printf("Deleted firewall rule with ID: %s\n", ruleId) |
There was a problem hiding this comment.
| fmt.Printf("Deleted firewall rule with ID: %s\n", ruleId) | |
| fmt.Printf("[UFW] Triggered deletion of firewall rule with ID: %s\n", ruleId) |
Description
relates to #1234
Checklist
make fmtexamples/directory)make test(will be checked by CI)make lint(will be checked by CI)