1 // Code generated by smithy-go-codegen DO NOT EDIT.
2 3 package route53
4 5 import (
6 "context"
7 "fmt"
8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9 "github.com/aws/aws-sdk-go-v2/service/route53/types"
10 "github.com/aws/smithy-go/middleware"
11 smithyhttp "github.com/aws/smithy-go/transport/http"
12 )
13 14 // Creates, changes, or deletes CIDR blocks within a collection. Contains
15 // authoritative IP information mapping blocks to one or multiple locations.
16 //
17 // A change request can update multiple locations in a collection at a time, which
18 // is helpful if you want to move one or more CIDR blocks from one location to
19 // another in one transaction, without downtime.
20 //
21 // # Limits
22 //
23 // The max number of CIDR blocks included in the request is 1000. As a result, big
24 // updates require multiple API calls.
25 //
26 // PUT and DELETE_IF_EXISTS
27 //
28 // Use ChangeCidrCollection to perform the following actions:
29 //
30 // - PUT : Create a CIDR block within the specified collection.
31 //
32 // - DELETE_IF_EXISTS : Delete an existing CIDR block from the collection.
33 func (c *Client) ChangeCidrCollection(ctx context.Context, params *ChangeCidrCollectionInput, optFns ...func(*Options)) (*ChangeCidrCollectionOutput, error) {
34 if params == nil {
35 params = &ChangeCidrCollectionInput{}
36 }
37 38 result, metadata, err := c.invokeOperation(ctx, "ChangeCidrCollection", params, optFns, c.addOperationChangeCidrCollectionMiddlewares)
39 if err != nil {
40 return nil, err
41 }
42 43 out := result.(*ChangeCidrCollectionOutput)
44 out.ResultMetadata = metadata
45 return out, nil
46 }
47 48 type ChangeCidrCollectionInput struct {
49 50 // Information about changes to a CIDR collection.
51 //
52 // This member is required.
53 Changes []types.CidrCollectionChange
54 55 // The UUID of the CIDR collection to update.
56 //
57 // This member is required.
58 Id *string
59 60 // A sequential counter that Amazon Route 53 sets to 1 when you create a
61 // collection and increments it by 1 each time you update the collection.
62 //
63 // We recommend that you use ListCidrCollection to get the current value of
64 // CollectionVersion for the collection that you want to update, and then include
65 // that value with the change request. This prevents Route 53 from overwriting an
66 // intervening update:
67 //
68 // - If the value in the request matches the value of CollectionVersion in the
69 // collection, Route 53 updates the collection.
70 //
71 // - If the value of CollectionVersion in the collection is greater than the
72 // value in the request, the collection was changed after you got the version
73 // number. Route 53 does not update the collection, and it returns a
74 // CidrCollectionVersionMismatch error.
75 CollectionVersion *int64
76 77 noSmithyDocumentSerde
78 }
79 80 type ChangeCidrCollectionOutput struct {
81 82 // The ID that is returned by ChangeCidrCollection . You can use it as input to
83 // GetChange to see if a CIDR collection change has propagated or not.
84 //
85 // This member is required.
86 Id *string
87 88 // Metadata pertaining to the operation's result.
89 ResultMetadata middleware.Metadata
90 91 noSmithyDocumentSerde
92 }
93 94 func (c *Client) addOperationChangeCidrCollectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
95 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
96 return err
97 }
98 err = stack.Serialize.Add(&awsRestxml_serializeOpChangeCidrCollection{}, middleware.After)
99 if err != nil {
100 return err
101 }
102 err = stack.Deserialize.Add(&awsRestxml_deserializeOpChangeCidrCollection{}, middleware.After)
103 if err != nil {
104 return err
105 }
106 if err := addProtocolFinalizerMiddlewares(stack, options, "ChangeCidrCollection"); err != nil {
107 return fmt.Errorf("add protocol finalizers: %v", err)
108 }
109 110 if err = addlegacyEndpointContextSetter(stack, options); err != nil {
111 return err
112 }
113 if err = addSetLoggerMiddleware(stack, options); err != nil {
114 return err
115 }
116 if err = addClientRequestID(stack); err != nil {
117 return err
118 }
119 if err = addComputeContentLength(stack); err != nil {
120 return err
121 }
122 if err = addResolveEndpointMiddleware(stack, options); err != nil {
123 return err
124 }
125 if err = addComputePayloadSHA256(stack); err != nil {
126 return err
127 }
128 if err = addRetry(stack, options); err != nil {
129 return err
130 }
131 if err = addRawResponseToMetadata(stack); err != nil {
132 return err
133 }
134 if err = addRecordResponseTiming(stack); err != nil {
135 return err
136 }
137 if err = addSpanRetryLoop(stack, options); err != nil {
138 return err
139 }
140 if err = addClientUserAgent(stack, options); 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 = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
150 return err
151 }
152 if err = addTimeOffsetBuild(stack, c); err != nil {
153 return err
154 }
155 if err = addUserAgentRetryMode(stack, options); err != nil {
156 return err
157 }
158 if err = addCredentialSource(stack, options); err != nil {
159 return err
160 }
161 if err = addOpChangeCidrCollectionValidationMiddleware(stack); err != nil {
162 return err
163 }
164 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opChangeCidrCollection(options.Region), middleware.Before); err != nil {
165 return err
166 }
167 if err = addRecursionDetection(stack); err != nil {
168 return err
169 }
170 if err = addRequestIDRetrieverMiddleware(stack); err != nil {
171 return err
172 }
173 if err = addResponseErrorMiddleware(stack); err != nil {
174 return err
175 }
176 if err = addRequestResponseLogging(stack, options); err != nil {
177 return err
178 }
179 if err = addDisableHTTPSMiddleware(stack, options); err != nil {
180 return err
181 }
182 if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
183 return err
184 }
185 if err = addInterceptAttempt(stack, options); err != nil {
186 return err
187 }
188 if err = addInterceptors(stack, options); err != nil {
189 return err
190 }
191 return nil
192 }
193 194 func newServiceMetadataMiddleware_opChangeCidrCollection(region string) *awsmiddleware.RegisterServiceMetadata {
195 return &awsmiddleware.RegisterServiceMetadata{
196 Region: region,
197 ServiceID: ServiceID,
198 OperationName: "ChangeCidrCollection",
199 }
200 }
201