/
instancePlacementGroup.go
346 lines (292 loc) · 15.2 KB
/
instancePlacementGroup.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
334
335
336
337
338
339
340
341
342
343
344
345
346
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package scaleway
import (
"context"
"reflect"
"github.com/dirien/pulumi-scaleway/sdk/v2/go/scaleway/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates and manages Compute Instance Placement Groups. For more information, see [the documentation](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/dirien/pulumi-scaleway/sdk/v2/go/scaleway"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := scaleway.NewInstancePlacementGroup(ctx, "availabilityGroup", nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Placement groups can be imported using the `{zone}/{id}`, e.g. bash
//
// ```sh
//
// $ pulumi import scaleway:index/instancePlacementGroup:InstancePlacementGroup availability_group fr-par-1/11111111-1111-1111-1111-111111111111
//
// ```
type InstancePlacementGroup struct {
pulumi.CustomResourceState
// The name of the placement group.
Name pulumi.StringOutput `pulumi:"name"`
// The organization ID the placement group is associated with.
OrganizationId pulumi.StringOutput `pulumi:"organizationId"`
// The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `optional` or `enforced`.
PolicyMode pulumi.StringPtrOutput `pulumi:"policyMode"`
// Is true when the policy is respected.
PolicyRespected pulumi.BoolOutput `pulumi:"policyRespected"`
// The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `lowLatency` or `maxAvailability`.
PolicyType pulumi.StringPtrOutput `pulumi:"policyType"`
// `projectId`) The ID of the project the placement group is associated with.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// A list of tags to apply to the placement group.
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// `zone`) The zone in which the placement group should be created.
Zone pulumi.StringOutput `pulumi:"zone"`
}
// NewInstancePlacementGroup registers a new resource with the given unique name, arguments, and options.
func NewInstancePlacementGroup(ctx *pulumi.Context,
name string, args *InstancePlacementGroupArgs, opts ...pulumi.ResourceOption) (*InstancePlacementGroup, error) {
if args == nil {
args = &InstancePlacementGroupArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource InstancePlacementGroup
err := ctx.RegisterResource("scaleway:index/instancePlacementGroup:InstancePlacementGroup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetInstancePlacementGroup gets an existing InstancePlacementGroup 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 GetInstancePlacementGroup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *InstancePlacementGroupState, opts ...pulumi.ResourceOption) (*InstancePlacementGroup, error) {
var resource InstancePlacementGroup
err := ctx.ReadResource("scaleway:index/instancePlacementGroup:InstancePlacementGroup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering InstancePlacementGroup resources.
type instancePlacementGroupState struct {
// The name of the placement group.
Name *string `pulumi:"name"`
// The organization ID the placement group is associated with.
OrganizationId *string `pulumi:"organizationId"`
// The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `optional` or `enforced`.
PolicyMode *string `pulumi:"policyMode"`
// Is true when the policy is respected.
PolicyRespected *bool `pulumi:"policyRespected"`
// The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `lowLatency` or `maxAvailability`.
PolicyType *string `pulumi:"policyType"`
// `projectId`) The ID of the project the placement group is associated with.
ProjectId *string `pulumi:"projectId"`
// A list of tags to apply to the placement group.
Tags []string `pulumi:"tags"`
// `zone`) The zone in which the placement group should be created.
Zone *string `pulumi:"zone"`
}
type InstancePlacementGroupState struct {
// The name of the placement group.
Name pulumi.StringPtrInput
// The organization ID the placement group is associated with.
OrganizationId pulumi.StringPtrInput
// The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `optional` or `enforced`.
PolicyMode pulumi.StringPtrInput
// Is true when the policy is respected.
PolicyRespected pulumi.BoolPtrInput
// The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `lowLatency` or `maxAvailability`.
PolicyType pulumi.StringPtrInput
// `projectId`) The ID of the project the placement group is associated with.
ProjectId pulumi.StringPtrInput
// A list of tags to apply to the placement group.
Tags pulumi.StringArrayInput
// `zone`) The zone in which the placement group should be created.
Zone pulumi.StringPtrInput
}
func (InstancePlacementGroupState) ElementType() reflect.Type {
return reflect.TypeOf((*instancePlacementGroupState)(nil)).Elem()
}
type instancePlacementGroupArgs struct {
// The name of the placement group.
Name *string `pulumi:"name"`
// The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `optional` or `enforced`.
PolicyMode *string `pulumi:"policyMode"`
// The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `lowLatency` or `maxAvailability`.
PolicyType *string `pulumi:"policyType"`
// `projectId`) The ID of the project the placement group is associated with.
ProjectId *string `pulumi:"projectId"`
// A list of tags to apply to the placement group.
Tags []string `pulumi:"tags"`
// `zone`) The zone in which the placement group should be created.
Zone *string `pulumi:"zone"`
}
// The set of arguments for constructing a InstancePlacementGroup resource.
type InstancePlacementGroupArgs struct {
// The name of the placement group.
Name pulumi.StringPtrInput
// The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `optional` or `enforced`.
PolicyMode pulumi.StringPtrInput
// The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `lowLatency` or `maxAvailability`.
PolicyType pulumi.StringPtrInput
// `projectId`) The ID of the project the placement group is associated with.
ProjectId pulumi.StringPtrInput
// A list of tags to apply to the placement group.
Tags pulumi.StringArrayInput
// `zone`) The zone in which the placement group should be created.
Zone pulumi.StringPtrInput
}
func (InstancePlacementGroupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*instancePlacementGroupArgs)(nil)).Elem()
}
type InstancePlacementGroupInput interface {
pulumi.Input
ToInstancePlacementGroupOutput() InstancePlacementGroupOutput
ToInstancePlacementGroupOutputWithContext(ctx context.Context) InstancePlacementGroupOutput
}
func (*InstancePlacementGroup) ElementType() reflect.Type {
return reflect.TypeOf((**InstancePlacementGroup)(nil)).Elem()
}
func (i *InstancePlacementGroup) ToInstancePlacementGroupOutput() InstancePlacementGroupOutput {
return i.ToInstancePlacementGroupOutputWithContext(context.Background())
}
func (i *InstancePlacementGroup) ToInstancePlacementGroupOutputWithContext(ctx context.Context) InstancePlacementGroupOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstancePlacementGroupOutput)
}
// InstancePlacementGroupArrayInput is an input type that accepts InstancePlacementGroupArray and InstancePlacementGroupArrayOutput values.
// You can construct a concrete instance of `InstancePlacementGroupArrayInput` via:
//
// InstancePlacementGroupArray{ InstancePlacementGroupArgs{...} }
type InstancePlacementGroupArrayInput interface {
pulumi.Input
ToInstancePlacementGroupArrayOutput() InstancePlacementGroupArrayOutput
ToInstancePlacementGroupArrayOutputWithContext(context.Context) InstancePlacementGroupArrayOutput
}
type InstancePlacementGroupArray []InstancePlacementGroupInput
func (InstancePlacementGroupArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstancePlacementGroup)(nil)).Elem()
}
func (i InstancePlacementGroupArray) ToInstancePlacementGroupArrayOutput() InstancePlacementGroupArrayOutput {
return i.ToInstancePlacementGroupArrayOutputWithContext(context.Background())
}
func (i InstancePlacementGroupArray) ToInstancePlacementGroupArrayOutputWithContext(ctx context.Context) InstancePlacementGroupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstancePlacementGroupArrayOutput)
}
// InstancePlacementGroupMapInput is an input type that accepts InstancePlacementGroupMap and InstancePlacementGroupMapOutput values.
// You can construct a concrete instance of `InstancePlacementGroupMapInput` via:
//
// InstancePlacementGroupMap{ "key": InstancePlacementGroupArgs{...} }
type InstancePlacementGroupMapInput interface {
pulumi.Input
ToInstancePlacementGroupMapOutput() InstancePlacementGroupMapOutput
ToInstancePlacementGroupMapOutputWithContext(context.Context) InstancePlacementGroupMapOutput
}
type InstancePlacementGroupMap map[string]InstancePlacementGroupInput
func (InstancePlacementGroupMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstancePlacementGroup)(nil)).Elem()
}
func (i InstancePlacementGroupMap) ToInstancePlacementGroupMapOutput() InstancePlacementGroupMapOutput {
return i.ToInstancePlacementGroupMapOutputWithContext(context.Background())
}
func (i InstancePlacementGroupMap) ToInstancePlacementGroupMapOutputWithContext(ctx context.Context) InstancePlacementGroupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(InstancePlacementGroupMapOutput)
}
type InstancePlacementGroupOutput struct{ *pulumi.OutputState }
func (InstancePlacementGroupOutput) ElementType() reflect.Type {
return reflect.TypeOf((**InstancePlacementGroup)(nil)).Elem()
}
func (o InstancePlacementGroupOutput) ToInstancePlacementGroupOutput() InstancePlacementGroupOutput {
return o
}
func (o InstancePlacementGroupOutput) ToInstancePlacementGroupOutputWithContext(ctx context.Context) InstancePlacementGroupOutput {
return o
}
// The name of the placement group.
func (o InstancePlacementGroupOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The organization ID the placement group is associated with.
func (o InstancePlacementGroupOutput) OrganizationId() pulumi.StringOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringOutput { return v.OrganizationId }).(pulumi.StringOutput)
}
// The [policy mode](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `optional` or `enforced`.
func (o InstancePlacementGroupOutput) PolicyMode() pulumi.StringPtrOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringPtrOutput { return v.PolicyMode }).(pulumi.StringPtrOutput)
}
// Is true when the policy is respected.
func (o InstancePlacementGroupOutput) PolicyRespected() pulumi.BoolOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.BoolOutput { return v.PolicyRespected }).(pulumi.BoolOutput)
}
// The [policy type](https://developers.scaleway.com/en/products/instance/api/#placement-groups-d8f653) of the placement group. Possible values are: `lowLatency` or `maxAvailability`.
func (o InstancePlacementGroupOutput) PolicyType() pulumi.StringPtrOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringPtrOutput { return v.PolicyType }).(pulumi.StringPtrOutput)
}
// `projectId`) The ID of the project the placement group is associated with.
func (o InstancePlacementGroupOutput) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// A list of tags to apply to the placement group.
func (o InstancePlacementGroupOutput) Tags() pulumi.StringArrayOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringArrayOutput { return v.Tags }).(pulumi.StringArrayOutput)
}
// `zone`) The zone in which the placement group should be created.
func (o InstancePlacementGroupOutput) Zone() pulumi.StringOutput {
return o.ApplyT(func(v *InstancePlacementGroup) pulumi.StringOutput { return v.Zone }).(pulumi.StringOutput)
}
type InstancePlacementGroupArrayOutput struct{ *pulumi.OutputState }
func (InstancePlacementGroupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*InstancePlacementGroup)(nil)).Elem()
}
func (o InstancePlacementGroupArrayOutput) ToInstancePlacementGroupArrayOutput() InstancePlacementGroupArrayOutput {
return o
}
func (o InstancePlacementGroupArrayOutput) ToInstancePlacementGroupArrayOutputWithContext(ctx context.Context) InstancePlacementGroupArrayOutput {
return o
}
func (o InstancePlacementGroupArrayOutput) Index(i pulumi.IntInput) InstancePlacementGroupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *InstancePlacementGroup {
return vs[0].([]*InstancePlacementGroup)[vs[1].(int)]
}).(InstancePlacementGroupOutput)
}
type InstancePlacementGroupMapOutput struct{ *pulumi.OutputState }
func (InstancePlacementGroupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*InstancePlacementGroup)(nil)).Elem()
}
func (o InstancePlacementGroupMapOutput) ToInstancePlacementGroupMapOutput() InstancePlacementGroupMapOutput {
return o
}
func (o InstancePlacementGroupMapOutput) ToInstancePlacementGroupMapOutputWithContext(ctx context.Context) InstancePlacementGroupMapOutput {
return o
}
func (o InstancePlacementGroupMapOutput) MapIndex(k pulumi.StringInput) InstancePlacementGroupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *InstancePlacementGroup {
return vs[0].(map[string]*InstancePlacementGroup)[vs[1].(string)]
}).(InstancePlacementGroupOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*InstancePlacementGroupInput)(nil)).Elem(), &InstancePlacementGroup{})
pulumi.RegisterInputType(reflect.TypeOf((*InstancePlacementGroupArrayInput)(nil)).Elem(), InstancePlacementGroupArray{})
pulumi.RegisterInputType(reflect.TypeOf((*InstancePlacementGroupMapInput)(nil)).Elem(), InstancePlacementGroupMap{})
pulumi.RegisterOutputType(InstancePlacementGroupOutput{})
pulumi.RegisterOutputType(InstancePlacementGroupArrayOutput{})
pulumi.RegisterOutputType(InstancePlacementGroupMapOutput{})
}