This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
serverInstallTask.go
415 lines (358 loc) · 15.2 KB
/
serverInstallTask.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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
// 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 dedicated
import (
"context"
"reflect"
"errors"
"github.com/lbrlabs/pulumi-ovh/sdk/go/ovh/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/lbrlabs/pulumi-ovh/sdk/go/ovh/Dedicated"
// "github.com/lbrlabs/pulumi-ovh/sdk/go/ovh/Me"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// rescue, err := Dedicated.GetServerBoots(ctx, &dedicated.GetServerBootsArgs{
// ServiceName: "nsxxxxxxx.ip-xx-xx-xx.eu",
// BootType: pulumi.StringRef("rescue"),
// }, nil)
// if err != nil {
// return err
// }
// key, err := Me.NewSshKey(ctx, "key", &Me.SshKeyArgs{
// KeyName: pulumi.String("mykey"),
// Key: pulumi.String("ssh-ed25519 AAAAC3..."),
// })
// if err != nil {
// return err
// }
// debian, err := Me.NewInstallationTemplate(ctx, "debian", &Me.InstallationTemplateArgs{
// BaseTemplateName: pulumi.String("debian11_64"),
// TemplateName: pulumi.String("mydebian11"),
// DefaultLanguage: pulumi.String("en"),
// Customization: &me.InstallationTemplateCustomizationArgs{
// SshKeyName: key.KeyName,
// },
// })
// if err != nil {
// return err
// }
// _, err = Dedicated.NewServerInstallTask(ctx, "serverInstall", &Dedicated.ServerInstallTaskArgs{
// ServiceName: pulumi.String("nsxxxxxxx.ip-xx-xx-xx.eu"),
// TemplateName: debian.TemplateName,
// BootidOnDestroy: *pulumi.Int(rescue.Results[0]),
// Details: &dedicated.ServerInstallTaskDetailsArgs{
// CustomHostname: pulumi.String("mytest"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Installation task can be imported using the `service_name` (`nsXXXX.ip...`) of the baremetal server, the `template_name` used
//
// and ths `task_id`, separated by "/" E.g., bash
//
// ```sh
//
// $ pulumi import ovh:Dedicated/serverInstallTask:ServerInstallTask ovh_dedicated_server_install_task nsXXXX.ipXXXX/template_name/12345
//
// ```
type ServerInstallTask struct {
pulumi.CustomResourceState
// If set, reboot the server on the specified boot id during destroy phase.
BootidOnDestroy pulumi.IntPtrOutput `pulumi:"bootidOnDestroy"`
// Details of this task. (should be `Install asked`)
Comment pulumi.StringOutput `pulumi:"comment"`
// see `details` block below.
Details ServerInstallTaskDetailsPtrOutput `pulumi:"details"`
// Completion date in RFC3339 format.
DoneDate pulumi.StringOutput `pulumi:"doneDate"`
// Function name (should be `hardInstall`).
Function pulumi.StringOutput `pulumi:"function"`
// Last update in RFC3339 format.
LastUpdate pulumi.StringOutput `pulumi:"lastUpdate"`
// Partition scheme name.
PartitionSchemeName pulumi.StringPtrOutput `pulumi:"partitionSchemeName"`
// The serviceName of your dedicated server.
ServiceName pulumi.StringOutput `pulumi:"serviceName"`
// Task creation date in RFC3339 format.
StartDate pulumi.StringOutput `pulumi:"startDate"`
// Task status (should be `done`)
Status pulumi.StringOutput `pulumi:"status"`
// Template name.
TemplateName pulumi.StringOutput `pulumi:"templateName"`
}
// NewServerInstallTask registers a new resource with the given unique name, arguments, and options.
func NewServerInstallTask(ctx *pulumi.Context,
name string, args *ServerInstallTaskArgs, opts ...pulumi.ResourceOption) (*ServerInstallTask, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ServiceName == nil {
return nil, errors.New("invalid value for required argument 'ServiceName'")
}
if args.TemplateName == nil {
return nil, errors.New("invalid value for required argument 'TemplateName'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ServerInstallTask
err := ctx.RegisterResource("ovh:Dedicated/serverInstallTask:ServerInstallTask", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetServerInstallTask gets an existing ServerInstallTask 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 GetServerInstallTask(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServerInstallTaskState, opts ...pulumi.ResourceOption) (*ServerInstallTask, error) {
var resource ServerInstallTask
err := ctx.ReadResource("ovh:Dedicated/serverInstallTask:ServerInstallTask", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ServerInstallTask resources.
type serverInstallTaskState struct {
// If set, reboot the server on the specified boot id during destroy phase.
BootidOnDestroy *int `pulumi:"bootidOnDestroy"`
// Details of this task. (should be `Install asked`)
Comment *string `pulumi:"comment"`
// see `details` block below.
Details *ServerInstallTaskDetails `pulumi:"details"`
// Completion date in RFC3339 format.
DoneDate *string `pulumi:"doneDate"`
// Function name (should be `hardInstall`).
Function *string `pulumi:"function"`
// Last update in RFC3339 format.
LastUpdate *string `pulumi:"lastUpdate"`
// Partition scheme name.
PartitionSchemeName *string `pulumi:"partitionSchemeName"`
// The serviceName of your dedicated server.
ServiceName *string `pulumi:"serviceName"`
// Task creation date in RFC3339 format.
StartDate *string `pulumi:"startDate"`
// Task status (should be `done`)
Status *string `pulumi:"status"`
// Template name.
TemplateName *string `pulumi:"templateName"`
}
type ServerInstallTaskState struct {
// If set, reboot the server on the specified boot id during destroy phase.
BootidOnDestroy pulumi.IntPtrInput
// Details of this task. (should be `Install asked`)
Comment pulumi.StringPtrInput
// see `details` block below.
Details ServerInstallTaskDetailsPtrInput
// Completion date in RFC3339 format.
DoneDate pulumi.StringPtrInput
// Function name (should be `hardInstall`).
Function pulumi.StringPtrInput
// Last update in RFC3339 format.
LastUpdate pulumi.StringPtrInput
// Partition scheme name.
PartitionSchemeName pulumi.StringPtrInput
// The serviceName of your dedicated server.
ServiceName pulumi.StringPtrInput
// Task creation date in RFC3339 format.
StartDate pulumi.StringPtrInput
// Task status (should be `done`)
Status pulumi.StringPtrInput
// Template name.
TemplateName pulumi.StringPtrInput
}
func (ServerInstallTaskState) ElementType() reflect.Type {
return reflect.TypeOf((*serverInstallTaskState)(nil)).Elem()
}
type serverInstallTaskArgs struct {
// If set, reboot the server on the specified boot id during destroy phase.
BootidOnDestroy *int `pulumi:"bootidOnDestroy"`
// see `details` block below.
Details *ServerInstallTaskDetails `pulumi:"details"`
// Partition scheme name.
PartitionSchemeName *string `pulumi:"partitionSchemeName"`
// The serviceName of your dedicated server.
ServiceName string `pulumi:"serviceName"`
// Template name.
TemplateName string `pulumi:"templateName"`
}
// The set of arguments for constructing a ServerInstallTask resource.
type ServerInstallTaskArgs struct {
// If set, reboot the server on the specified boot id during destroy phase.
BootidOnDestroy pulumi.IntPtrInput
// see `details` block below.
Details ServerInstallTaskDetailsPtrInput
// Partition scheme name.
PartitionSchemeName pulumi.StringPtrInput
// The serviceName of your dedicated server.
ServiceName pulumi.StringInput
// Template name.
TemplateName pulumi.StringInput
}
func (ServerInstallTaskArgs) ElementType() reflect.Type {
return reflect.TypeOf((*serverInstallTaskArgs)(nil)).Elem()
}
type ServerInstallTaskInput interface {
pulumi.Input
ToServerInstallTaskOutput() ServerInstallTaskOutput
ToServerInstallTaskOutputWithContext(ctx context.Context) ServerInstallTaskOutput
}
func (*ServerInstallTask) ElementType() reflect.Type {
return reflect.TypeOf((**ServerInstallTask)(nil)).Elem()
}
func (i *ServerInstallTask) ToServerInstallTaskOutput() ServerInstallTaskOutput {
return i.ToServerInstallTaskOutputWithContext(context.Background())
}
func (i *ServerInstallTask) ToServerInstallTaskOutputWithContext(ctx context.Context) ServerInstallTaskOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServerInstallTaskOutput)
}
// ServerInstallTaskArrayInput is an input type that accepts ServerInstallTaskArray and ServerInstallTaskArrayOutput values.
// You can construct a concrete instance of `ServerInstallTaskArrayInput` via:
//
// ServerInstallTaskArray{ ServerInstallTaskArgs{...} }
type ServerInstallTaskArrayInput interface {
pulumi.Input
ToServerInstallTaskArrayOutput() ServerInstallTaskArrayOutput
ToServerInstallTaskArrayOutputWithContext(context.Context) ServerInstallTaskArrayOutput
}
type ServerInstallTaskArray []ServerInstallTaskInput
func (ServerInstallTaskArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ServerInstallTask)(nil)).Elem()
}
func (i ServerInstallTaskArray) ToServerInstallTaskArrayOutput() ServerInstallTaskArrayOutput {
return i.ToServerInstallTaskArrayOutputWithContext(context.Background())
}
func (i ServerInstallTaskArray) ToServerInstallTaskArrayOutputWithContext(ctx context.Context) ServerInstallTaskArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServerInstallTaskArrayOutput)
}
// ServerInstallTaskMapInput is an input type that accepts ServerInstallTaskMap and ServerInstallTaskMapOutput values.
// You can construct a concrete instance of `ServerInstallTaskMapInput` via:
//
// ServerInstallTaskMap{ "key": ServerInstallTaskArgs{...} }
type ServerInstallTaskMapInput interface {
pulumi.Input
ToServerInstallTaskMapOutput() ServerInstallTaskMapOutput
ToServerInstallTaskMapOutputWithContext(context.Context) ServerInstallTaskMapOutput
}
type ServerInstallTaskMap map[string]ServerInstallTaskInput
func (ServerInstallTaskMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ServerInstallTask)(nil)).Elem()
}
func (i ServerInstallTaskMap) ToServerInstallTaskMapOutput() ServerInstallTaskMapOutput {
return i.ToServerInstallTaskMapOutputWithContext(context.Background())
}
func (i ServerInstallTaskMap) ToServerInstallTaskMapOutputWithContext(ctx context.Context) ServerInstallTaskMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServerInstallTaskMapOutput)
}
type ServerInstallTaskOutput struct{ *pulumi.OutputState }
func (ServerInstallTaskOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ServerInstallTask)(nil)).Elem()
}
func (o ServerInstallTaskOutput) ToServerInstallTaskOutput() ServerInstallTaskOutput {
return o
}
func (o ServerInstallTaskOutput) ToServerInstallTaskOutputWithContext(ctx context.Context) ServerInstallTaskOutput {
return o
}
// If set, reboot the server on the specified boot id during destroy phase.
func (o ServerInstallTaskOutput) BootidOnDestroy() pulumi.IntPtrOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.IntPtrOutput { return v.BootidOnDestroy }).(pulumi.IntPtrOutput)
}
// Details of this task. (should be `Install asked`)
func (o ServerInstallTaskOutput) Comment() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.Comment }).(pulumi.StringOutput)
}
// see `details` block below.
func (o ServerInstallTaskOutput) Details() ServerInstallTaskDetailsPtrOutput {
return o.ApplyT(func(v *ServerInstallTask) ServerInstallTaskDetailsPtrOutput { return v.Details }).(ServerInstallTaskDetailsPtrOutput)
}
// Completion date in RFC3339 format.
func (o ServerInstallTaskOutput) DoneDate() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.DoneDate }).(pulumi.StringOutput)
}
// Function name (should be `hardInstall`).
func (o ServerInstallTaskOutput) Function() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.Function }).(pulumi.StringOutput)
}
// Last update in RFC3339 format.
func (o ServerInstallTaskOutput) LastUpdate() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.LastUpdate }).(pulumi.StringOutput)
}
// Partition scheme name.
func (o ServerInstallTaskOutput) PartitionSchemeName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringPtrOutput { return v.PartitionSchemeName }).(pulumi.StringPtrOutput)
}
// The serviceName of your dedicated server.
func (o ServerInstallTaskOutput) ServiceName() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.ServiceName }).(pulumi.StringOutput)
}
// Task creation date in RFC3339 format.
func (o ServerInstallTaskOutput) StartDate() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.StartDate }).(pulumi.StringOutput)
}
// Task status (should be `done`)
func (o ServerInstallTaskOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// Template name.
func (o ServerInstallTaskOutput) TemplateName() pulumi.StringOutput {
return o.ApplyT(func(v *ServerInstallTask) pulumi.StringOutput { return v.TemplateName }).(pulumi.StringOutput)
}
type ServerInstallTaskArrayOutput struct{ *pulumi.OutputState }
func (ServerInstallTaskArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ServerInstallTask)(nil)).Elem()
}
func (o ServerInstallTaskArrayOutput) ToServerInstallTaskArrayOutput() ServerInstallTaskArrayOutput {
return o
}
func (o ServerInstallTaskArrayOutput) ToServerInstallTaskArrayOutputWithContext(ctx context.Context) ServerInstallTaskArrayOutput {
return o
}
func (o ServerInstallTaskArrayOutput) Index(i pulumi.IntInput) ServerInstallTaskOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServerInstallTask {
return vs[0].([]*ServerInstallTask)[vs[1].(int)]
}).(ServerInstallTaskOutput)
}
type ServerInstallTaskMapOutput struct{ *pulumi.OutputState }
func (ServerInstallTaskMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ServerInstallTask)(nil)).Elem()
}
func (o ServerInstallTaskMapOutput) ToServerInstallTaskMapOutput() ServerInstallTaskMapOutput {
return o
}
func (o ServerInstallTaskMapOutput) ToServerInstallTaskMapOutputWithContext(ctx context.Context) ServerInstallTaskMapOutput {
return o
}
func (o ServerInstallTaskMapOutput) MapIndex(k pulumi.StringInput) ServerInstallTaskOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServerInstallTask {
return vs[0].(map[string]*ServerInstallTask)[vs[1].(string)]
}).(ServerInstallTaskOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ServerInstallTaskInput)(nil)).Elem(), &ServerInstallTask{})
pulumi.RegisterInputType(reflect.TypeOf((*ServerInstallTaskArrayInput)(nil)).Elem(), ServerInstallTaskArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ServerInstallTaskMapInput)(nil)).Elem(), ServerInstallTaskMap{})
pulumi.RegisterOutputType(ServerInstallTaskOutput{})
pulumi.RegisterOutputType(ServerInstallTaskArrayOutput{})
pulumi.RegisterOutputType(ServerInstallTaskMapOutput{})
}