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// Lists information about associations between Amazon VPCs and query logging 16// configurations. 17func (c *Client) ListResolverQueryLogConfigAssociations(ctx context.Context, params *ListResolverQueryLogConfigAssociationsInput, optFns ...func(*Options)) (*ListResolverQueryLogConfigAssociationsOutput, error) { 18 if params == nil { 19 params = &ListResolverQueryLogConfigAssociationsInput{} 20 } 21 22 result, metadata, err := c.invokeOperation(ctx, "ListResolverQueryLogConfigAssociations", params, optFns, addOperationListResolverQueryLogConfigAssociationsMiddlewares) 23 if err != nil { 24 return nil, err 25 } 26 27 out := result.(*ListResolverQueryLogConfigAssociationsOutput) 28 out.ResultMetadata = metadata 29 return out, nil 30} 31 32type ListResolverQueryLogConfigAssociationsInput struct { 33 34 // An optional specification to return a subset of query logging associations. If 35 // you submit a second or subsequent ListResolverQueryLogConfigAssociations request 36 // and specify the NextToken parameter, you must use the same values for Filters, 37 // if any, as in the previous request. 38 Filters []types.Filter 39 40 // The maximum number of query logging associations that you want to return in the 41 // response to a ListResolverQueryLogConfigAssociations request. If you don't 42 // specify a value for MaxResults, Resolver returns up to 100 query logging 43 // associations. 44 MaxResults *int32 45 46 // For the first ListResolverQueryLogConfigAssociations request, omit this value. 47 // If there are more than MaxResults query logging associations that match the 48 // values that you specify for Filters, you can submit another 49 // ListResolverQueryLogConfigAssociations request to get the next group of 50 // associations. In the next request, specify the value of NextToken from the 51 // previous response. 52 NextToken *string 53 54 // The element that you want Resolver to sort query logging associations by. If you 55 // submit a second or subsequent ListResolverQueryLogConfigAssociations request and 56 // specify the NextToken parameter, you must use the same value for SortBy, if any, 57 // as in the previous request. Valid values include the following elements: 58 // 59 // * 60 // CreationTime: The ID of the query logging association. 61 // 62 // * Error: If the value of 63 // Status is FAILED, the value of Error indicates the cause: 64 // 65 // * 66 // DESTINATION_NOT_FOUND: The specified destination (for example, an Amazon S3 67 // bucket) was deleted. 68 // 69 // * ACCESS_DENIED: Permissions don't allow sending logs to 70 // the destination. 71 // 72 // If Status is a value other than FAILED, ERROR is null. 73 // 74 // * Id: 75 // The ID of the query logging association 76 // 77 // * ResolverQueryLogConfigId: The ID of 78 // the query logging configuration 79 // 80 // * ResourceId: The ID of the VPC that is 81 // associated with the query logging configuration 82 // 83 // * Status: The current status of 84 // the configuration. Valid values include the following: 85 // 86 // * CREATING: Resolver is 87 // creating an association between an Amazon VPC and a query logging 88 // configuration. 89 // 90 // * CREATED: The association between an Amazon VPC and a query 91 // logging configuration was successfully created. Resolver is logging queries that 92 // originate in the specified VPC. 93 // 94 // * DELETING: Resolver is deleting this query 95 // logging association. 96 // 97 // * FAILED: Resolver either couldn't create or couldn't 98 // delete the query logging association. Here are two common causes: 99 // 100 // * The 101 // specified destination (for example, an Amazon S3 bucket) was deleted. 102 // 103 // * 104 // Permissions don't allow sending logs to the destination. 105 SortBy *string 106 107 // If you specified a value for SortBy, the order that you want query logging 108 // associations to be listed in, ASCENDING or DESCENDING. If you submit a second or 109 // subsequent ListResolverQueryLogConfigAssociations request and specify the 110 // NextToken parameter, you must use the same value for SortOrder, if any, as in 111 // the previous request. 112 SortOrder types.SortOrder 113} 114 115type ListResolverQueryLogConfigAssociationsOutput struct { 116 117 // If there are more than MaxResults query logging associations, you can submit 118 // another ListResolverQueryLogConfigAssociations request to get the next group of 119 // associations. In the next request, specify the value of NextToken from the 120 // previous response. 121 NextToken *string 122 123 // A list that contains one ResolverQueryLogConfigAssociations element for each 124 // query logging association that matches the values that you specified for Filter. 125 ResolverQueryLogConfigAssociations []types.ResolverQueryLogConfigAssociation 126 127 // The total number of query logging associations that were created by the current 128 // account in the specified Region. This count can differ from the number of 129 // associations that are returned in a ListResolverQueryLogConfigAssociations 130 // response, depending on the values that you specify in the request. 131 TotalCount int32 132 133 // The total number of query logging associations that were created by the current 134 // account in the specified Region and that match the filters that were specified 135 // in the ListResolverQueryLogConfigAssociations request. For the total number of 136 // associations that were created by the current account in the specified Region, 137 // see TotalCount. 138 TotalFilteredCount int32 139 140 // Metadata pertaining to the operation's result. 141 ResultMetadata middleware.Metadata 142} 143 144func addOperationListResolverQueryLogConfigAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) { 145 err = stack.Serialize.Add(&awsAwsjson11_serializeOpListResolverQueryLogConfigAssociations{}, middleware.After) 146 if err != nil { 147 return err 148 } 149 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListResolverQueryLogConfigAssociations{}, middleware.After) 150 if err != nil { 151 return err 152 } 153 if err = addSetLoggerMiddleware(stack, options); err != nil { 154 return err 155 } 156 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 157 return err 158 } 159 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 160 return err 161 } 162 if err = addResolveEndpointMiddleware(stack, options); err != nil { 163 return err 164 } 165 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 166 return err 167 } 168 if err = addRetryMiddlewares(stack, options); err != nil { 169 return err 170 } 171 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 172 return err 173 } 174 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 175 return err 176 } 177 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 178 return err 179 } 180 if err = addClientUserAgent(stack); err != nil { 181 return err 182 } 183 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 184 return err 185 } 186 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 187 return err 188 } 189 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListResolverQueryLogConfigAssociations(options.Region), middleware.Before); err != nil { 190 return err 191 } 192 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 193 return err 194 } 195 if err = addResponseErrorMiddleware(stack); err != nil { 196 return err 197 } 198 if err = addRequestResponseLogging(stack, options); err != nil { 199 return err 200 } 201 return nil 202} 203 204// ListResolverQueryLogConfigAssociationsAPIClient is a client that implements the 205// ListResolverQueryLogConfigAssociations operation. 206type ListResolverQueryLogConfigAssociationsAPIClient interface { 207 ListResolverQueryLogConfigAssociations(context.Context, *ListResolverQueryLogConfigAssociationsInput, ...func(*Options)) (*ListResolverQueryLogConfigAssociationsOutput, error) 208} 209 210var _ ListResolverQueryLogConfigAssociationsAPIClient = (*Client)(nil) 211 212// ListResolverQueryLogConfigAssociationsPaginatorOptions is the paginator options 213// for ListResolverQueryLogConfigAssociations 214type ListResolverQueryLogConfigAssociationsPaginatorOptions struct { 215 // The maximum number of query logging associations that you want to return in the 216 // response to a ListResolverQueryLogConfigAssociations request. If you don't 217 // specify a value for MaxResults, Resolver returns up to 100 query logging 218 // associations. 219 Limit int32 220 221 // Set to true if pagination should stop if the service returns a pagination token 222 // that matches the most recent token provided to the service. 223 StopOnDuplicateToken bool 224} 225 226// ListResolverQueryLogConfigAssociationsPaginator is a paginator for 227// ListResolverQueryLogConfigAssociations 228type ListResolverQueryLogConfigAssociationsPaginator struct { 229 options ListResolverQueryLogConfigAssociationsPaginatorOptions 230 client ListResolverQueryLogConfigAssociationsAPIClient 231 params *ListResolverQueryLogConfigAssociationsInput 232 nextToken *string 233 firstPage bool 234} 235 236// NewListResolverQueryLogConfigAssociationsPaginator returns a new 237// ListResolverQueryLogConfigAssociationsPaginator 238func NewListResolverQueryLogConfigAssociationsPaginator(client ListResolverQueryLogConfigAssociationsAPIClient, params *ListResolverQueryLogConfigAssociationsInput, optFns ...func(*ListResolverQueryLogConfigAssociationsPaginatorOptions)) *ListResolverQueryLogConfigAssociationsPaginator { 239 if params == nil { 240 params = &ListResolverQueryLogConfigAssociationsInput{} 241 } 242 243 options := ListResolverQueryLogConfigAssociationsPaginatorOptions{} 244 if params.MaxResults != nil { 245 options.Limit = *params.MaxResults 246 } 247 248 for _, fn := range optFns { 249 fn(&options) 250 } 251 252 return &ListResolverQueryLogConfigAssociationsPaginator{ 253 options: options, 254 client: client, 255 params: params, 256 firstPage: true, 257 } 258} 259 260// HasMorePages returns a boolean indicating whether more pages are available 261func (p *ListResolverQueryLogConfigAssociationsPaginator) HasMorePages() bool { 262 return p.firstPage || p.nextToken != nil 263} 264 265// NextPage retrieves the next ListResolverQueryLogConfigAssociations page. 266func (p *ListResolverQueryLogConfigAssociationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListResolverQueryLogConfigAssociationsOutput, error) { 267 if !p.HasMorePages() { 268 return nil, fmt.Errorf("no more pages available") 269 } 270 271 params := *p.params 272 params.NextToken = p.nextToken 273 274 var limit *int32 275 if p.options.Limit > 0 { 276 limit = &p.options.Limit 277 } 278 params.MaxResults = limit 279 280 result, err := p.client.ListResolverQueryLogConfigAssociations(ctx, ¶ms, optFns...) 281 if err != nil { 282 return nil, err 283 } 284 p.firstPage = false 285 286 prevToken := p.nextToken 287 p.nextToken = result.NextToken 288 289 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 290 p.nextToken = nil 291 } 292 293 return result, nil 294} 295 296func newServiceMetadataMiddleware_opListResolverQueryLogConfigAssociations(region string) *awsmiddleware.RegisterServiceMetadata { 297 return &awsmiddleware.RegisterServiceMetadata{ 298 Region: region, 299 ServiceID: ServiceID, 300 SigningName: "route53resolver", 301 OperationName: "ListResolverQueryLogConfigAssociations", 302 } 303} 304