1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package route53resolver 4 5import ( 6 "context" 7 "fmt" 8 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 9 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 10 "github.com/aws/aws-sdk-go-v2/service/route53resolver/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Retrieves the firewall rule group associations that you have defined. Each 16// association enables DNS filtering for a VPC with one rule group. A single call 17// might return only a partial list of the associations. For information, see 18// MaxResults. 19func (c *Client) ListFirewallRuleGroupAssociations(ctx context.Context, params *ListFirewallRuleGroupAssociationsInput, optFns ...func(*Options)) (*ListFirewallRuleGroupAssociationsOutput, error) { 20 if params == nil { 21 params = &ListFirewallRuleGroupAssociationsInput{} 22 } 23 24 result, metadata, err := c.invokeOperation(ctx, "ListFirewallRuleGroupAssociations", params, optFns, c.addOperationListFirewallRuleGroupAssociationsMiddlewares) 25 if err != nil { 26 return nil, err 27 } 28 29 out := result.(*ListFirewallRuleGroupAssociationsOutput) 30 out.ResultMetadata = metadata 31 return out, nil 32} 33 34type ListFirewallRuleGroupAssociationsInput struct { 35 36 // The unique identifier of the firewall rule group that you want to retrieve the 37 // associations for. Leave this blank to retrieve associations for any rule group. 38 FirewallRuleGroupId *string 39 40 // The maximum number of objects that you want Resolver to return for this request. 41 // If more objects are available, in the response, Resolver provides a NextToken 42 // value that you can use in a subsequent call to get the next batch of objects. If 43 // you don't specify a value for MaxResults, Resolver returns up to 100 objects. 44 MaxResults *int32 45 46 // For the first call to this list request, omit this value. When you request a 47 // list of objects, Resolver returns at most the number of objects specified in 48 // MaxResults. If more objects are available for retrieval, Resolver returns a 49 // NextToken value in the response. To retrieve the next batch of objects, use the 50 // token that was returned for the prior request in your next request. 51 NextToken *string 52 53 // The setting that determines the processing order of the rule group among the 54 // rule groups that are associated with a single VPC. DNS Firewall filters VPC 55 // traffic starting from the rule group with the lowest numeric priority setting. 56 Priority *int32 57 58 // The association Status setting that you want DNS Firewall to filter on for the 59 // list. If you don't specify this, then DNS Firewall returns all associations, 60 // regardless of status. 61 Status types.FirewallRuleGroupAssociationStatus 62 63 // The unique identifier of the VPC that you want to retrieve the associations for. 64 // Leave this blank to retrieve associations for any VPC. 65 VpcId *string 66 67 noSmithyDocumentSerde 68} 69 70type ListFirewallRuleGroupAssociationsOutput struct { 71 72 // A list of your firewall rule group associations. This might be a partial list of 73 // the associations that you have defined. For information, see MaxResults. 74 FirewallRuleGroupAssociations []types.FirewallRuleGroupAssociation 75 76 // If objects are still available for retrieval, Resolver returns this token in the 77 // response. To retrieve the next batch of objects, provide this token in your next 78 // request. 79 NextToken *string 80 81 // Metadata pertaining to the operation's result. 82 ResultMetadata middleware.Metadata 83 84 noSmithyDocumentSerde 85} 86 87func (c *Client) addOperationListFirewallRuleGroupAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) { 88 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListFirewallRuleGroupAssociations{}, middleware.After) 89 if err != nil { 90 return err 91 } 92 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListFirewallRuleGroupAssociations{}, middleware.After) 93 if err != nil { 94 return err 95 } 96 if err = addSetLoggerMiddleware(stack, options); err != nil { 97 return err 98 } 99 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 100 return err 101 } 102 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 103 return err 104 } 105 if err = addResolveEndpointMiddleware(stack, options); err != nil { 106 return err 107 } 108 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 109 return err 110 } 111 if err = addRetryMiddlewares(stack, options); err != nil { 112 return err 113 } 114 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 118 return err 119 } 120 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 121 return err 122 } 123 if err = addClientUserAgent(stack); err != nil { 124 return err 125 } 126 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 127 return err 128 } 129 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 130 return err 131 } 132 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListFirewallRuleGroupAssociations(options.Region), middleware.Before); err != nil { 133 return err 134 } 135 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 136 return err 137 } 138 if err = addResponseErrorMiddleware(stack); err != nil { 139 return err 140 } 141 if err = addRequestResponseLogging(stack, options); err != nil { 142 return err 143 } 144 return nil 145} 146 147// ListFirewallRuleGroupAssociationsAPIClient is a client that implements the 148// ListFirewallRuleGroupAssociations operation. 149type ListFirewallRuleGroupAssociationsAPIClient interface { 150 ListFirewallRuleGroupAssociations(context.Context, *ListFirewallRuleGroupAssociationsInput, ...func(*Options)) (*ListFirewallRuleGroupAssociationsOutput, error) 151} 152 153var _ ListFirewallRuleGroupAssociationsAPIClient = (*Client)(nil) 154 155// ListFirewallRuleGroupAssociationsPaginatorOptions is the paginator options for 156// ListFirewallRuleGroupAssociations 157type ListFirewallRuleGroupAssociationsPaginatorOptions struct { 158 // The maximum number of objects that you want Resolver to return for this request. 159 // If more objects are available, in the response, Resolver provides a NextToken 160 // value that you can use in a subsequent call to get the next batch of objects. If 161 // you don't specify a value for MaxResults, Resolver returns up to 100 objects. 162 Limit int32 163 164 // Set to true if pagination should stop if the service returns a pagination token 165 // that matches the most recent token provided to the service. 166 StopOnDuplicateToken bool 167} 168 169// ListFirewallRuleGroupAssociationsPaginator is a paginator for 170// ListFirewallRuleGroupAssociations 171type ListFirewallRuleGroupAssociationsPaginator struct { 172 options ListFirewallRuleGroupAssociationsPaginatorOptions 173 client ListFirewallRuleGroupAssociationsAPIClient 174 params *ListFirewallRuleGroupAssociationsInput 175 nextToken *string 176 firstPage bool 177} 178 179// NewListFirewallRuleGroupAssociationsPaginator returns a new 180// ListFirewallRuleGroupAssociationsPaginator 181func NewListFirewallRuleGroupAssociationsPaginator(client ListFirewallRuleGroupAssociationsAPIClient, params *ListFirewallRuleGroupAssociationsInput, optFns ...func(*ListFirewallRuleGroupAssociationsPaginatorOptions)) *ListFirewallRuleGroupAssociationsPaginator { 182 if params == nil { 183 params = &ListFirewallRuleGroupAssociationsInput{} 184 } 185 186 options := ListFirewallRuleGroupAssociationsPaginatorOptions{} 187 if params.MaxResults != nil { 188 options.Limit = *params.MaxResults 189 } 190 191 for _, fn := range optFns { 192 fn(&options) 193 } 194 195 return &ListFirewallRuleGroupAssociationsPaginator{ 196 options: options, 197 client: client, 198 params: params, 199 firstPage: true, 200 } 201} 202 203// HasMorePages returns a boolean indicating whether more pages are available 204func (p *ListFirewallRuleGroupAssociationsPaginator) HasMorePages() bool { 205 return p.firstPage || p.nextToken != nil 206} 207 208// NextPage retrieves the next ListFirewallRuleGroupAssociations page. 209func (p *ListFirewallRuleGroupAssociationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListFirewallRuleGroupAssociationsOutput, error) { 210 if !p.HasMorePages() { 211 return nil, fmt.Errorf("no more pages available") 212 } 213 214 params := *p.params 215 params.NextToken = p.nextToken 216 217 var limit *int32 218 if p.options.Limit > 0 { 219 limit = &p.options.Limit 220 } 221 params.MaxResults = limit 222 223 result, err := p.client.ListFirewallRuleGroupAssociations(ctx, ¶ms, optFns...) 224 if err != nil { 225 return nil, err 226 } 227 p.firstPage = false 228 229 prevToken := p.nextToken 230 p.nextToken = result.NextToken 231 232 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 233 p.nextToken = nil 234 } 235 236 return result, nil 237} 238 239func newServiceMetadataMiddleware_opListFirewallRuleGroupAssociations(region string) *awsmiddleware.RegisterServiceMetadata { 240 return &awsmiddleware.RegisterServiceMetadata{ 241 Region: region, 242 ServiceID: ServiceID, 243 SigningName: "route53resolver", 244 OperationName: "ListFirewallRuleGroupAssociations", 245 } 246} 247