This repository has been archived by the owner on Dec 24, 2020. It is now read-only.
/
ipAttachment.go
153 lines (140 loc) · 5.81 KB
/
ipAttachment.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package packet
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides a resource to attach elastic IP subnets to devices.
//
// To attach an IP subnet from a reserved block to a provisioned device, you must derive a subnet CIDR belonging to
// one of your reserved blocks in the same project and facility as the target device.
//
// For example, you have reserved IPv4 address block 147.229.10.152/30, you can choose to assign either the whole
// block as one subnet to a device; or 2 subnets with CIDRs 147.229.10.152/31' and 147.229.10.154/31; or 4 subnets
// with mask prefix length 32. More about the elastic IP subnets is [here](https://www.packet.com/developers/docs/network/basic/elastic-ips/).
//
// Device and reserved block must be in the same facility.
type IpAttachment struct {
pulumi.CustomResourceState
Address pulumi.StringOutput `pulumi:"address"`
// Address family as integer (4 or 6)
AddressFamily pulumi.IntOutput `pulumi:"addressFamily"`
// length of CIDR prefix of the subnet as integer
Cidr pulumi.IntOutput `pulumi:"cidr"`
// CIDR notation of subnet from block reserved in the same
// project and facility as the device
CidrNotation pulumi.StringOutput `pulumi:"cidrNotation"`
// ID of device to which to assign the subnet
DeviceId pulumi.StringOutput `pulumi:"deviceId"`
// IP address of gateway for the subnet
Gateway pulumi.StringOutput `pulumi:"gateway"`
Global pulumi.BoolOutput `pulumi:"global"`
Manageable pulumi.BoolOutput `pulumi:"manageable"`
Management pulumi.BoolOutput `pulumi:"management"`
// Subnet mask in decimal notation, e.g. "255.255.255.0"
Netmask pulumi.StringOutput `pulumi:"netmask"`
// Subnet network address
Network pulumi.StringOutput `pulumi:"network"`
// boolean flag whether subnet is reachable from the Internet
Public pulumi.BoolOutput `pulumi:"public"`
}
// NewIpAttachment registers a new resource with the given unique name, arguments, and options.
func NewIpAttachment(ctx *pulumi.Context,
name string, args *IpAttachmentArgs, opts ...pulumi.ResourceOption) (*IpAttachment, error) {
if args == nil || args.CidrNotation == nil {
return nil, errors.New("missing required argument 'CidrNotation'")
}
if args == nil || args.DeviceId == nil {
return nil, errors.New("missing required argument 'DeviceId'")
}
if args == nil {
args = &IpAttachmentArgs{}
}
var resource IpAttachment
err := ctx.RegisterResource("packet:index/ipAttachment:IpAttachment", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIpAttachment gets an existing IpAttachment resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetIpAttachment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IpAttachmentState, opts ...pulumi.ResourceOption) (*IpAttachment, error) {
var resource IpAttachment
err := ctx.ReadResource("packet:index/ipAttachment:IpAttachment", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IpAttachment resources.
type ipAttachmentState struct {
Address *string `pulumi:"address"`
// Address family as integer (4 or 6)
AddressFamily *int `pulumi:"addressFamily"`
// length of CIDR prefix of the subnet as integer
Cidr *int `pulumi:"cidr"`
// CIDR notation of subnet from block reserved in the same
// project and facility as the device
CidrNotation *string `pulumi:"cidrNotation"`
// ID of device to which to assign the subnet
DeviceId *string `pulumi:"deviceId"`
// IP address of gateway for the subnet
Gateway *string `pulumi:"gateway"`
Global *bool `pulumi:"global"`
Manageable *bool `pulumi:"manageable"`
Management *bool `pulumi:"management"`
// Subnet mask in decimal notation, e.g. "255.255.255.0"
Netmask *string `pulumi:"netmask"`
// Subnet network address
Network *string `pulumi:"network"`
// boolean flag whether subnet is reachable from the Internet
Public *bool `pulumi:"public"`
}
type IpAttachmentState struct {
Address pulumi.StringPtrInput
// Address family as integer (4 or 6)
AddressFamily pulumi.IntPtrInput
// length of CIDR prefix of the subnet as integer
Cidr pulumi.IntPtrInput
// CIDR notation of subnet from block reserved in the same
// project and facility as the device
CidrNotation pulumi.StringPtrInput
// ID of device to which to assign the subnet
DeviceId pulumi.StringPtrInput
// IP address of gateway for the subnet
Gateway pulumi.StringPtrInput
Global pulumi.BoolPtrInput
Manageable pulumi.BoolPtrInput
Management pulumi.BoolPtrInput
// Subnet mask in decimal notation, e.g. "255.255.255.0"
Netmask pulumi.StringPtrInput
// Subnet network address
Network pulumi.StringPtrInput
// boolean flag whether subnet is reachable from the Internet
Public pulumi.BoolPtrInput
}
func (IpAttachmentState) ElementType() reflect.Type {
return reflect.TypeOf((*ipAttachmentState)(nil)).Elem()
}
type ipAttachmentArgs struct {
// CIDR notation of subnet from block reserved in the same
// project and facility as the device
CidrNotation string `pulumi:"cidrNotation"`
// ID of device to which to assign the subnet
DeviceId string `pulumi:"deviceId"`
}
// The set of arguments for constructing a IpAttachment resource.
type IpAttachmentArgs struct {
// CIDR notation of subnet from block reserved in the same
// project and facility as the device
CidrNotation pulumi.StringInput
// ID of device to which to assign the subnet
DeviceId pulumi.StringInput
}
func (IpAttachmentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ipAttachmentArgs)(nil)).Elem()
}