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// Updates the specified IPSet. This operation completely replaces any IP address 15// specifications that you already have in the IP set with the ones that you 16// provide to this call. If you want to add to or modify the addresses that are 17// already in the IP set, retrieve those by calling GetIPSet, update them, and 18// provide the complete updated array of IP addresses to this call. 19func (c *Client) UpdateIPSet(ctx context.Context, params *UpdateIPSetInput, optFns ...func(*Options)) (*UpdateIPSetOutput, error) { 20 if params == nil { 21 params = &UpdateIPSetInput{} 22 } 23 24 result, metadata, err := c.invokeOperation(ctx, "UpdateIPSet", params, optFns, addOperationUpdateIPSetMiddlewares) 25 if err != nil { 26 return nil, err 27 } 28 29 out := result.(*UpdateIPSetOutput) 30 out.ResultMetadata = metadata 31 return out, nil 32} 33 34type UpdateIPSetInput struct { 35 36 // Contains an array of strings that specify one or more IP addresses or blocks of 37 // IP addresses in Classless Inter-Domain Routing (CIDR) notation. AWS WAF supports 38 // all IPv4 and IPv6 CIDR ranges except for /0. Examples: 39 // 40 // * To configure AWS WAF 41 // to allow, block, or count requests that originated from the IP address 42 // 192.0.2.44, specify 192.0.2.44/32. 43 // 44 // * To configure AWS WAF to allow, block, or 45 // count requests that originated from IP addresses from 192.0.2.0 to 192.0.2.255, 46 // specify 192.0.2.0/24. 47 // 48 // * To configure AWS WAF to allow, block, or count requests 49 // that originated from the IP address 1111:0000:0000:0000:0000:0000:0000:0111, 50 // specify 1111:0000:0000:0000:0000:0000:0000:0111/128. 51 // 52 // * To configure AWS WAF to 53 // allow, block, or count requests that originated from IP addresses 54 // 1111:0000:0000:0000:0000:0000:0000:0000 to 55 // 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify 56 // 1111:0000:0000:0000:0000:0000:0000:0000/64. 57 // 58 // For more information about CIDR 59 // notation, see the Wikipedia entry Classless Inter-Domain Routing 60 // (https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). 61 // 62 // This member is required. 63 Addresses []string 64 65 // A unique identifier for the set. This ID is returned in the responses to create 66 // and list commands. You provide it to operations like update and delete. 67 // 68 // This member is required. 69 Id *string 70 71 // A token used for optimistic locking. AWS WAF returns a token to your get and 72 // list requests, to mark the state of the entity at the time of the request. To 73 // make changes to the entity associated with the token, you provide the token to 74 // operations like update and delete. AWS WAF uses the token to ensure that no 75 // changes have been made to the entity since you last retrieved it. If a change 76 // has been made, the update fails with a WAFOptimisticLockException. If this 77 // happens, perform another get, and use the new token returned by that operation. 78 // 79 // This member is required. 80 LockToken *string 81 82 // The name of the IP set. You cannot change the name of an IPSet after you create 83 // it. 84 // 85 // This member is required. 86 Name *string 87 88 // Specifies whether this is for an AWS CloudFront distribution or for a regional 89 // application. A regional application can be an Application Load Balancer (ALB), 90 // an API Gateway REST API, or an AppSync GraphQL API. To work with CloudFront, you 91 // must also specify the Region US East (N. Virginia) as follows: 92 // 93 // * CLI - Specify 94 // the Region when you use the CloudFront scope: --scope=CLOUDFRONT 95 // --region=us-east-1. 96 // 97 // * API and SDKs - For all calls, use the Region endpoint 98 // us-east-1. 99 // 100 // This member is required. 101 Scope types.Scope 102 103 // A description of the IP set that helps with identification. 104 Description *string 105} 106 107type UpdateIPSetOutput struct { 108 109 // A token used for optimistic locking. AWS WAF returns this token to your update 110 // requests. You use NextLockToken in the same manner as you use LockToken. 111 NextLockToken *string 112 113 // Metadata pertaining to the operation's result. 114 ResultMetadata middleware.Metadata 115} 116 117func addOperationUpdateIPSetMiddlewares(stack *middleware.Stack, options Options) (err error) { 118 err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateIPSet{}, middleware.After) 119 if err != nil { 120 return err 121 } 122 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateIPSet{}, middleware.After) 123 if err != nil { 124 return err 125 } 126 if err = addSetLoggerMiddleware(stack, options); err != nil { 127 return err 128 } 129 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 130 return err 131 } 132 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 133 return err 134 } 135 if err = addResolveEndpointMiddleware(stack, options); err != nil { 136 return err 137 } 138 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 139 return err 140 } 141 if err = addRetryMiddlewares(stack, options); err != nil { 142 return err 143 } 144 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 145 return err 146 } 147 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 148 return err 149 } 150 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 151 return err 152 } 153 if err = addClientUserAgent(stack); err != nil { 154 return err 155 } 156 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 157 return err 158 } 159 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 160 return err 161 } 162 if err = addOpUpdateIPSetValidationMiddleware(stack); err != nil { 163 return err 164 } 165 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateIPSet(options.Region), middleware.Before); err != nil { 166 return err 167 } 168 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 169 return err 170 } 171 if err = addResponseErrorMiddleware(stack); err != nil { 172 return err 173 } 174 if err = addRequestResponseLogging(stack, options); err != nil { 175 return err 176 } 177 return nil 178} 179 180func newServiceMetadataMiddleware_opUpdateIPSet(region string) *awsmiddleware.RegisterServiceMetadata { 181 return &awsmiddleware.RegisterServiceMetadata{ 182 Region: region, 183 ServiceID: ServiceID, 184 SigningName: "wafv2", 185 OperationName: "UpdateIPSet", 186 } 187} 188