1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package wafv2 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/wafv2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// This is the latest version of AWS WAF, named AWS WAFV2, released in November, 15// 2019. For information, including how to migrate your AWS WAF resources from the 16// prior release, see the AWS WAF Developer Guide 17// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). 18// Updates the specified RuleGroup. A rule group defines a collection of rules to 19// inspect and control web requests that you can use in a WebACL. When you create a 20// rule group, you define an immutable capacity limit. If you update a rule group, 21// you must stay within the capacity. This allows others to reuse the rule group 22// with confidence in its capacity requirements. 23func (c *Client) UpdateRuleGroup(ctx context.Context, params *UpdateRuleGroupInput, optFns ...func(*Options)) (*UpdateRuleGroupOutput, error) { 24 if params == nil { 25 params = &UpdateRuleGroupInput{} 26 } 27 28 result, metadata, err := c.invokeOperation(ctx, "UpdateRuleGroup", params, optFns, addOperationUpdateRuleGroupMiddlewares) 29 if err != nil { 30 return nil, err 31 } 32 33 out := result.(*UpdateRuleGroupOutput) 34 out.ResultMetadata = metadata 35 return out, nil 36} 37 38type UpdateRuleGroupInput struct { 39 40 // A unique identifier for the rule group. This ID is returned in the responses to 41 // create and list commands. You provide it to operations like update and delete. 42 // 43 // This member is required. 44 Id *string 45 46 // A token used for optimistic locking. AWS WAF returns a token to your get and 47 // list requests, to mark the state of the entity at the time of the request. To 48 // make changes to the entity associated with the token, you provide the token to 49 // operations like update and delete. AWS WAF uses the token to ensure that no 50 // changes have been made to the entity since you last retrieved it. If a change 51 // has been made, the update fails with a WAFOptimisticLockException. If this 52 // happens, perform another get, and use the new token returned by that operation. 53 // 54 // This member is required. 55 LockToken *string 56 57 // The name of the rule group. You cannot change the name of a rule group after you 58 // create it. 59 // 60 // This member is required. 61 Name *string 62 63 // Specifies whether this is for an AWS CloudFront distribution or for a regional 64 // application. A regional application can be an Application Load Balancer (ALB), 65 // an API Gateway REST API, or an AppSync GraphQL API. To work with CloudFront, you 66 // must also specify the Region US East (N. Virginia) as follows: 67 // 68 // * CLI - Specify 69 // the Region when you use the CloudFront scope: --scope=CLOUDFRONT 70 // --region=us-east-1. 71 // 72 // * API and SDKs - For all calls, use the Region endpoint 73 // us-east-1. 74 // 75 // This member is required. 76 Scope types.Scope 77 78 // Defines and enables Amazon CloudWatch metrics and web request sample collection. 79 // 80 // This member is required. 81 VisibilityConfig *types.VisibilityConfig 82 83 // A description of the rule group that helps with identification. You cannot 84 // change the description of a rule group after you create it. 85 Description *string 86 87 // The Rule statements used to identify the web requests that you want to allow, 88 // block, or count. Each rule includes one top-level statement that AWS WAF uses to 89 // identify matching web requests, and parameters that govern how AWS WAF handles 90 // them. 91 Rules []types.Rule 92} 93 94type UpdateRuleGroupOutput struct { 95 96 // A token used for optimistic locking. AWS WAF returns this token to your update 97 // requests. You use NextLockToken in the same manner as you use LockToken. 98 NextLockToken *string 99 100 // Metadata pertaining to the operation's result. 101 ResultMetadata middleware.Metadata 102} 103 104func addOperationUpdateRuleGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { 105 err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateRuleGroup{}, middleware.After) 106 if err != nil { 107 return err 108 } 109 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateRuleGroup{}, middleware.After) 110 if err != nil { 111 return err 112 } 113 if err = addSetLoggerMiddleware(stack, options); err != nil { 114 return err 115 } 116 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 120 return err 121 } 122 if err = addResolveEndpointMiddleware(stack, options); err != nil { 123 return err 124 } 125 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 126 return err 127 } 128 if err = addRetryMiddlewares(stack, options); err != nil { 129 return err 130 } 131 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 132 return err 133 } 134 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 135 return err 136 } 137 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 138 return err 139 } 140 if err = addClientUserAgent(stack); err != nil { 141 return err 142 } 143 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 144 return err 145 } 146 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 147 return err 148 } 149 if err = addOpUpdateRuleGroupValidationMiddleware(stack); err != nil { 150 return err 151 } 152 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRuleGroup(options.Region), middleware.Before); err != nil { 153 return err 154 } 155 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 156 return err 157 } 158 if err = addResponseErrorMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addRequestResponseLogging(stack, options); err != nil { 162 return err 163 } 164 return nil 165} 166 167func newServiceMetadataMiddleware_opUpdateRuleGroup(region string) *awsmiddleware.RegisterServiceMetadata { 168 return &awsmiddleware.RegisterServiceMetadata{ 169 Region: region, 170 ServiceID: ServiceID, 171 SigningName: "wafv2", 172 OperationName: "UpdateRuleGroup", 173 } 174} 175