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// Describes the ClassicLink DNS support status of one or more VPCs. If enabled, 16// the DNS hostname of a linked EC2-Classic instance resolves to its private IP 17// address when addressed from an instance in the VPC to which it's linked. 18// Similarly, the DNS hostname of an instance in a VPC resolves to its private IP 19// address when addressed from a linked EC2-Classic instance. For more information, 20// see ClassicLink 21// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html) in 22// the Amazon Elastic Compute Cloud User Guide. 23func (c *Client) DescribeVpcClassicLinkDnsSupport(ctx context.Context, params *DescribeVpcClassicLinkDnsSupportInput, optFns ...func(*Options)) (*DescribeVpcClassicLinkDnsSupportOutput, error) { 24 if params == nil { 25 params = &DescribeVpcClassicLinkDnsSupportInput{} 26 } 27 28 result, metadata, err := c.invokeOperation(ctx, "DescribeVpcClassicLinkDnsSupport", params, optFns, addOperationDescribeVpcClassicLinkDnsSupportMiddlewares) 29 if err != nil { 30 return nil, err 31 } 32 33 out := result.(*DescribeVpcClassicLinkDnsSupportOutput) 34 out.ResultMetadata = metadata 35 return out, nil 36} 37 38type DescribeVpcClassicLinkDnsSupportInput struct { 39 40 // The maximum number of results to return with a single call. To retrieve the 41 // remaining results, make another call with the returned nextToken value. 42 MaxResults int32 43 44 // The token for the next page of results. 45 NextToken *string 46 47 // One or more VPC IDs. 48 VpcIds []string 49} 50 51type DescribeVpcClassicLinkDnsSupportOutput struct { 52 53 // The token to use to retrieve the next page of results. This value is null when 54 // there are no more results to return. 55 NextToken *string 56 57 // Information about the ClassicLink DNS support status of the VPCs. 58 Vpcs []types.ClassicLinkDnsSupport 59 60 // Metadata pertaining to the operation's result. 61 ResultMetadata middleware.Metadata 62} 63 64func addOperationDescribeVpcClassicLinkDnsSupportMiddlewares(stack *middleware.Stack, options Options) (err error) { 65 err = stack.Serialize.Add(&awsEc2query_serializeOpDescribeVpcClassicLinkDnsSupport{}, middleware.After) 66 if err != nil { 67 return err 68 } 69 err = stack.Deserialize.Add(&awsEc2query_deserializeOpDescribeVpcClassicLinkDnsSupport{}, middleware.After) 70 if err != nil { 71 return err 72 } 73 if err = addSetLoggerMiddleware(stack, options); err != nil { 74 return err 75 } 76 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 77 return err 78 } 79 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 80 return err 81 } 82 if err = addResolveEndpointMiddleware(stack, options); err != nil { 83 return err 84 } 85 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 86 return err 87 } 88 if err = addRetryMiddlewares(stack, options); err != nil { 89 return err 90 } 91 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 92 return err 93 } 94 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 95 return err 96 } 97 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 98 return err 99 } 100 if err = addClientUserAgent(stack); err != nil { 101 return err 102 } 103 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 104 return err 105 } 106 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 107 return err 108 } 109 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeVpcClassicLinkDnsSupport(options.Region), middleware.Before); err != nil { 110 return err 111 } 112 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 113 return err 114 } 115 if err = addResponseErrorMiddleware(stack); err != nil { 116 return err 117 } 118 if err = addRequestResponseLogging(stack, options); err != nil { 119 return err 120 } 121 return nil 122} 123 124// DescribeVpcClassicLinkDnsSupportAPIClient is a client that implements the 125// DescribeVpcClassicLinkDnsSupport operation. 126type DescribeVpcClassicLinkDnsSupportAPIClient interface { 127 DescribeVpcClassicLinkDnsSupport(context.Context, *DescribeVpcClassicLinkDnsSupportInput, ...func(*Options)) (*DescribeVpcClassicLinkDnsSupportOutput, error) 128} 129 130var _ DescribeVpcClassicLinkDnsSupportAPIClient = (*Client)(nil) 131 132// DescribeVpcClassicLinkDnsSupportPaginatorOptions is the paginator options for 133// DescribeVpcClassicLinkDnsSupport 134type DescribeVpcClassicLinkDnsSupportPaginatorOptions struct { 135 // The maximum number of results to return with a single call. To retrieve the 136 // remaining results, make another call with the returned nextToken value. 137 Limit int32 138 139 // Set to true if pagination should stop if the service returns a pagination token 140 // that matches the most recent token provided to the service. 141 StopOnDuplicateToken bool 142} 143 144// DescribeVpcClassicLinkDnsSupportPaginator is a paginator for 145// DescribeVpcClassicLinkDnsSupport 146type DescribeVpcClassicLinkDnsSupportPaginator struct { 147 options DescribeVpcClassicLinkDnsSupportPaginatorOptions 148 client DescribeVpcClassicLinkDnsSupportAPIClient 149 params *DescribeVpcClassicLinkDnsSupportInput 150 nextToken *string 151 firstPage bool 152} 153 154// NewDescribeVpcClassicLinkDnsSupportPaginator returns a new 155// DescribeVpcClassicLinkDnsSupportPaginator 156func NewDescribeVpcClassicLinkDnsSupportPaginator(client DescribeVpcClassicLinkDnsSupportAPIClient, params *DescribeVpcClassicLinkDnsSupportInput, optFns ...func(*DescribeVpcClassicLinkDnsSupportPaginatorOptions)) *DescribeVpcClassicLinkDnsSupportPaginator { 157 options := DescribeVpcClassicLinkDnsSupportPaginatorOptions{} 158 if params.MaxResults != 0 { 159 options.Limit = params.MaxResults 160 } 161 162 for _, fn := range optFns { 163 fn(&options) 164 } 165 166 if params == nil { 167 params = &DescribeVpcClassicLinkDnsSupportInput{} 168 } 169 170 return &DescribeVpcClassicLinkDnsSupportPaginator{ 171 options: options, 172 client: client, 173 params: params, 174 firstPage: true, 175 } 176} 177 178// HasMorePages returns a boolean indicating whether more pages are available 179func (p *DescribeVpcClassicLinkDnsSupportPaginator) HasMorePages() bool { 180 return p.firstPage || p.nextToken != nil 181} 182 183// NextPage retrieves the next DescribeVpcClassicLinkDnsSupport page. 184func (p *DescribeVpcClassicLinkDnsSupportPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeVpcClassicLinkDnsSupportOutput, error) { 185 if !p.HasMorePages() { 186 return nil, fmt.Errorf("no more pages available") 187 } 188 189 params := *p.params 190 params.NextToken = p.nextToken 191 192 params.MaxResults = p.options.Limit 193 194 result, err := p.client.DescribeVpcClassicLinkDnsSupport(ctx, ¶ms, optFns...) 195 if err != nil { 196 return nil, err 197 } 198 p.firstPage = false 199 200 prevToken := p.nextToken 201 p.nextToken = result.NextToken 202 203 if p.options.StopOnDuplicateToken && prevToken != nil && p.nextToken != nil && *prevToken == *p.nextToken { 204 p.nextToken = nil 205 } 206 207 return result, nil 208} 209 210func newServiceMetadataMiddleware_opDescribeVpcClassicLinkDnsSupport(region string) *awsmiddleware.RegisterServiceMetadata { 211 return &awsmiddleware.RegisterServiceMetadata{ 212 Region: region, 213 ServiceID: ServiceID, 214 SigningName: "ec2", 215 OperationName: "DescribeVpcClassicLinkDnsSupport", 216 } 217} 218