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 an array of RuleGroupSummary objects for the rule groups that you 19// manage. 20func (c *Client) ListRuleGroups(ctx context.Context, params *ListRuleGroupsInput, optFns ...func(*Options)) (*ListRuleGroupsOutput, error) { 21 if params == nil { 22 params = &ListRuleGroupsInput{} 23 } 24 25 result, metadata, err := c.invokeOperation(ctx, "ListRuleGroups", params, optFns, addOperationListRuleGroupsMiddlewares) 26 if err != nil { 27 return nil, err 28 } 29 30 out := result.(*ListRuleGroupsOutput) 31 out.ResultMetadata = metadata 32 return out, nil 33} 34 35type ListRuleGroupsInput struct { 36 37 // Specifies whether this is for an AWS CloudFront distribution or for a regional 38 // application. A regional application can be an Application Load Balancer (ALB), 39 // an API Gateway REST API, or an AppSync GraphQL API. To work with CloudFront, you 40 // must also specify the Region US East (N. Virginia) as follows: 41 // 42 // * CLI - Specify 43 // the Region when you use the CloudFront scope: --scope=CLOUDFRONT 44 // --region=us-east-1. 45 // 46 // * API and SDKs - For all calls, use the Region endpoint 47 // us-east-1. 48 // 49 // This member is required. 50 Scope types.Scope 51 52 // The maximum number of objects that you want AWS WAF to return for this request. 53 // If more objects are available, in the response, AWS WAF provides a NextMarker 54 // value that you can use in a subsequent call to get the next batch of objects. 55 Limit *int32 56 57 // When you request a list of objects with a Limit setting, if the number of 58 // objects that are still available for retrieval exceeds the limit, AWS WAF 59 // returns a NextMarker value in the response. To retrieve the next batch of 60 // objects, provide the marker from the prior call in your next request. 61 NextMarker *string 62} 63 64type ListRuleGroupsOutput struct { 65 66 // When you request a list of objects with a Limit setting, if the number of 67 // objects that are still available for retrieval exceeds the limit, AWS WAF 68 // returns a NextMarker value in the response. To retrieve the next batch of 69 // objects, provide the marker from the prior call in your next request. 70 NextMarker *string 71 72 // 73 RuleGroups []types.RuleGroupSummary 74 75 // Metadata pertaining to the operation's result. 76 ResultMetadata middleware.Metadata 77} 78 79func addOperationListRuleGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) { 80 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListRuleGroups{}, middleware.After) 81 if err != nil { 82 return err 83 } 84 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListRuleGroups{}, middleware.After) 85 if err != nil { 86 return err 87 } 88 if err = addSetLoggerMiddleware(stack, options); err != nil { 89 return err 90 } 91 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 92 return err 93 } 94 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 95 return err 96 } 97 if err = addResolveEndpointMiddleware(stack, options); err != nil { 98 return err 99 } 100 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 101 return err 102 } 103 if err = addRetryMiddlewares(stack, options); err != nil { 104 return err 105 } 106 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 107 return err 108 } 109 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 110 return err 111 } 112 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 113 return err 114 } 115 if err = addClientUserAgent(stack); err != nil { 116 return err 117 } 118 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 119 return err 120 } 121 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 122 return err 123 } 124 if err = addOpListRuleGroupsValidationMiddleware(stack); err != nil { 125 return err 126 } 127 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRuleGroups(options.Region), middleware.Before); err != nil { 128 return err 129 } 130 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 131 return err 132 } 133 if err = addResponseErrorMiddleware(stack); err != nil { 134 return err 135 } 136 if err = addRequestResponseLogging(stack, options); err != nil { 137 return err 138 } 139 return nil 140} 141 142func newServiceMetadataMiddleware_opListRuleGroups(region string) *awsmiddleware.RegisterServiceMetadata { 143 return &awsmiddleware.RegisterServiceMetadata{ 144 Region: region, 145 ServiceID: ServiceID, 146 SigningName: "wafv2", 147 OperationName: "ListRuleGroups", 148 } 149} 150