1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package ec2
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/ec2/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Describes the specified Elastic IP addresses or all of your Elastic IP
15// addresses. An Elastic IP address is for use in either the EC2-Classic platform
16// or in a VPC. For more information, see Elastic IP Addresses
17// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html)
18// in the Amazon Elastic Compute Cloud User Guide.
19func (c *Client) DescribeAddresses(ctx context.Context, params *DescribeAddressesInput, optFns ...func(*Options)) (*DescribeAddressesOutput, error) {
20	if params == nil {
21		params = &DescribeAddressesInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "DescribeAddresses", params, optFns, addOperationDescribeAddressesMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*DescribeAddressesOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type DescribeAddressesInput struct {
35
36	// [EC2-VPC] Information about the allocation IDs.
37	AllocationIds []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. Filter names and values are case-sensitive.
46	//
47	// *
48	// allocation-id - [EC2-VPC] The allocation ID for the address.
49	//
50	// * association-id -
51	// [EC2-VPC] The association ID for the address.
52	//
53	// * domain - Indicates whether the
54	// address is for use in EC2-Classic (standard) or in a VPC (vpc).
55	//
56	// * instance-id -
57	// The ID of the instance the address is associated with, if any.
58	//
59	// *
60	// network-border-group - A unique set of Availability Zones, Local Zones, or
61	// Wavelength Zones from where AWS advertises IP addresses.
62	//
63	// * network-interface-id
64	// - [EC2-VPC] The ID of the network interface that the address is associated with,
65	// if any.
66	//
67	// * network-interface-owner-id - The AWS account ID of the owner.
68	//
69	// *
70	// private-ip-address - [EC2-VPC] The private IP address associated with the
71	// Elastic IP address.
72	//
73	// * public-ip - The Elastic IP address, or the carrier IP
74	// address.
75	//
76	// * tag: - The key/value combination of a tag assigned to the resource.
77	// Use the tag key in the filter name and the tag value as the filter value. For
78	// example, to find all resources that have a tag with the key Owner and the value
79	// TeamA, specify tag:Owner for the filter name and TeamA for the filter value.
80	//
81	// *
82	// tag-key - The key of a tag assigned to the resource. Use this filter to find all
83	// resources assigned a tag with a specific key, regardless of the tag value.
84	Filters []types.Filter
85
86	// One or more Elastic IP addresses. Default: Describes all your Elastic IP
87	// addresses.
88	PublicIps []string
89}
90
91type DescribeAddressesOutput struct {
92
93	// Information about the Elastic IP addresses.
94	Addresses []types.Address
95
96	// Metadata pertaining to the operation's result.
97	ResultMetadata middleware.Metadata
98}
99
100func addOperationDescribeAddressesMiddlewares(stack *middleware.Stack, options Options) (err error) {
101	err = stack.Serialize.Add(&awsEc2query_serializeOpDescribeAddresses{}, middleware.After)
102	if err != nil {
103		return err
104	}
105	err = stack.Deserialize.Add(&awsEc2query_deserializeOpDescribeAddresses{}, middleware.After)
106	if err != nil {
107		return err
108	}
109	if err = addSetLoggerMiddleware(stack, options); err != nil {
110		return err
111	}
112	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
116		return err
117	}
118	if err = addResolveEndpointMiddleware(stack, options); err != nil {
119		return err
120	}
121	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
122		return err
123	}
124	if err = addRetryMiddlewares(stack, options); err != nil {
125		return err
126	}
127	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
128		return err
129	}
130	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
131		return err
132	}
133	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
134		return err
135	}
136	if err = addClientUserAgent(stack); err != nil {
137		return err
138	}
139	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
140		return err
141	}
142	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
143		return err
144	}
145	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAddresses(options.Region), middleware.Before); err != nil {
146		return err
147	}
148	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
149		return err
150	}
151	if err = addResponseErrorMiddleware(stack); err != nil {
152		return err
153	}
154	if err = addRequestResponseLogging(stack, options); err != nil {
155		return err
156	}
157	return nil
158}
159
160func newServiceMetadataMiddleware_opDescribeAddresses(region string) *awsmiddleware.RegisterServiceMetadata {
161	return &awsmiddleware.RegisterServiceMetadata{
162		Region:        region,
163		ServiceID:     ServiceID,
164		SigningName:   "ec2",
165		OperationName: "DescribeAddresses",
166	}
167}
168