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 prefix list references in a specified transit gateway 16// route table. 17func (c *Client) GetTransitGatewayPrefixListReferences(ctx context.Context, params *GetTransitGatewayPrefixListReferencesInput, optFns ...func(*Options)) (*GetTransitGatewayPrefixListReferencesOutput, error) { 18 if params == nil { 19 params = &GetTransitGatewayPrefixListReferencesInput{} 20 } 21 22 result, metadata, err := c.invokeOperation(ctx, "GetTransitGatewayPrefixListReferences", params, optFns, addOperationGetTransitGatewayPrefixListReferencesMiddlewares) 23 if err != nil { 24 return nil, err 25 } 26 27 out := result.(*GetTransitGatewayPrefixListReferencesOutput) 28 out.ResultMetadata = metadata 29 return out, nil 30} 31 32type GetTransitGatewayPrefixListReferencesInput struct { 33 34 // The ID of the transit gateway route table. 35 // 36 // This member is required. 37 TransitGatewayRouteTableId *string 38 39 // Checks whether you have the required permissions for the action, without 40 // actually making the request, and provides an error response. If you have the 41 // required permissions, the error response is DryRunOperation. Otherwise, it is 42 // UnauthorizedOperation. 43 DryRun bool 44 45 // One or more filters. The possible values are: 46 // 47 // * attachment.resource-id - The ID 48 // of the resource for the attachment. 49 // 50 // * attachment.resource-type - The type of 51 // resource for the attachment. Valid values are vpc | vpn | direct-connect-gateway 52 // | peering. 53 // 54 // * attachment.transit-gateway-attachment-id - The ID of the 55 // attachment. 56 // 57 // * is-blackhole - Whether traffic matching the route is blocked 58 // (true | false). 59 // 60 // * prefix-list-id - The ID of the prefix list. 61 // 62 // * 63 // prefix-list-owner-id - The ID of the owner of the prefix list. 64 // 65 // * state - The 66 // state of the prefix list reference (pending | available | modifying | deleting). 67 Filters []types.Filter 68 69 // The maximum number of results to return with a single call. To retrieve the 70 // remaining results, make another call with the returned nextToken value. 71 MaxResults int32 72 73 // The token for the next page of results. 74 NextToken *string 75} 76 77type GetTransitGatewayPrefixListReferencesOutput struct { 78 79 // The token to use to retrieve the next page of results. This value is null when 80 // there are no more results to return. 81 NextToken *string 82 83 // Information about the prefix list references. 84 TransitGatewayPrefixListReferences []types.TransitGatewayPrefixListReference 85 86 // Metadata pertaining to the operation's result. 87 ResultMetadata middleware.Metadata 88} 89 90func addOperationGetTransitGatewayPrefixListReferencesMiddlewares(stack *middleware.Stack, options Options) (err error) { 91 err = stack.Serialize.Add(&awsEc2query_serializeOpGetTransitGatewayPrefixListReferences{}, middleware.After) 92 if err != nil { 93 return err 94 } 95 err = stack.Deserialize.Add(&awsEc2query_deserializeOpGetTransitGatewayPrefixListReferences{}, middleware.After) 96 if err != nil { 97 return err 98 } 99 if err = addSetLoggerMiddleware(stack, options); err != nil { 100 return err 101 } 102 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 103 return err 104 } 105 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 106 return err 107 } 108 if err = addResolveEndpointMiddleware(stack, options); err != nil { 109 return err 110 } 111 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 112 return err 113 } 114 if err = addRetryMiddlewares(stack, options); err != nil { 115 return err 116 } 117 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 118 return err 119 } 120 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 121 return err 122 } 123 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 124 return err 125 } 126 if err = addClientUserAgent(stack); err != nil { 127 return err 128 } 129 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 130 return err 131 } 132 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 133 return err 134 } 135 if err = addOpGetTransitGatewayPrefixListReferencesValidationMiddleware(stack); err != nil { 136 return err 137 } 138 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTransitGatewayPrefixListReferences(options.Region), middleware.Before); err != nil { 139 return err 140 } 141 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 142 return err 143 } 144 if err = addResponseErrorMiddleware(stack); err != nil { 145 return err 146 } 147 if err = addRequestResponseLogging(stack, options); err != nil { 148 return err 149 } 150 return nil 151} 152 153// GetTransitGatewayPrefixListReferencesAPIClient is a client that implements the 154// GetTransitGatewayPrefixListReferences operation. 155type GetTransitGatewayPrefixListReferencesAPIClient interface { 156 GetTransitGatewayPrefixListReferences(context.Context, *GetTransitGatewayPrefixListReferencesInput, ...func(*Options)) (*GetTransitGatewayPrefixListReferencesOutput, error) 157} 158 159var _ GetTransitGatewayPrefixListReferencesAPIClient = (*Client)(nil) 160 161// GetTransitGatewayPrefixListReferencesPaginatorOptions is the paginator options 162// for GetTransitGatewayPrefixListReferences 163type GetTransitGatewayPrefixListReferencesPaginatorOptions struct { 164 // The maximum number of results to return with a single call. To retrieve the 165 // remaining results, make another call with the returned nextToken value. 166 Limit int32 167 168 // Set to true if pagination should stop if the service returns a pagination token 169 // that matches the most recent token provided to the service. 170 StopOnDuplicateToken bool 171} 172 173// GetTransitGatewayPrefixListReferencesPaginator is a paginator for 174// GetTransitGatewayPrefixListReferences 175type GetTransitGatewayPrefixListReferencesPaginator struct { 176 options GetTransitGatewayPrefixListReferencesPaginatorOptions 177 client GetTransitGatewayPrefixListReferencesAPIClient 178 params *GetTransitGatewayPrefixListReferencesInput 179 nextToken *string 180 firstPage bool 181} 182 183// NewGetTransitGatewayPrefixListReferencesPaginator returns a new 184// GetTransitGatewayPrefixListReferencesPaginator 185func NewGetTransitGatewayPrefixListReferencesPaginator(client GetTransitGatewayPrefixListReferencesAPIClient, params *GetTransitGatewayPrefixListReferencesInput, optFns ...func(*GetTransitGatewayPrefixListReferencesPaginatorOptions)) *GetTransitGatewayPrefixListReferencesPaginator { 186 options := GetTransitGatewayPrefixListReferencesPaginatorOptions{} 187 if params.MaxResults != 0 { 188 options.Limit = params.MaxResults 189 } 190 191 for _, fn := range optFns { 192 fn(&options) 193 } 194 195 if params == nil { 196 params = &GetTransitGatewayPrefixListReferencesInput{} 197 } 198 199 return &GetTransitGatewayPrefixListReferencesPaginator{ 200 options: options, 201 client: client, 202 params: params, 203 firstPage: true, 204 } 205} 206 207// HasMorePages returns a boolean indicating whether more pages are available 208func (p *GetTransitGatewayPrefixListReferencesPaginator) HasMorePages() bool { 209 return p.firstPage || p.nextToken != nil 210} 211 212// NextPage retrieves the next GetTransitGatewayPrefixListReferences page. 213func (p *GetTransitGatewayPrefixListReferencesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetTransitGatewayPrefixListReferencesOutput, error) { 214 if !p.HasMorePages() { 215 return nil, fmt.Errorf("no more pages available") 216 } 217 218 params := *p.params 219 params.NextToken = p.nextToken 220 221 params.MaxResults = p.options.Limit 222 223 result, err := p.client.GetTransitGatewayPrefixListReferences(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_opGetTransitGatewayPrefixListReferences(region string) *awsmiddleware.RegisterServiceMetadata { 240 return &awsmiddleware.RegisterServiceMetadata{ 241 Region: region, 242 ServiceID: ServiceID, 243 SigningName: "ec2", 244 OperationName: "GetTransitGatewayPrefixListReferences", 245 } 246} 247