api_op_DeleteTrafficPolicy.go (4517B)
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/smithy-go/middleware" 10 smithyhttp "github.com/aws/smithy-go/transport/http" 11 ) 12 13 // Deletes a traffic policy. When you delete a traffic policy, Route 53 sets a 14 // flag on the policy to indicate that it has been deleted. However, Route 53 never 15 // fully deletes the traffic policy. Note the following: 16 // - Deleted traffic policies aren't listed if you run ListTrafficPolicies (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListTrafficPolicies.html) 17 // . 18 // - There's no way to get a list of deleted policies. 19 // - If you retain the ID of the policy, you can get information about the 20 // policy, including the traffic policy document, by running GetTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetTrafficPolicy.html) 21 // . 22 func (c *Client) DeleteTrafficPolicy(ctx context.Context, params *DeleteTrafficPolicyInput, optFns ...func(*Options)) (*DeleteTrafficPolicyOutput, error) { 23 if params == nil { 24 params = &DeleteTrafficPolicyInput{} 25 } 26 27 result, metadata, err := c.invokeOperation(ctx, "DeleteTrafficPolicy", params, optFns, c.addOperationDeleteTrafficPolicyMiddlewares) 28 if err != nil { 29 return nil, err 30 } 31 32 out := result.(*DeleteTrafficPolicyOutput) 33 out.ResultMetadata = metadata 34 return out, nil 35 } 36 37 // A request to delete a specified traffic policy version. 38 type DeleteTrafficPolicyInput struct { 39 40 // The ID of the traffic policy that you want to delete. 41 // 42 // This member is required. 43 Id *string 44 45 // The version number of the traffic policy that you want to delete. 46 // 47 // This member is required. 48 Version *int32 49 50 noSmithyDocumentSerde 51 } 52 53 // An empty element. 54 type DeleteTrafficPolicyOutput struct { 55 // Metadata pertaining to the operation's result. 56 ResultMetadata middleware.Metadata 57 58 noSmithyDocumentSerde 59 } 60 61 func (c *Client) addOperationDeleteTrafficPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { 62 if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { 63 return err 64 } 65 err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteTrafficPolicy{}, middleware.After) 66 if err != nil { 67 return err 68 } 69 err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteTrafficPolicy{}, middleware.After) 70 if err != nil { 71 return err 72 } 73 if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteTrafficPolicy"); err != nil { 74 return fmt.Errorf("add protocol finalizers: %v", err) 75 } 76 77 if err = addlegacyEndpointContextSetter(stack, options); err != nil { 78 return err 79 } 80 if err = addSetLoggerMiddleware(stack, options); err != nil { 81 return err 82 } 83 if err = addClientRequestID(stack); err != nil { 84 return err 85 } 86 if err = addComputeContentLength(stack); err != nil { 87 return err 88 } 89 if err = addResolveEndpointMiddleware(stack, options); err != nil { 90 return err 91 } 92 if err = addComputePayloadSHA256(stack); err != nil { 93 return err 94 } 95 if err = addRetry(stack, options); err != nil { 96 return err 97 } 98 if err = addRawResponseToMetadata(stack); err != nil { 99 return err 100 } 101 if err = addRecordResponseTiming(stack); err != nil { 102 return err 103 } 104 if err = addClientUserAgent(stack, options); err != nil { 105 return err 106 } 107 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 108 return err 109 } 110 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 111 return err 112 } 113 if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { 114 return err 115 } 116 if err = addOpDeleteTrafficPolicyValidationMiddleware(stack); err != nil { 117 return err 118 } 119 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteTrafficPolicy(options.Region), middleware.Before); err != nil { 120 return err 121 } 122 if err = addRecursionDetection(stack); err != nil { 123 return err 124 } 125 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addResponseErrorMiddleware(stack); err != nil { 129 return err 130 } 131 if err = addRequestResponseLogging(stack, options); err != nil { 132 return err 133 } 134 if err = addDisableHTTPSMiddleware(stack, options); err != nil { 135 return err 136 } 137 return nil 138 } 139 140 func newServiceMetadataMiddleware_opDeleteTrafficPolicy(region string) *awsmiddleware.RegisterServiceMetadata { 141 return &awsmiddleware.RegisterServiceMetadata{ 142 Region: region, 143 ServiceID: ServiceID, 144 OperationName: "DeleteTrafficPolicy", 145 } 146 }