-
Notifications
You must be signed in to change notification settings - Fork 82
/
public_ip.go
333 lines (283 loc) · 15.4 KB
/
public_ip.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
// Copyright (c) 2016, 2018, 2023, Oracle and/or its affiliates. All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.
// Core Services API
//
// Use the Core Services API to manage resources such as virtual cloud networks (VCNs),
// compute instances, and block storage volumes. For more information, see the console
// documentation for the Networking (https://docs.cloud.oracle.com/iaas/Content/Network/Concepts/overview.htm),
// Compute (https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm), and
// Block Volume (https://docs.cloud.oracle.com/iaas/Content/Block/Concepts/overview.htm) services.
// The required permissions are documented in the
// Details for the Core Services (https://docs.cloud.oracle.com/iaas/Content/Identity/Reference/corepolicyreference.htm) article.
//
package core
import (
"fmt"
"github.com/oracle/oci-go-sdk/v65/common"
"strings"
)
// PublicIp A *public IP* is a conceptual term that refers to a public IP address and related properties.
// The `publicIp` object is the API representation of a public IP.
// There are two types of public IPs:
// 1. Ephemeral
// 2. Reserved
// For more information and comparison of the two types,
// see Public IP Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingpublicIPs.htm).
type PublicIp struct {
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the entity the public IP is assigned to, or in the process of
// being assigned to.
AssignedEntityId *string `mandatory:"false" json:"assignedEntityId"`
// The type of entity the public IP is assigned to, or in the process of being
// assigned to.
AssignedEntityType PublicIpAssignedEntityTypeEnum `mandatory:"false" json:"assignedEntityType,omitempty"`
// The public IP's availability domain. This property is set only for ephemeral public IPs
// that are assigned to a private IP (that is, when the `scope` of the public IP is set to
// AVAILABILITY_DOMAIN). The value is the availability domain of the assigned private IP.
// Example: `Uocm:PHX-AD-1`
AvailabilityDomain *string `mandatory:"false" json:"availabilityDomain"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the public IP. For an ephemeral public IP, this is
// the compartment of its assigned entity (which can be a private IP or a regional entity such
// as a NAT gateway). For a reserved public IP that is currently assigned,
// its compartment can be different from the assigned private IP's.
CompartmentId *string `mandatory:"false" json:"compartmentId"`
// Defined tags for this resource. Each key is predefined and scoped to a
// namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
// Example: `{"Operations": {"CostCenter": "42"}}`
DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"`
// A user-friendly name. Does not have to be unique, and it's changeable.
// Avoid entering confidential information.
DisplayName *string `mandatory:"false" json:"displayName"`
// Free-form tags for this resource. Each tag is a simple key-value pair with no
// predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm).
// Example: `{"Department": "Finance"}`
FreeformTags map[string]string `mandatory:"false" json:"freeformTags"`
// The public IP's Oracle ID (OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm)).
Id *string `mandatory:"false" json:"id"`
// The public IP address of the `publicIp` object.
// Example: `203.0.113.2`
IpAddress *string `mandatory:"false" json:"ipAddress"`
// The public IP's current state.
LifecycleState PublicIpLifecycleStateEnum `mandatory:"false" json:"lifecycleState,omitempty"`
// Defines when the public IP is deleted and released back to Oracle's public IP pool.
// * `EPHEMERAL`: The lifetime is tied to the lifetime of its assigned entity. An ephemeral
// public IP must always be assigned to an entity. If the assigned entity is a private IP,
// the ephemeral public IP is automatically deleted when the private IP is deleted, when
// the VNIC is terminated, or when the instance is terminated. If the assigned entity is a
// NatGateway, the ephemeral public IP is automatically
// deleted when the NAT gateway is terminated.
// * `RESERVED`: You control the public IP's lifetime. You can delete a reserved public IP
// whenever you like. It does not need to be assigned to a private IP at all times.
// For more information and comparison of the two types,
// see Public IP Addresses (https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingpublicIPs.htm).
Lifetime PublicIpLifetimeEnum `mandatory:"false" json:"lifetime,omitempty"`
// Deprecated. Use `assignedEntityId` instead.
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the private IP that the public IP is currently assigned to, or in the
// process of being assigned to.
// **Note:** This is `null` if the public IP is not assigned to a private IP, or is
// in the process of being assigned to one.
PrivateIpId *string `mandatory:"false" json:"privateIpId"`
// Whether the public IP is regional or specific to a particular availability domain.
// * `REGION`: The public IP exists within a region and is assigned to a regional entity
// (such as a NatGateway), or can be assigned to a private
// IP in any availability domain in the region. Reserved public IPs and ephemeral public IPs
// assigned to a regional entity have `scope` = `REGION`.
// * `AVAILABILITY_DOMAIN`: The public IP exists within the availability domain of the entity
// it's assigned to, which is specified by the `availabilityDomain` property of the public IP object.
// Ephemeral public IPs that are assigned to private IPs have `scope` = `AVAILABILITY_DOMAIN`.
Scope PublicIpScopeEnum `mandatory:"false" json:"scope,omitempty"`
// The date and time the public IP was created, in the format defined by RFC3339 (https://tools.ietf.org/html/rfc3339).
// Example: `2016-08-25T21:10:29.600Z`
TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"`
// The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the pool object created in the current tenancy.
PublicIpPoolId *string `mandatory:"false" json:"publicIpPoolId"`
}
func (m PublicIp) String() string {
return common.PointerString(m)
}
// ValidateEnumValue returns an error when providing an unsupported enum value
// This function is being called during constructing API request process
// Not recommended for calling this function directly
func (m PublicIp) ValidateEnumValue() (bool, error) {
errMessage := []string{}
if _, ok := GetMappingPublicIpAssignedEntityTypeEnum(string(m.AssignedEntityType)); !ok && m.AssignedEntityType != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for AssignedEntityType: %s. Supported values are: %s.", m.AssignedEntityType, strings.Join(GetPublicIpAssignedEntityTypeEnumStringValues(), ",")))
}
if _, ok := GetMappingPublicIpLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetPublicIpLifecycleStateEnumStringValues(), ",")))
}
if _, ok := GetMappingPublicIpLifetimeEnum(string(m.Lifetime)); !ok && m.Lifetime != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Lifetime: %s. Supported values are: %s.", m.Lifetime, strings.Join(GetPublicIpLifetimeEnumStringValues(), ",")))
}
if _, ok := GetMappingPublicIpScopeEnum(string(m.Scope)); !ok && m.Scope != "" {
errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Scope: %s. Supported values are: %s.", m.Scope, strings.Join(GetPublicIpScopeEnumStringValues(), ",")))
}
if len(errMessage) > 0 {
return true, fmt.Errorf(strings.Join(errMessage, "\n"))
}
return false, nil
}
// PublicIpAssignedEntityTypeEnum Enum with underlying type: string
type PublicIpAssignedEntityTypeEnum string
// Set of constants representing the allowable values for PublicIpAssignedEntityTypeEnum
const (
PublicIpAssignedEntityTypePrivateIp PublicIpAssignedEntityTypeEnum = "PRIVATE_IP"
PublicIpAssignedEntityTypeNatGateway PublicIpAssignedEntityTypeEnum = "NAT_GATEWAY"
)
var mappingPublicIpAssignedEntityTypeEnum = map[string]PublicIpAssignedEntityTypeEnum{
"PRIVATE_IP": PublicIpAssignedEntityTypePrivateIp,
"NAT_GATEWAY": PublicIpAssignedEntityTypeNatGateway,
}
var mappingPublicIpAssignedEntityTypeEnumLowerCase = map[string]PublicIpAssignedEntityTypeEnum{
"private_ip": PublicIpAssignedEntityTypePrivateIp,
"nat_gateway": PublicIpAssignedEntityTypeNatGateway,
}
// GetPublicIpAssignedEntityTypeEnumValues Enumerates the set of values for PublicIpAssignedEntityTypeEnum
func GetPublicIpAssignedEntityTypeEnumValues() []PublicIpAssignedEntityTypeEnum {
values := make([]PublicIpAssignedEntityTypeEnum, 0)
for _, v := range mappingPublicIpAssignedEntityTypeEnum {
values = append(values, v)
}
return values
}
// GetPublicIpAssignedEntityTypeEnumStringValues Enumerates the set of values in String for PublicIpAssignedEntityTypeEnum
func GetPublicIpAssignedEntityTypeEnumStringValues() []string {
return []string{
"PRIVATE_IP",
"NAT_GATEWAY",
}
}
// GetMappingPublicIpAssignedEntityTypeEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingPublicIpAssignedEntityTypeEnum(val string) (PublicIpAssignedEntityTypeEnum, bool) {
enum, ok := mappingPublicIpAssignedEntityTypeEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// PublicIpLifecycleStateEnum Enum with underlying type: string
type PublicIpLifecycleStateEnum string
// Set of constants representing the allowable values for PublicIpLifecycleStateEnum
const (
PublicIpLifecycleStateProvisioning PublicIpLifecycleStateEnum = "PROVISIONING"
PublicIpLifecycleStateAvailable PublicIpLifecycleStateEnum = "AVAILABLE"
PublicIpLifecycleStateAssigning PublicIpLifecycleStateEnum = "ASSIGNING"
PublicIpLifecycleStateAssigned PublicIpLifecycleStateEnum = "ASSIGNED"
PublicIpLifecycleStateUnassigning PublicIpLifecycleStateEnum = "UNASSIGNING"
PublicIpLifecycleStateUnassigned PublicIpLifecycleStateEnum = "UNASSIGNED"
PublicIpLifecycleStateTerminating PublicIpLifecycleStateEnum = "TERMINATING"
PublicIpLifecycleStateTerminated PublicIpLifecycleStateEnum = "TERMINATED"
)
var mappingPublicIpLifecycleStateEnum = map[string]PublicIpLifecycleStateEnum{
"PROVISIONING": PublicIpLifecycleStateProvisioning,
"AVAILABLE": PublicIpLifecycleStateAvailable,
"ASSIGNING": PublicIpLifecycleStateAssigning,
"ASSIGNED": PublicIpLifecycleStateAssigned,
"UNASSIGNING": PublicIpLifecycleStateUnassigning,
"UNASSIGNED": PublicIpLifecycleStateUnassigned,
"TERMINATING": PublicIpLifecycleStateTerminating,
"TERMINATED": PublicIpLifecycleStateTerminated,
}
var mappingPublicIpLifecycleStateEnumLowerCase = map[string]PublicIpLifecycleStateEnum{
"provisioning": PublicIpLifecycleStateProvisioning,
"available": PublicIpLifecycleStateAvailable,
"assigning": PublicIpLifecycleStateAssigning,
"assigned": PublicIpLifecycleStateAssigned,
"unassigning": PublicIpLifecycleStateUnassigning,
"unassigned": PublicIpLifecycleStateUnassigned,
"terminating": PublicIpLifecycleStateTerminating,
"terminated": PublicIpLifecycleStateTerminated,
}
// GetPublicIpLifecycleStateEnumValues Enumerates the set of values for PublicIpLifecycleStateEnum
func GetPublicIpLifecycleStateEnumValues() []PublicIpLifecycleStateEnum {
values := make([]PublicIpLifecycleStateEnum, 0)
for _, v := range mappingPublicIpLifecycleStateEnum {
values = append(values, v)
}
return values
}
// GetPublicIpLifecycleStateEnumStringValues Enumerates the set of values in String for PublicIpLifecycleStateEnum
func GetPublicIpLifecycleStateEnumStringValues() []string {
return []string{
"PROVISIONING",
"AVAILABLE",
"ASSIGNING",
"ASSIGNED",
"UNASSIGNING",
"UNASSIGNED",
"TERMINATING",
"TERMINATED",
}
}
// GetMappingPublicIpLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingPublicIpLifecycleStateEnum(val string) (PublicIpLifecycleStateEnum, bool) {
enum, ok := mappingPublicIpLifecycleStateEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// PublicIpLifetimeEnum Enum with underlying type: string
type PublicIpLifetimeEnum string
// Set of constants representing the allowable values for PublicIpLifetimeEnum
const (
PublicIpLifetimeEphemeral PublicIpLifetimeEnum = "EPHEMERAL"
PublicIpLifetimeReserved PublicIpLifetimeEnum = "RESERVED"
)
var mappingPublicIpLifetimeEnum = map[string]PublicIpLifetimeEnum{
"EPHEMERAL": PublicIpLifetimeEphemeral,
"RESERVED": PublicIpLifetimeReserved,
}
var mappingPublicIpLifetimeEnumLowerCase = map[string]PublicIpLifetimeEnum{
"ephemeral": PublicIpLifetimeEphemeral,
"reserved": PublicIpLifetimeReserved,
}
// GetPublicIpLifetimeEnumValues Enumerates the set of values for PublicIpLifetimeEnum
func GetPublicIpLifetimeEnumValues() []PublicIpLifetimeEnum {
values := make([]PublicIpLifetimeEnum, 0)
for _, v := range mappingPublicIpLifetimeEnum {
values = append(values, v)
}
return values
}
// GetPublicIpLifetimeEnumStringValues Enumerates the set of values in String for PublicIpLifetimeEnum
func GetPublicIpLifetimeEnumStringValues() []string {
return []string{
"EPHEMERAL",
"RESERVED",
}
}
// GetMappingPublicIpLifetimeEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingPublicIpLifetimeEnum(val string) (PublicIpLifetimeEnum, bool) {
enum, ok := mappingPublicIpLifetimeEnumLowerCase[strings.ToLower(val)]
return enum, ok
}
// PublicIpScopeEnum Enum with underlying type: string
type PublicIpScopeEnum string
// Set of constants representing the allowable values for PublicIpScopeEnum
const (
PublicIpScopeRegion PublicIpScopeEnum = "REGION"
PublicIpScopeAvailabilityDomain PublicIpScopeEnum = "AVAILABILITY_DOMAIN"
)
var mappingPublicIpScopeEnum = map[string]PublicIpScopeEnum{
"REGION": PublicIpScopeRegion,
"AVAILABILITY_DOMAIN": PublicIpScopeAvailabilityDomain,
}
var mappingPublicIpScopeEnumLowerCase = map[string]PublicIpScopeEnum{
"region": PublicIpScopeRegion,
"availability_domain": PublicIpScopeAvailabilityDomain,
}
// GetPublicIpScopeEnumValues Enumerates the set of values for PublicIpScopeEnum
func GetPublicIpScopeEnumValues() []PublicIpScopeEnum {
values := make([]PublicIpScopeEnum, 0)
for _, v := range mappingPublicIpScopeEnum {
values = append(values, v)
}
return values
}
// GetPublicIpScopeEnumStringValues Enumerates the set of values in String for PublicIpScopeEnum
func GetPublicIpScopeEnumStringValues() []string {
return []string{
"REGION",
"AVAILABILITY_DOMAIN",
}
}
// GetMappingPublicIpScopeEnum performs case Insensitive comparison on enum value and return the desired enum
func GetMappingPublicIpScopeEnum(val string) (PublicIpScopeEnum, bool) {
enum, ok := mappingPublicIpScopeEnumLowerCase[strings.ToLower(val)]
return enum, ok
}