/
instance.go
291 lines (247 loc) · 12.7 KB
/
instance.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
// Code generated by pulumi-language-go DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package lightsail
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws"
"github.com/pulumi/pulumi-aws-native/sdk/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource Type definition for AWS::Lightsail::Instance
type Instance struct {
pulumi.CustomResourceState
// An array of objects representing the add-ons to enable for the new instance.
AddOns InstanceAddOnArrayOutput `pulumi:"addOns"`
// The Availability Zone in which to create your instance. Use the following format: us-east-2a (case sensitive). Be sure to add the include Availability Zones parameter to your request.
AvailabilityZone pulumi.StringPtrOutput `pulumi:"availabilityZone"`
// The ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0 ). Use the get blueprints operation to return a list of available images (or blueprints ).
BlueprintId pulumi.StringOutput `pulumi:"blueprintId"`
// The bundle of specification information for your virtual private server (or instance ), including the pricing plan (e.g., micro_1_0 ).
BundleId pulumi.StringOutput `pulumi:"bundleId"`
Hardware InstanceHardwarePtrOutput `pulumi:"hardware"`
InstanceArn pulumi.StringOutput `pulumi:"instanceArn"`
// The names to use for your new Lightsail instance.
InstanceName pulumi.StringOutput `pulumi:"instanceName"`
// Is the IP Address of the Instance is the static IP
IsStaticIp pulumi.BoolOutput `pulumi:"isStaticIp"`
// The name of your key pair.
KeyPairName pulumi.StringPtrOutput `pulumi:"keyPairName"`
Location InstanceLocationPtrOutput `pulumi:"location"`
Networking InstanceNetworkingPtrOutput `pulumi:"networking"`
// Private IP Address of the Instance
PrivateIpAddress pulumi.StringOutput `pulumi:"privateIpAddress"`
// Public IP Address of the Instance
PublicIpAddress pulumi.StringOutput `pulumi:"publicIpAddress"`
// Resource type of Lightsail instance.
ResourceType pulumi.StringOutput `pulumi:"resourceType"`
// SSH Key Name of the Lightsail instance.
SshKeyName pulumi.StringOutput `pulumi:"sshKeyName"`
State InstanceStateTypePtrOutput `pulumi:"state"`
// Support code to help identify any issues
SupportCode pulumi.StringOutput `pulumi:"supportCode"`
// An array of key-value pairs to apply to this resource.
Tags aws.TagArrayOutput `pulumi:"tags"`
// A launch script you can create that configures a server with additional user data. For example, you might want to run apt-get -y update.
UserData pulumi.StringPtrOutput `pulumi:"userData"`
// Username of the Lightsail instance.
UserName pulumi.StringOutput `pulumi:"userName"`
}
// NewInstance registers a new resource with the given unique name, arguments, and options.
func NewInstance(ctx *pulumi.Context,
name string, args *InstanceArgs, opts ...pulumi.ResourceOption) (*Instance, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.BlueprintId == nil {
return nil, errors.New("invalid value for required argument 'BlueprintId'")
}
if args.BundleId == nil {
return nil, errors.New("invalid value for required argument 'BundleId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"availabilityZone",
"blueprintId",
"bundleId",
"instanceName",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Instance
err := ctx.RegisterResource("aws-native:lightsail:Instance", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetInstance gets an existing Instance 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 GetInstance(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *InstanceState, opts ...pulumi.ResourceOption) (*Instance, error) {
var resource Instance
err := ctx.ReadResource("aws-native:lightsail:Instance", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Instance resources.
type instanceState struct {
}
type InstanceState struct {
}
func (InstanceState) ElementType() reflect.Type {
return reflect.TypeOf((*instanceState)(nil)).Elem()
}
type instanceArgs struct {
// An array of objects representing the add-ons to enable for the new instance.
AddOns []InstanceAddOn `pulumi:"addOns"`
// The Availability Zone in which to create your instance. Use the following format: us-east-2a (case sensitive). Be sure to add the include Availability Zones parameter to your request.
AvailabilityZone *string `pulumi:"availabilityZone"`
// The ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0 ). Use the get blueprints operation to return a list of available images (or blueprints ).
BlueprintId string `pulumi:"blueprintId"`
// The bundle of specification information for your virtual private server (or instance ), including the pricing plan (e.g., micro_1_0 ).
BundleId string `pulumi:"bundleId"`
Hardware *InstanceHardware `pulumi:"hardware"`
// The names to use for your new Lightsail instance.
InstanceName *string `pulumi:"instanceName"`
// The name of your key pair.
KeyPairName *string `pulumi:"keyPairName"`
Location *InstanceLocation `pulumi:"location"`
Networking *InstanceNetworking `pulumi:"networking"`
State *InstanceStateType `pulumi:"state"`
// An array of key-value pairs to apply to this resource.
Tags []aws.Tag `pulumi:"tags"`
// A launch script you can create that configures a server with additional user data. For example, you might want to run apt-get -y update.
UserData *string `pulumi:"userData"`
}
// The set of arguments for constructing a Instance resource.
type InstanceArgs struct {
// An array of objects representing the add-ons to enable for the new instance.
AddOns InstanceAddOnArrayInput
// The Availability Zone in which to create your instance. Use the following format: us-east-2a (case sensitive). Be sure to add the include Availability Zones parameter to your request.
AvailabilityZone pulumi.StringPtrInput
// The ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0 ). Use the get blueprints operation to return a list of available images (or blueprints ).
BlueprintId pulumi.StringInput
// The bundle of specification information for your virtual private server (or instance ), including the pricing plan (e.g., micro_1_0 ).
BundleId pulumi.StringInput
Hardware InstanceHardwarePtrInput
// The names to use for your new Lightsail instance.
InstanceName pulumi.StringPtrInput
// The name of your key pair.
KeyPairName pulumi.StringPtrInput
Location InstanceLocationPtrInput
Networking InstanceNetworkingPtrInput
State InstanceStateTypePtrInput
// An array of key-value pairs to apply to this resource.
Tags aws.TagArrayInput
// A launch script you can create that configures a server with additional user data. For example, you might want to run apt-get -y update.
UserData pulumi.StringPtrInput
}
func (InstanceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*instanceArgs)(nil)).Elem()
}
type InstanceInput interface {
pulumi.Input
ToInstanceOutput() InstanceOutput
ToInstanceOutputWithContext(ctx context.Context) InstanceOutput
}
func (*Instance) ElementType() reflect.Type {
return reflect.TypeOf((**Instance)(nil)).Elem()
}
func (i *Instance) ToInstanceOutput() InstanceOutput {
return i.ToInstanceOutputWithContext(context.Background())
}
func (i *Instance) ToInstanceOutputWithContext(ctx context.Context) InstanceOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstanceOutput)
}
type InstanceOutput struct{ *pulumi.OutputState }
func (InstanceOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Instance)(nil)).Elem()
}
func (o InstanceOutput) ToInstanceOutput() InstanceOutput {
return o
}
func (o InstanceOutput) ToInstanceOutputWithContext(ctx context.Context) InstanceOutput {
return o
}
// An array of objects representing the add-ons to enable for the new instance.
func (o InstanceOutput) AddOns() InstanceAddOnArrayOutput {
return o.ApplyT(func(v *Instance) InstanceAddOnArrayOutput { return v.AddOns }).(InstanceAddOnArrayOutput)
}
// The Availability Zone in which to create your instance. Use the following format: us-east-2a (case sensitive). Be sure to add the include Availability Zones parameter to your request.
func (o InstanceOutput) AvailabilityZone() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Instance) pulumi.StringPtrOutput { return v.AvailabilityZone }).(pulumi.StringPtrOutput)
}
// The ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0 ). Use the get blueprints operation to return a list of available images (or blueprints ).
func (o InstanceOutput) BlueprintId() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.BlueprintId }).(pulumi.StringOutput)
}
// The bundle of specification information for your virtual private server (or instance ), including the pricing plan (e.g., micro_1_0 ).
func (o InstanceOutput) BundleId() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.BundleId }).(pulumi.StringOutput)
}
func (o InstanceOutput) Hardware() InstanceHardwarePtrOutput {
return o.ApplyT(func(v *Instance) InstanceHardwarePtrOutput { return v.Hardware }).(InstanceHardwarePtrOutput)
}
func (o InstanceOutput) InstanceArn() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.InstanceArn }).(pulumi.StringOutput)
}
// The names to use for your new Lightsail instance.
func (o InstanceOutput) InstanceName() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.InstanceName }).(pulumi.StringOutput)
}
// Is the IP Address of the Instance is the static IP
func (o InstanceOutput) IsStaticIp() pulumi.BoolOutput {
return o.ApplyT(func(v *Instance) pulumi.BoolOutput { return v.IsStaticIp }).(pulumi.BoolOutput)
}
// The name of your key pair.
func (o InstanceOutput) KeyPairName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Instance) pulumi.StringPtrOutput { return v.KeyPairName }).(pulumi.StringPtrOutput)
}
func (o InstanceOutput) Location() InstanceLocationPtrOutput {
return o.ApplyT(func(v *Instance) InstanceLocationPtrOutput { return v.Location }).(InstanceLocationPtrOutput)
}
func (o InstanceOutput) Networking() InstanceNetworkingPtrOutput {
return o.ApplyT(func(v *Instance) InstanceNetworkingPtrOutput { return v.Networking }).(InstanceNetworkingPtrOutput)
}
// Private IP Address of the Instance
func (o InstanceOutput) PrivateIpAddress() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.PrivateIpAddress }).(pulumi.StringOutput)
}
// Public IP Address of the Instance
func (o InstanceOutput) PublicIpAddress() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.PublicIpAddress }).(pulumi.StringOutput)
}
// Resource type of Lightsail instance.
func (o InstanceOutput) ResourceType() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.ResourceType }).(pulumi.StringOutput)
}
// SSH Key Name of the Lightsail instance.
func (o InstanceOutput) SshKeyName() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.SshKeyName }).(pulumi.StringOutput)
}
func (o InstanceOutput) State() InstanceStateTypePtrOutput {
return o.ApplyT(func(v *Instance) InstanceStateTypePtrOutput { return v.State }).(InstanceStateTypePtrOutput)
}
// Support code to help identify any issues
func (o InstanceOutput) SupportCode() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.SupportCode }).(pulumi.StringOutput)
}
// An array of key-value pairs to apply to this resource.
func (o InstanceOutput) Tags() aws.TagArrayOutput {
return o.ApplyT(func(v *Instance) aws.TagArrayOutput { return v.Tags }).(aws.TagArrayOutput)
}
// A launch script you can create that configures a server with additional user data. For example, you might want to run apt-get -y update.
func (o InstanceOutput) UserData() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Instance) pulumi.StringPtrOutput { return v.UserData }).(pulumi.StringPtrOutput)
}
// Username of the Lightsail instance.
func (o InstanceOutput) UserName() pulumi.StringOutput {
return o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.UserName }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*InstanceInput)(nil)).Elem(), &Instance{})
pulumi.RegisterOutputType(InstanceOutput{})
}