1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package waf 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/waf/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// This is AWS WAF Classic documentation. For more information, see AWS WAF Classic 15// (https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) 16// in the developer guide. For the latest version of AWS WAF, use the AWS WAFV2 API 17// and see the AWS WAF Developer Guide 18// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With 19// the latest version, AWS WAF has a single set of endpoints for regional and 20// global use. Inserts or deletes IPSetDescriptor objects in an IPSet. For each 21// IPSetDescriptor object, you specify the following values: 22// 23// * Whether to insert 24// or delete the object from the array. If you want to change an IPSetDescriptor 25// object, you delete the existing object and add a new one. 26// 27// * The IP address 28// version, IPv4 or IPv6. 29// 30// * The IP address in CIDR notation, for example, 31// 192.0.2.0/24 (for the range of IP addresses from 192.0.2.0 to 192.0.2.255) or 32// 192.0.2.44/32 (for the individual IP address 192.0.2.44). 33// 34// AWS WAF supports IPv4 35// address ranges: /8 and any range between /16 through /32. AWS WAF supports IPv6 36// address ranges: /24, /32, /48, /56, /64, and /128. For more information about 37// CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing 38// (https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing). IPv6 addresses 39// can be represented using any of the following formats: 40// 41// * 42// 1111:0000:0000:0000:0000:0000:0000:0111/128 43// 44// * 1111:0:0:0:0:0:0:0111/128 45// 46// * 47// 1111::0111/128 48// 49// * 1111::111/128 50// 51// You use an IPSet to specify which web requests 52// you want to allow or block based on the IP addresses that the requests 53// originated from. For example, if you're receiving a lot of requests from one or 54// a small number of IP addresses and you want to block the requests, you can 55// create an IPSet that specifies those IP addresses, and then configure AWS WAF to 56// block the requests. To create and configure an IPSet, perform the following 57// steps: 58// 59// * Submit a CreateIPSet request. 60// 61// * Use GetChangeToken to get the change 62// token that you provide in the ChangeToken parameter of an UpdateIPSet 63// request. 64// 65// * Submit an UpdateIPSet request to specify the IP addresses that you 66// want AWS WAF to watch for. 67// 68// When you update an IPSet, you specify the IP 69// addresses that you want to add and/or the IP addresses that you want to delete. 70// If you want to change an IP address, you delete the existing IP address and add 71// the new one. You can insert a maximum of 1000 addresses in a single request. For 72// more information about how to use the AWS WAF API to allow or block HTTP 73// requests, see the AWS WAF Developer Guide 74// (https://docs.aws.amazon.com/waf/latest/developerguide/). 75func (c *Client) UpdateIPSet(ctx context.Context, params *UpdateIPSetInput, optFns ...func(*Options)) (*UpdateIPSetOutput, error) { 76 if params == nil { 77 params = &UpdateIPSetInput{} 78 } 79 80 result, metadata, err := c.invokeOperation(ctx, "UpdateIPSet", params, optFns, addOperationUpdateIPSetMiddlewares) 81 if err != nil { 82 return nil, err 83 } 84 85 out := result.(*UpdateIPSetOutput) 86 out.ResultMetadata = metadata 87 return out, nil 88} 89 90type UpdateIPSetInput struct { 91 92 // The value returned by the most recent call to GetChangeToken. 93 // 94 // This member is required. 95 ChangeToken *string 96 97 // The IPSetId of the IPSet that you want to update. IPSetId is returned by 98 // CreateIPSet and by ListIPSets. 99 // 100 // This member is required. 101 IPSetId *string 102 103 // An array of IPSetUpdate objects that you want to insert into or delete from an 104 // IPSet. For more information, see the applicable data types: 105 // 106 // * IPSetUpdate: 107 // Contains Action and IPSetDescriptor 108 // 109 // * IPSetDescriptor: Contains Type and 110 // Value 111 // 112 // You can insert a maximum of 1000 addresses in a single request. 113 // 114 // This member is required. 115 Updates []types.IPSetUpdate 116} 117 118type UpdateIPSetOutput struct { 119 120 // The ChangeToken that you used to submit the UpdateIPSet request. You can also 121 // use this value to query the status of the request. For more information, see 122 // GetChangeTokenStatus. 123 ChangeToken *string 124 125 // Metadata pertaining to the operation's result. 126 ResultMetadata middleware.Metadata 127} 128 129func addOperationUpdateIPSetMiddlewares(stack *middleware.Stack, options Options) (err error) { 130 err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateIPSet{}, middleware.After) 131 if err != nil { 132 return err 133 } 134 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateIPSet{}, middleware.After) 135 if err != nil { 136 return err 137 } 138 if err = addSetLoggerMiddleware(stack, options); err != nil { 139 return err 140 } 141 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 142 return err 143 } 144 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 145 return err 146 } 147 if err = addResolveEndpointMiddleware(stack, options); err != nil { 148 return err 149 } 150 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 151 return err 152 } 153 if err = addRetryMiddlewares(stack, options); err != nil { 154 return err 155 } 156 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 157 return err 158 } 159 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 160 return err 161 } 162 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 163 return err 164 } 165 if err = addClientUserAgent(stack); err != nil { 166 return err 167 } 168 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 169 return err 170 } 171 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 172 return err 173 } 174 if err = addOpUpdateIPSetValidationMiddleware(stack); err != nil { 175 return err 176 } 177 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateIPSet(options.Region), middleware.Before); err != nil { 178 return err 179 } 180 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 181 return err 182 } 183 if err = addResponseErrorMiddleware(stack); err != nil { 184 return err 185 } 186 if err = addRequestResponseLogging(stack, options); err != nil { 187 return err 188 } 189 return nil 190} 191 192func newServiceMetadataMiddleware_opUpdateIPSet(region string) *awsmiddleware.RegisterServiceMetadata { 193 return &awsmiddleware.RegisterServiceMetadata{ 194 Region: region, 195 ServiceID: ServiceID, 196 SigningName: "waf", 197 OperationName: "UpdateIPSet", 198 } 199} 200