-
Notifications
You must be signed in to change notification settings - Fork 623
/
api_op_AllocateAddress.go
153 lines (127 loc) · 5.33 KB
/
api_op_AllocateAddress.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ec2
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)
type AllocateAddressInput struct {
_ struct{} `type:"structure"`
// [EC2-VPC] The Elastic IP address to recover or an IPv4 address from an address
// pool.
Address *string `type:"string"`
// Set to vpc to allocate the address for use with instances in a VPC.
//
// Default: The address is for use with instances in EC2-Classic.
Domain DomainType `type:"string" enum:"true"`
// Checks whether you have the required permissions for the action, without
// actually making the request, and provides an error response. If you have
// the required permissions, the error response is DryRunOperation. Otherwise,
// it is UnauthorizedOperation.
DryRun *bool `locationName:"dryRun" type:"boolean"`
// The ID of an address pool that you own. Use this parameter to let Amazon
// EC2 select an address from the address pool. To specify a specific address
// from the address pool, use the Address parameter instead.
PublicIpv4Pool *string `type:"string"`
}
// String returns the string representation
func (s AllocateAddressInput) String() string {
return awsutil.Prettify(s)
}
type AllocateAddressOutput struct {
_ struct{} `type:"structure"`
// [EC2-VPC] The ID that AWS assigns to represent the allocation of the Elastic
// IP address for use with instances in a VPC.
AllocationId *string `locationName:"allocationId" type:"string"`
// Indicates whether this Elastic IP address is for use with instances in EC2-Classic
// (standard) or instances in a VPC (vpc).
Domain DomainType `locationName:"domain" type:"string" enum:"true"`
// The Elastic IP address.
PublicIp *string `locationName:"publicIp" type:"string"`
// The ID of an address pool.
PublicIpv4Pool *string `locationName:"publicIpv4Pool" type:"string"`
}
// String returns the string representation
func (s AllocateAddressOutput) String() string {
return awsutil.Prettify(s)
}
const opAllocateAddress = "AllocateAddress"
// AllocateAddressRequest returns a request value for making API operation for
// Amazon Elastic Compute Cloud.
//
// Allocates an Elastic IP address to your AWS account. After you allocate the
// Elastic IP address you can associate it with an instance or network interface.
// After you release an Elastic IP address, it is released to the IP address
// pool and can be allocated to a different AWS account.
//
// You can allocate an Elastic IP address from an address pool owned by AWS
// or from an address pool created from a public IPv4 address range that you
// have brought to AWS for use with your AWS resources using bring your own
// IP addresses (BYOIP). For more information, see Bring Your Own IP Addresses
// (BYOIP) (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-byoip.html)
// in the Amazon Elastic Compute Cloud User Guide.
//
// [EC2-VPC] If you release an Elastic IP address, you might be able to recover
// it. You cannot recover an Elastic IP address that you released after it is
// allocated to another AWS account. You cannot recover an Elastic IP address
// for EC2-Classic. To attempt to recover an Elastic IP address that you released,
// specify it in this operation.
//
// An Elastic IP address is for use either in the EC2-Classic platform or in
// a VPC. By default, you can allocate 5 Elastic IP addresses for EC2-Classic
// per Region and 5 Elastic IP addresses for EC2-VPC per Region.
//
// For more information, see Elastic IP Addresses (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html)
// in the Amazon Elastic Compute Cloud User Guide.
//
// // Example sending a request using AllocateAddressRequest.
// req := client.AllocateAddressRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/AllocateAddress
func (c *Client) AllocateAddressRequest(input *AllocateAddressInput) AllocateAddressRequest {
op := &aws.Operation{
Name: opAllocateAddress,
HTTPMethod: "POST",
HTTPPath: "/",
}
if input == nil {
input = &AllocateAddressInput{}
}
req := c.newRequest(op, input, &AllocateAddressOutput{})
return AllocateAddressRequest{Request: req, Input: input, Copy: c.AllocateAddressRequest}
}
// AllocateAddressRequest is the request type for the
// AllocateAddress API operation.
type AllocateAddressRequest struct {
*aws.Request
Input *AllocateAddressInput
Copy func(*AllocateAddressInput) AllocateAddressRequest
}
// Send marshals and sends the AllocateAddress API request.
func (r AllocateAddressRequest) Send(ctx context.Context) (*AllocateAddressResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &AllocateAddressResponse{
AllocateAddressOutput: r.Request.Data.(*AllocateAddressOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// AllocateAddressResponse is the response type for the
// AllocateAddress API operation.
type AllocateAddressResponse struct {
*AllocateAddressOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// AllocateAddress request.
func (r *AllocateAddressResponse) SDKResponseMetdata() *aws.Response {
return r.response
}