1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package wafv2 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/wafv2/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// This is the latest version of AWS WAF, named AWS WAFV2, released in November, 15// 2019. For information, including how to migrate your AWS WAF resources from the 16// prior release, see the AWS WAF Developer Guide 17// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). 18// Retrieves the specified RuleGroup. 19func (c *Client) GetRuleGroup(ctx context.Context, params *GetRuleGroupInput, optFns ...func(*Options)) (*GetRuleGroupOutput, error) { 20 if params == nil { 21 params = &GetRuleGroupInput{} 22 } 23 24 result, metadata, err := c.invokeOperation(ctx, "GetRuleGroup", params, optFns, addOperationGetRuleGroupMiddlewares) 25 if err != nil { 26 return nil, err 27 } 28 29 out := result.(*GetRuleGroupOutput) 30 out.ResultMetadata = metadata 31 return out, nil 32} 33 34type GetRuleGroupInput struct { 35 36 // A unique identifier for the rule group. This ID is returned in the responses to 37 // create and list commands. You provide it to operations like update and delete. 38 // 39 // This member is required. 40 Id *string 41 42 // The name of the rule group. You cannot change the name of a rule group after you 43 // create it. 44 // 45 // This member is required. 46 Name *string 47 48 // Specifies whether this is for an AWS CloudFront distribution or for a regional 49 // application. A regional application can be an Application Load Balancer (ALB), 50 // an API Gateway REST API, or an AppSync GraphQL API. To work with CloudFront, you 51 // must also specify the Region US East (N. Virginia) as follows: 52 // 53 // * CLI - Specify 54 // the Region when you use the CloudFront scope: --scope=CLOUDFRONT 55 // --region=us-east-1. 56 // 57 // * API and SDKs - For all calls, use the Region endpoint 58 // us-east-1. 59 // 60 // This member is required. 61 Scope types.Scope 62} 63 64type GetRuleGroupOutput struct { 65 66 // A token used for optimistic locking. AWS WAF returns a token to your get and 67 // list requests, to mark the state of the entity at the time of the request. To 68 // make changes to the entity associated with the token, you provide the token to 69 // operations like update and delete. AWS WAF uses the token to ensure that no 70 // changes have been made to the entity since you last retrieved it. If a change 71 // has been made, the update fails with a WAFOptimisticLockException. If this 72 // happens, perform another get, and use the new token returned by that operation. 73 LockToken *string 74 75 // 76 RuleGroup *types.RuleGroup 77 78 // Metadata pertaining to the operation's result. 79 ResultMetadata middleware.Metadata 80} 81 82func addOperationGetRuleGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { 83 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetRuleGroup{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetRuleGroup{}, middleware.After) 88 if err != nil { 89 return err 90 } 91 if err = addSetLoggerMiddleware(stack, options); err != nil { 92 return err 93 } 94 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 95 return err 96 } 97 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 98 return err 99 } 100 if err = addResolveEndpointMiddleware(stack, options); err != nil { 101 return err 102 } 103 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 104 return err 105 } 106 if err = addRetryMiddlewares(stack, options); err != nil { 107 return err 108 } 109 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 110 return err 111 } 112 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 113 return err 114 } 115 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 116 return err 117 } 118 if err = addClientUserAgent(stack); err != nil { 119 return err 120 } 121 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 122 return err 123 } 124 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addOpGetRuleGroupValidationMiddleware(stack); err != nil { 128 return err 129 } 130 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRuleGroup(options.Region), middleware.Before); err != nil { 131 return err 132 } 133 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 134 return err 135 } 136 if err = addResponseErrorMiddleware(stack); err != nil { 137 return err 138 } 139 if err = addRequestResponseLogging(stack, options); err != nil { 140 return err 141 } 142 return nil 143} 144 145func newServiceMetadataMiddleware_opGetRuleGroup(region string) *awsmiddleware.RegisterServiceMetadata { 146 return &awsmiddleware.RegisterServiceMetadata{ 147 Region: region, 148 ServiceID: ServiceID, 149 SigningName: "wafv2", 150 OperationName: "GetRuleGroup", 151 } 152} 153