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// Searches one or more transit gateway multicast groups and returns the group 16// membership information. 17func (c *Client) SearchTransitGatewayMulticastGroups(ctx context.Context, params *SearchTransitGatewayMulticastGroupsInput, optFns ...func(*Options)) (*SearchTransitGatewayMulticastGroupsOutput, error) { 18 if params == nil { 19 params = &SearchTransitGatewayMulticastGroupsInput{} 20 } 21 22 result, metadata, err := c.invokeOperation(ctx, "SearchTransitGatewayMulticastGroups", params, optFns, addOperationSearchTransitGatewayMulticastGroupsMiddlewares) 23 if err != nil { 24 return nil, err 25 } 26 27 out := result.(*SearchTransitGatewayMulticastGroupsOutput) 28 out.ResultMetadata = metadata 29 return out, nil 30} 31 32type SearchTransitGatewayMulticastGroupsInput 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 // * group-ip-address - The IP 43 // address of the transit gateway multicast group. 44 // 45 // * is-group-member - The 46 // resource is a group member. Valid values are true | false. 47 // 48 // * is-group-source - 49 // The resource is a group source. Valid values are true | false. 50 // 51 // * member-type - 52 // The member type. Valid values are igmp | static. 53 // 54 // * resource-id - The ID of the 55 // resource. 56 // 57 // * resource-type - The type of resource. Valid values are vpc | vpn | 58 // direct-connect-gateway | tgw-peering. 59 // 60 // * source-type - The source type. Valid 61 // values are igmp | static. 62 // 63 // * state - The state of the subnet association. Valid 64 // values are associated | associated | disassociated | disassociating. 65 // 66 // * 67 // subnet-id - The ID of the subnet. 68 // 69 // * transit-gateway-attachment-id - The id of 70 // the transit gateway attachment. 71 Filters []types.Filter 72 73 // The maximum number of results to return with a single call. To retrieve the 74 // remaining results, make another call with the returned nextToken value. 75 MaxResults int32 76 77 // The token for the next page of results. 78 NextToken *string 79 80 // The ID of the transit gateway multicast domain. 81 TransitGatewayMulticastDomainId *string 82} 83 84type SearchTransitGatewayMulticastGroupsOutput struct { 85 86 // Information about the transit gateway multicast group. 87 MulticastGroups []types.TransitGatewayMulticastGroup 88 89 // The token to use to retrieve the next page of results. This value is null when 90 // there are no more results to return. 91 NextToken *string 92 93 // Metadata pertaining to the operation's result. 94 ResultMetadata middleware.Metadata 95} 96 97func addOperationSearchTransitGatewayMulticastGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) { 98 err = stack.Serialize.Add(&awsEc2query_serializeOpSearchTransitGatewayMulticastGroups{}, middleware.After) 99 if err != nil { 100 return err 101 } 102 err = stack.Deserialize.Add(&awsEc2query_deserializeOpSearchTransitGatewayMulticastGroups{}, middleware.After) 103 if err != nil { 104 return err 105 } 106 if err = addSetLoggerMiddleware(stack, options); err != nil { 107 return err 108 } 109 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 110 return err 111 } 112 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addResolveEndpointMiddleware(stack, options); err != nil { 116 return err 117 } 118 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 119 return err 120 } 121 if err = addRetryMiddlewares(stack, options); err != nil { 122 return err 123 } 124 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 125 return err 126 } 127 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 128 return err 129 } 130 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 131 return err 132 } 133 if err = addClientUserAgent(stack); err != nil { 134 return err 135 } 136 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 137 return err 138 } 139 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 140 return err 141 } 142 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchTransitGatewayMulticastGroups(options.Region), middleware.Before); err != nil { 143 return err 144 } 145 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 146 return err 147 } 148 if err = addResponseErrorMiddleware(stack); err != nil { 149 return err 150 } 151 if err = addRequestResponseLogging(stack, options); err != nil { 152 return err 153 } 154 return nil 155} 156 157// SearchTransitGatewayMulticastGroupsAPIClient is a client that implements the 158// SearchTransitGatewayMulticastGroups operation. 159type SearchTransitGatewayMulticastGroupsAPIClient interface { 160 SearchTransitGatewayMulticastGroups(context.Context, *SearchTransitGatewayMulticastGroupsInput, ...func(*Options)) (*SearchTransitGatewayMulticastGroupsOutput, error) 161} 162 163var _ SearchTransitGatewayMulticastGroupsAPIClient = (*Client)(nil) 164 165// SearchTransitGatewayMulticastGroupsPaginatorOptions is the paginator options for 166// SearchTransitGatewayMulticastGroups 167type SearchTransitGatewayMulticastGroupsPaginatorOptions struct { 168 // The maximum number of results to return with a single call. To retrieve the 169 // remaining results, make another call with the returned nextToken value. 170 Limit int32 171 172 // Set to true if pagination should stop if the service returns a pagination token 173 // that matches the most recent token provided to the service. 174 StopOnDuplicateToken bool 175} 176 177// SearchTransitGatewayMulticastGroupsPaginator is a paginator for 178// SearchTransitGatewayMulticastGroups 179type SearchTransitGatewayMulticastGroupsPaginator struct { 180 options SearchTransitGatewayMulticastGroupsPaginatorOptions 181 client SearchTransitGatewayMulticastGroupsAPIClient 182 params *SearchTransitGatewayMulticastGroupsInput 183 nextToken *string 184 firstPage bool 185} 186 187// NewSearchTransitGatewayMulticastGroupsPaginator returns a new 188// SearchTransitGatewayMulticastGroupsPaginator 189func NewSearchTransitGatewayMulticastGroupsPaginator(client SearchTransitGatewayMulticastGroupsAPIClient, params *SearchTransitGatewayMulticastGroupsInput, optFns ...func(*SearchTransitGatewayMulticastGroupsPaginatorOptions)) *SearchTransitGatewayMulticastGroupsPaginator { 190 options := SearchTransitGatewayMulticastGroupsPaginatorOptions{} 191 if params.MaxResults != 0 { 192 options.Limit = params.MaxResults 193 } 194 195 for _, fn := range optFns { 196 fn(&options) 197 } 198 199 if params == nil { 200 params = &SearchTransitGatewayMulticastGroupsInput{} 201 } 202 203 return &SearchTransitGatewayMulticastGroupsPaginator{ 204 options: options, 205 client: client, 206 params: params, 207 firstPage: true, 208 } 209} 210 211// HasMorePages returns a boolean indicating whether more pages are available 212func (p *SearchTransitGatewayMulticastGroupsPaginator) HasMorePages() bool { 213 return p.firstPage || p.nextToken != nil 214} 215 216// NextPage retrieves the next SearchTransitGatewayMulticastGroups page. 217func (p *SearchTransitGatewayMulticastGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*SearchTransitGatewayMulticastGroupsOutput, error) { 218 if !p.HasMorePages() { 219 return nil, fmt.Errorf("no more pages available") 220 } 221 222 params := *p.params 223 params.NextToken = p.nextToken 224 225 params.MaxResults = p.options.Limit 226 227 result, err := p.client.SearchTransitGatewayMulticastGroups(ctx, ¶ms, optFns...) 228 if err != nil { 229 return nil, err 230 } 231 p.firstPage = false 232 233 prevToken := p.nextToken 234 p.nextToken = result.NextToken 235 236 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 237 p.nextToken = nil 238 } 239 240 return result, nil 241} 242 243func newServiceMetadataMiddleware_opSearchTransitGatewayMulticastGroups(region string) *awsmiddleware.RegisterServiceMetadata { 244 return &awsmiddleware.RegisterServiceMetadata{ 245 Region: region, 246 ServiceID: ServiceID, 247 SigningName: "ec2", 248 OperationName: "SearchTransitGatewayMulticastGroups", 249 } 250} 251