api_op_ChangeCidrCollection.go (5572B)
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. A 16 // change request can update multiple locations in a collection at a time, which is 17 // helpful if you want to move one or more CIDR blocks from one location to another 18 // in one transaction, without downtime. Limits The max number of CIDR blocks 19 // included in the request is 1000. As a result, big updates require multiple API 20 // calls. PUT and DELETE_IF_EXISTS Use ChangeCidrCollection to perform the 21 // following actions: 22 // - PUT : Create a CIDR block within the specified collection. 23 // - DELETE_IF_EXISTS : Delete an existing CIDR block from the collection. 24 func (c *Client) ChangeCidrCollection(ctx context.Context, params *ChangeCidrCollectionInput, optFns ...func(*Options)) (*ChangeCidrCollectionOutput, error) { 25 if params == nil { 26 params = &ChangeCidrCollectionInput{} 27 } 28 29 result, metadata, err := c.invokeOperation(ctx, "ChangeCidrCollection", params, optFns, c.addOperationChangeCidrCollectionMiddlewares) 30 if err != nil { 31 return nil, err 32 } 33 34 out := result.(*ChangeCidrCollectionOutput) 35 out.ResultMetadata = metadata 36 return out, nil 37 } 38 39 type ChangeCidrCollectionInput struct { 40 41 // Information about changes to a CIDR collection. 42 // 43 // This member is required. 44 Changes []types.CidrCollectionChange 45 46 // The UUID of the CIDR collection to update. 47 // 48 // This member is required. 49 Id *string 50 51 // A sequential counter that Amazon Route 53 sets to 1 when you create a 52 // collection and increments it by 1 each time you update the collection. We 53 // recommend that you use ListCidrCollection to get the current value of 54 // CollectionVersion for the collection that you want to update, and then include 55 // that value with the change request. This prevents Route 53 from overwriting an 56 // intervening update: 57 // - If the value in the request matches the value of CollectionVersion in the 58 // collection, Route 53 updates the collection. 59 // - If the value of CollectionVersion in the collection is greater than the 60 // value in the request, the collection was changed after you got the version 61 // number. Route 53 does not update the collection, and it returns a 62 // CidrCollectionVersionMismatch error. 63 CollectionVersion *int64 64 65 noSmithyDocumentSerde 66 } 67 68 type ChangeCidrCollectionOutput struct { 69 70 // The ID that is returned by ChangeCidrCollection . You can use it as input to 71 // GetChange to see if a CIDR collection change has propagated or not. 72 // 73 // This member is required. 74 Id *string 75 76 // Metadata pertaining to the operation's result. 77 ResultMetadata middleware.Metadata 78 79 noSmithyDocumentSerde 80 } 81 82 func (c *Client) addOperationChangeCidrCollectionMiddlewares(stack *middleware.Stack, options Options) (err error) { 83 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 84 return err 85 } 86 err = stack.Serialize.Add(&awsRestxml_serializeOpChangeCidrCollection{}, middleware.After) 87 if err != nil { 88 return err 89 } 90 err = stack.Deserialize.Add(&awsRestxml_deserializeOpChangeCidrCollection{}, middleware.After) 91 if err != nil { 92 return err 93 } 94 if err := addProtocolFinalizerMiddlewares(stack, options, "ChangeCidrCollection"); err != nil { 95 return fmt.Errorf("add protocol finalizers: %v", err) 96 } 97 98 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 99 return err 100 } 101 if err = addSetLoggerMiddleware(stack, options); err != nil { 102 return err 103 } 104 if err = addClientRequestID(stack); err != nil { 105 return err 106 } 107 if err = addComputeContentLength(stack); err != nil { 108 return err 109 } 110 if err = addResolveEndpointMiddleware(stack, options); err != nil { 111 return err 112 } 113 if err = addComputePayloadSHA256(stack); err != nil { 114 return err 115 } 116 if err = addRetry(stack, options); err != nil { 117 return err 118 } 119 if err = addRawResponseToMetadata(stack); err != nil { 120 return err 121 } 122 if err = addRecordResponseTiming(stack); err != nil { 123 return err 124 } 125 if err = addClientUserAgent(stack, options); err != nil { 126 return err 127 } 128 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 135 return err 136 } 137 if err = addOpChangeCidrCollectionValidationMiddleware(stack); err != nil { 138 return err 139 } 140 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opChangeCidrCollection(options.Region), middleware.Before); err != nil { 141 return err 142 } 143 if err = addRecursionDetection(stack); err != nil { 144 return err 145 } 146 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 147 return err 148 } 149 if err = addResponseErrorMiddleware(stack); err != nil { 150 return err 151 } 152 if err = addRequestResponseLogging(stack, options); err != nil { 153 return err 154 } 155 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 156 return err 157 } 158 return nil 159 } 160 161 func newServiceMetadataMiddleware_opChangeCidrCollection(region string) *awsmiddleware.RegisterServiceMetadata { 162 return &awsmiddleware.RegisterServiceMetadata{ 163 Region: region, 164 ServiceID: ServiceID, 165 OperationName: "ChangeCidrCollection", 166 } 167 }