1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package wafregional 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/smithy-go/middleware" 10 smithyhttp "github.com/aws/smithy-go/transport/http" 11) 12 13// This is AWS WAF Classic documentation. For more information, see AWS WAF Classic 14// (https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) 15// in the developer guide. For the latest version of AWS WAF, use the AWS WAFV2 API 16// and see the AWS WAF Developer Guide 17// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With 18// the latest version, AWS WAF has a single set of endpoints for regional and 19// global use. Permanently deletes a Rule. You can't delete a Rule if it's still 20// used in any WebACL objects or if it still includes any predicates, such as 21// ByteMatchSet objects. If you just want to remove a Rule from a WebACL, use 22// UpdateWebACL. To permanently delete a Rule from AWS WAF, perform the following 23// steps: 24// 25// * Update the Rule to remove predicates, if any. For more information, 26// see UpdateRule. 27// 28// * Use GetChangeToken to get the change token that you provide 29// in the ChangeToken parameter of a DeleteRule request. 30// 31// * Submit a DeleteRule 32// request. 33func (c *Client) DeleteRule(ctx context.Context, params *DeleteRuleInput, optFns ...func(*Options)) (*DeleteRuleOutput, error) { 34 if params == nil { 35 params = &DeleteRuleInput{} 36 } 37 38 result, metadata, err := c.invokeOperation(ctx, "DeleteRule", params, optFns, c.addOperationDeleteRuleMiddlewares) 39 if err != nil { 40 return nil, err 41 } 42 43 out := result.(*DeleteRuleOutput) 44 out.ResultMetadata = metadata 45 return out, nil 46} 47 48type DeleteRuleInput struct { 49 50 // The value returned by the most recent call to GetChangeToken. 51 // 52 // This member is required. 53 ChangeToken *string 54 55 // The RuleId of the Rule that you want to delete. RuleId is returned by CreateRule 56 // and by ListRules. 57 // 58 // This member is required. 59 RuleId *string 60 61 noSmithyDocumentSerde 62} 63 64type DeleteRuleOutput struct { 65 66 // The ChangeToken that you used to submit the DeleteRule request. You can also use 67 // this value to query the status of the request. For more information, see 68 // GetChangeTokenStatus. 69 ChangeToken *string 70 71 // Metadata pertaining to the operation's result. 72 ResultMetadata middleware.Metadata 73 74 noSmithyDocumentSerde 75} 76 77func (c *Client) addOperationDeleteRuleMiddlewares(stack *middleware.Stack, options Options) (err error) { 78 err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteRule{}, middleware.After) 79 if err != nil { 80 return err 81 } 82 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteRule{}, middleware.After) 83 if err != nil { 84 return err 85 } 86 if err = addSetLoggerMiddleware(stack, options); err != nil { 87 return err 88 } 89 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 90 return err 91 } 92 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 93 return err 94 } 95 if err = addResolveEndpointMiddleware(stack, options); err != nil { 96 return err 97 } 98 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 99 return err 100 } 101 if err = addRetryMiddlewares(stack, options); err != nil { 102 return err 103 } 104 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 105 return err 106 } 107 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 108 return err 109 } 110 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 111 return err 112 } 113 if err = addClientUserAgent(stack); err != nil { 114 return err 115 } 116 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 117 return err 118 } 119 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 120 return err 121 } 122 if err = addOpDeleteRuleValidationMiddleware(stack); err != nil { 123 return err 124 } 125 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRule(options.Region), middleware.Before); err != nil { 126 return err 127 } 128 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 129 return err 130 } 131 if err = addResponseErrorMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addRequestResponseLogging(stack, options); err != nil { 135 return err 136 } 137 return nil 138} 139 140func newServiceMetadataMiddleware_opDeleteRule(region string) *awsmiddleware.RegisterServiceMetadata { 141 return &awsmiddleware.RegisterServiceMetadata{ 142 Region: region, 143 ServiceID: ServiceID, 144 SigningName: "waf-regional", 145 OperationName: "DeleteRule", 146 } 147} 148