-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_web_application_firewall_policy
: upgrade API version to 2023-02-01
#22455
azurerm_web_application_firewall_policy
: upgrade API version to 2023-02-01
#22455
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @wuxu92
Thanks for this PR - I've taken a look through and left some comments inline, but if we can fix those up then this should otherwise be good to go 👍
Thanks!
future, err := client.Delete(ctx, *id) | ||
if err != nil { | ||
return fmt.Errorf("deleting %s: %+v", *id, err) | ||
} | ||
|
||
if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { | ||
if err = future.Poller.PollUntilDone(ctx); err != nil { | ||
return fmt.Errorf("waiting for the deletion of %s: %+v", *id, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can reduce this to: `if err := client.DeleteThenPoll(...); err != nil { ... }
if location := model.Location; location != nil { | ||
d.Set("location", azure.NormalizeLocation(*location)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be reduced to:
if location := model.Location; location != nil { | |
d.Set("location", azure.NormalizeLocation(*location)) | |
} | |
d.Set("location", location.NormalizeNilable(model.Location)) |
@@ -680,8 +684,8 @@ func expandWebApplicationFirewallPolicyExclusions(input []interface{}) *[]networ | |||
return &results | |||
} | |||
|
|||
func expandWebApplicationFirewallPolicyManagedRuleSet(input []interface{}, d *pluginsdk.ResourceData) (*[]network.ManagedRuleSet, error) { | |||
results := make([]network.ManagedRuleSet, 0) | |||
func expandWebApplicationFirewallPolicyManagedRuleSet(input []interface{}, d *pluginsdk.ResourceData) ([]webapplicationfirewallpolicies.ManagedRuleSet, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we always return a pointer and an error when an error is returned too:
func expandWebApplicationFirewallPolicyManagedRuleSet(input []interface{}, d *pluginsdk.ResourceData) ([]webapplicationfirewallpolicies.ManagedRuleSet, error) { | |
func expandWebApplicationFirewallPolicyManagedRuleSet(input []interface{}, d *pluginsdk.ResourceData) (*[]webapplicationfirewallpolicies.ManagedRuleSet, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slice can function as a pointer in many instances, though it is not a pointer. I'll update it to a pointer to slice to make it the same as others.
@@ -791,8 +795,8 @@ func expandWebApplicationFirewallPolicyOverrideRules(input []interface{}) *[]net | |||
return &results | |||
} | |||
|
|||
func expandWebApplicationFirewallPolicyMatchCondition(input []interface{}) *[]network.MatchCondition { | |||
results := make([]network.MatchCondition, 0) | |||
func expandWebApplicationFirewallPolicyMatchCondition(input []interface{}) []webapplicationfirewallpolicies.MatchCondition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function will not return with an error, so do not need a pointer to slice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe the expand functions should return a pointer only when the SDK Field is a pointer too? or we always return a pointer no matter what the SDK is?
if err != nil { | ||
return nil, fmt.Errorf("reading %s: %+v", *id, err) | ||
} | ||
|
||
return utils.Bool(resp.ID != nil), nil | ||
return utils.Bool(resp.Model.Id != nil), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return utils.Bool(resp.Model.Id != nil), nil | |
return utils.Bool(resp.Model != nil), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🕸️
@wuxu92 - could you fix up the build? |
…-azure-sdk@2023-02-01
b18d732
to
0ccfb22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor comment that I'm going to push a commit to fix, but this otherwise LGTM - thanks @wuxu92
internal/services/network/web_application_firewall_policy_data_source.go
Outdated
Show resolved
Hide resolved
@tombuildsstuff of course not! thanks! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Draft for TC