1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package ec2 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/ec2/types" 11 "github.com/aws/smithy-go/middleware" 12 smithyhttp "github.com/aws/smithy-go/transport/http" 13) 14 15// Gets information about the associations for the transit gateway multicast 16// domain. 17func (c *Client) GetTransitGatewayMulticastDomainAssociations(ctx context.Context, params *GetTransitGatewayMulticastDomainAssociationsInput, optFns ...func(*Options)) (*GetTransitGatewayMulticastDomainAssociationsOutput, error) { 18 if params == nil { 19 params = &GetTransitGatewayMulticastDomainAssociationsInput{} 20 } 21 22 result, metadata, err := c.invokeOperation(ctx, "GetTransitGatewayMulticastDomainAssociations", params, optFns, addOperationGetTransitGatewayMulticastDomainAssociationsMiddlewares) 23 if err != nil { 24 return nil, err 25 } 26 27 out := result.(*GetTransitGatewayMulticastDomainAssociationsOutput) 28 out.ResultMetadata = metadata 29 return out, nil 30} 31 32type GetTransitGatewayMulticastDomainAssociationsInput struct { 33 34 // Checks whether you have the required permissions for the action, without 35 // actually making the request, and provides an error response. If you have the 36 // required permissions, the error response is DryRunOperation. Otherwise, it is 37 // UnauthorizedOperation. 38 DryRun bool 39 40 // One or more filters. The possible values are: 41 // 42 // * resource-id - The ID of the 43 // resource. 44 // 45 // * resource-type - The type of resource. The valid value is: vpc. 46 // 47 // * 48 // state - The state of the subnet association. Valid values are associated | 49 // associating | disassociated | disassociating. 50 // 51 // * subnet-id - The ID of the 52 // subnet. 53 // 54 // * transit-gateway-attachment-id - The id of the transit gateway 55 // attachment. 56 Filters []types.Filter 57 58 // The maximum number of results to return with a single call. To retrieve the 59 // remaining results, make another call with the returned nextToken value. 60 MaxResults int32 61 62 // The token for the next page of results. 63 NextToken *string 64 65 // The ID of the transit gateway multicast domain. 66 TransitGatewayMulticastDomainId *string 67} 68 69type GetTransitGatewayMulticastDomainAssociationsOutput struct { 70 71 // Information about the multicast domain associations. 72 MulticastDomainAssociations []types.TransitGatewayMulticastDomainAssociation 73 74 // The token to use to retrieve the next page of results. This value is null when 75 // there are no more results to return. 76 NextToken *string 77 78 // Metadata pertaining to the operation's result. 79 ResultMetadata middleware.Metadata 80} 81 82func addOperationGetTransitGatewayMulticastDomainAssociationsMiddlewares(stack *middleware.Stack, options Options) (err error) { 83 err = stack.Serialize.Add(&awsEc2query_serializeOpGetTransitGatewayMulticastDomainAssociations{}, middleware.After) 84 if err != nil { 85 return err 86 } 87 err = stack.Deserialize.Add(&awsEc2query_deserializeOpGetTransitGatewayMulticastDomainAssociations{}, 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 = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTransitGatewayMulticastDomainAssociations(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 142// GetTransitGatewayMulticastDomainAssociationsAPIClient is a client that 143// implements the GetTransitGatewayMulticastDomainAssociations operation. 144type GetTransitGatewayMulticastDomainAssociationsAPIClient interface { 145 GetTransitGatewayMulticastDomainAssociations(context.Context, *GetTransitGatewayMulticastDomainAssociationsInput, ...func(*Options)) (*GetTransitGatewayMulticastDomainAssociationsOutput, error) 146} 147 148var _ GetTransitGatewayMulticastDomainAssociationsAPIClient = (*Client)(nil) 149 150// GetTransitGatewayMulticastDomainAssociationsPaginatorOptions is the paginator 151// options for GetTransitGatewayMulticastDomainAssociations 152type GetTransitGatewayMulticastDomainAssociationsPaginatorOptions struct { 153 // The maximum number of results to return with a single call. To retrieve the 154 // remaining results, make another call with the returned nextToken value. 155 Limit int32 156 157 // Set to true if pagination should stop if the service returns a pagination token 158 // that matches the most recent token provided to the service. 159 StopOnDuplicateToken bool 160} 161 162// GetTransitGatewayMulticastDomainAssociationsPaginator is a paginator for 163// GetTransitGatewayMulticastDomainAssociations 164type GetTransitGatewayMulticastDomainAssociationsPaginator struct { 165 options GetTransitGatewayMulticastDomainAssociationsPaginatorOptions 166 client GetTransitGatewayMulticastDomainAssociationsAPIClient 167 params *GetTransitGatewayMulticastDomainAssociationsInput 168 nextToken *string 169 firstPage bool 170} 171 172// NewGetTransitGatewayMulticastDomainAssociationsPaginator returns a new 173// GetTransitGatewayMulticastDomainAssociationsPaginator 174func NewGetTransitGatewayMulticastDomainAssociationsPaginator(client GetTransitGatewayMulticastDomainAssociationsAPIClient, params *GetTransitGatewayMulticastDomainAssociationsInput, optFns ...func(*GetTransitGatewayMulticastDomainAssociationsPaginatorOptions)) *GetTransitGatewayMulticastDomainAssociationsPaginator { 175 options := GetTransitGatewayMulticastDomainAssociationsPaginatorOptions{} 176 if params.MaxResults != 0 { 177 options.Limit = params.MaxResults 178 } 179 180 for _, fn := range optFns { 181 fn(&options) 182 } 183 184 if params == nil { 185 params = &GetTransitGatewayMulticastDomainAssociationsInput{} 186 } 187 188 return &GetTransitGatewayMulticastDomainAssociationsPaginator{ 189 options: options, 190 client: client, 191 params: params, 192 firstPage: true, 193 } 194} 195 196// HasMorePages returns a boolean indicating whether more pages are available 197func (p *GetTransitGatewayMulticastDomainAssociationsPaginator) HasMorePages() bool { 198 return p.firstPage || p.nextToken != nil 199} 200 201// NextPage retrieves the next GetTransitGatewayMulticastDomainAssociations page. 202func (p *GetTransitGatewayMulticastDomainAssociationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetTransitGatewayMulticastDomainAssociationsOutput, error) { 203 if !p.HasMorePages() { 204 return nil, fmt.Errorf("no more pages available") 205 } 206 207 params := *p.params 208 params.NextToken = p.nextToken 209 210 params.MaxResults = p.options.Limit 211 212 result, err := p.client.GetTransitGatewayMulticastDomainAssociations(ctx, ¶ms, optFns...) 213 if err != nil { 214 return nil, err 215 } 216 p.firstPage = false 217 218 prevToken := p.nextToken 219 p.nextToken = result.NextToken 220 221 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 222 p.nextToken = nil 223 } 224 225 return result, nil 226} 227 228func newServiceMetadataMiddleware_opGetTransitGatewayMulticastDomainAssociations(region string) *awsmiddleware.RegisterServiceMetadata { 229 return &awsmiddleware.RegisterServiceMetadata{ 230 Region: region, 231 ServiceID: ServiceID, 232 SigningName: "ec2", 233 OperationName: "GetTransitGatewayMulticastDomainAssociations", 234 } 235} 236