/
order.go
410 lines (354 loc) · 16 KB
/
order.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
// 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 databoxedge
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a Databox Edge Order.
//
// !> Creation of Databox Edge Order is not supported by the Azure API - as such the `databoxedge.Order` resource is deprecated and will be removed in v4.0 of the AzureRM Provider.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/databoxedge"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("example-databoxedge"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleDevice, err := databoxedge.NewDevice(ctx, "example", &databoxedge.DeviceArgs{
// Name: pulumi.String("example-device"),
// ResourceGroupName: example.Name,
// Location: example.Location,
// SkuName: pulumi.String("EdgeP_Base-Standard"),
// })
// if err != nil {
// return err
// }
// _, err = databoxedge.NewOrder(ctx, "example", &databoxedge.OrderArgs{
// ResourceGroupName: example.Name,
// DeviceName: exampleDevice.Name,
// Contact: &databoxedge.OrderContactArgs{
// Name: pulumi.String("TerraForm Test"),
// Emails: pulumi.StringArray{
// pulumi.String("creator4983@FlynnsArcade.com"),
// },
// CompanyName: pulumi.String("Flynn's Arcade"),
// PhoneNumber: pulumi.String("(800) 555-1234"),
// },
// ShipmentAddress: &databoxedge.OrderShipmentAddressArgs{
// Addresses: pulumi.StringArray{
// pulumi.String("One Microsoft Way"),
// },
// City: pulumi.String("Redmond"),
// PostalCode: pulumi.String("98052"),
// State: pulumi.String("WA"),
// Country: pulumi.String("United States"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Databox Edge Orders can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:databoxedge/order:Order example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/device1
// ```
type Order struct {
pulumi.CustomResourceState
// A `contact` block as defined below.
Contact OrderContactOutput `pulumi:"contact"`
// The name of the Databox Edge Device this order is for. Changing this forces a new Databox Edge Order to be created.
DeviceName pulumi.StringOutput `pulumi:"deviceName"`
// The Name of this Databox Edge Order.
Name pulumi.StringOutput `pulumi:"name"`
// The name of the Resource Group where the Databox Edge Order should exist. Changing this forces a new Databox Edge Order to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// Tracking information for the package returned from the customer whether it has an original or a replacement device. A `returnTracking` block as defined below.
ReturnTrackings OrderReturnTrackingArrayOutput `pulumi:"returnTrackings"`
// Serial number of the device being tracked.
SerialNumber pulumi.StringOutput `pulumi:"serialNumber"`
// A `shipmentAddress` block as defined below.
ShipmentAddress OrderShipmentAddressOutput `pulumi:"shipmentAddress"`
// List of status changes in the order. A `shipmentHistory` block as defined below.
ShipmentHistories OrderShipmentHistoryArrayOutput `pulumi:"shipmentHistories"`
// Tracking information for the package delivered to the customer whether it has an original or a replacement device. A `shipmentTracking` block as defined below.
ShipmentTrackings OrderShipmentTrackingArrayOutput `pulumi:"shipmentTrackings"`
// The current status of the order. A `status` block as defined below.
Statuses OrderStatusArrayOutput `pulumi:"statuses"`
}
// NewOrder registers a new resource with the given unique name, arguments, and options.
func NewOrder(ctx *pulumi.Context,
name string, args *OrderArgs, opts ...pulumi.ResourceOption) (*Order, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Contact == nil {
return nil, errors.New("invalid value for required argument 'Contact'")
}
if args.DeviceName == nil {
return nil, errors.New("invalid value for required argument 'DeviceName'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.ShipmentAddress == nil {
return nil, errors.New("invalid value for required argument 'ShipmentAddress'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Order
err := ctx.RegisterResource("azure:databoxedge/order:Order", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetOrder gets an existing Order 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 GetOrder(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *OrderState, opts ...pulumi.ResourceOption) (*Order, error) {
var resource Order
err := ctx.ReadResource("azure:databoxedge/order:Order", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Order resources.
type orderState struct {
// A `contact` block as defined below.
Contact *OrderContact `pulumi:"contact"`
// The name of the Databox Edge Device this order is for. Changing this forces a new Databox Edge Order to be created.
DeviceName *string `pulumi:"deviceName"`
// The Name of this Databox Edge Order.
Name *string `pulumi:"name"`
// The name of the Resource Group where the Databox Edge Order should exist. Changing this forces a new Databox Edge Order to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// Tracking information for the package returned from the customer whether it has an original or a replacement device. A `returnTracking` block as defined below.
ReturnTrackings []OrderReturnTracking `pulumi:"returnTrackings"`
// Serial number of the device being tracked.
SerialNumber *string `pulumi:"serialNumber"`
// A `shipmentAddress` block as defined below.
ShipmentAddress *OrderShipmentAddress `pulumi:"shipmentAddress"`
// List of status changes in the order. A `shipmentHistory` block as defined below.
ShipmentHistories []OrderShipmentHistory `pulumi:"shipmentHistories"`
// Tracking information for the package delivered to the customer whether it has an original or a replacement device. A `shipmentTracking` block as defined below.
ShipmentTrackings []OrderShipmentTracking `pulumi:"shipmentTrackings"`
// The current status of the order. A `status` block as defined below.
Statuses []OrderStatus `pulumi:"statuses"`
}
type OrderState struct {
// A `contact` block as defined below.
Contact OrderContactPtrInput
// The name of the Databox Edge Device this order is for. Changing this forces a new Databox Edge Order to be created.
DeviceName pulumi.StringPtrInput
// The Name of this Databox Edge Order.
Name pulumi.StringPtrInput
// The name of the Resource Group where the Databox Edge Order should exist. Changing this forces a new Databox Edge Order to be created.
ResourceGroupName pulumi.StringPtrInput
// Tracking information for the package returned from the customer whether it has an original or a replacement device. A `returnTracking` block as defined below.
ReturnTrackings OrderReturnTrackingArrayInput
// Serial number of the device being tracked.
SerialNumber pulumi.StringPtrInput
// A `shipmentAddress` block as defined below.
ShipmentAddress OrderShipmentAddressPtrInput
// List of status changes in the order. A `shipmentHistory` block as defined below.
ShipmentHistories OrderShipmentHistoryArrayInput
// Tracking information for the package delivered to the customer whether it has an original or a replacement device. A `shipmentTracking` block as defined below.
ShipmentTrackings OrderShipmentTrackingArrayInput
// The current status of the order. A `status` block as defined below.
Statuses OrderStatusArrayInput
}
func (OrderState) ElementType() reflect.Type {
return reflect.TypeOf((*orderState)(nil)).Elem()
}
type orderArgs struct {
// A `contact` block as defined below.
Contact OrderContact `pulumi:"contact"`
// The name of the Databox Edge Device this order is for. Changing this forces a new Databox Edge Order to be created.
DeviceName string `pulumi:"deviceName"`
// The name of the Resource Group where the Databox Edge Order should exist. Changing this forces a new Databox Edge Order to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// A `shipmentAddress` block as defined below.
ShipmentAddress OrderShipmentAddress `pulumi:"shipmentAddress"`
}
// The set of arguments for constructing a Order resource.
type OrderArgs struct {
// A `contact` block as defined below.
Contact OrderContactInput
// The name of the Databox Edge Device this order is for. Changing this forces a new Databox Edge Order to be created.
DeviceName pulumi.StringInput
// The name of the Resource Group where the Databox Edge Order should exist. Changing this forces a new Databox Edge Order to be created.
ResourceGroupName pulumi.StringInput
// A `shipmentAddress` block as defined below.
ShipmentAddress OrderShipmentAddressInput
}
func (OrderArgs) ElementType() reflect.Type {
return reflect.TypeOf((*orderArgs)(nil)).Elem()
}
type OrderInput interface {
pulumi.Input
ToOrderOutput() OrderOutput
ToOrderOutputWithContext(ctx context.Context) OrderOutput
}
func (*Order) ElementType() reflect.Type {
return reflect.TypeOf((**Order)(nil)).Elem()
}
func (i *Order) ToOrderOutput() OrderOutput {
return i.ToOrderOutputWithContext(context.Background())
}
func (i *Order) ToOrderOutputWithContext(ctx context.Context) OrderOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrderOutput)
}
// OrderArrayInput is an input type that accepts OrderArray and OrderArrayOutput values.
// You can construct a concrete instance of `OrderArrayInput` via:
//
// OrderArray{ OrderArgs{...} }
type OrderArrayInput interface {
pulumi.Input
ToOrderArrayOutput() OrderArrayOutput
ToOrderArrayOutputWithContext(context.Context) OrderArrayOutput
}
type OrderArray []OrderInput
func (OrderArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Order)(nil)).Elem()
}
func (i OrderArray) ToOrderArrayOutput() OrderArrayOutput {
return i.ToOrderArrayOutputWithContext(context.Background())
}
func (i OrderArray) ToOrderArrayOutputWithContext(ctx context.Context) OrderArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrderArrayOutput)
}
// OrderMapInput is an input type that accepts OrderMap and OrderMapOutput values.
// You can construct a concrete instance of `OrderMapInput` via:
//
// OrderMap{ "key": OrderArgs{...} }
type OrderMapInput interface {
pulumi.Input
ToOrderMapOutput() OrderMapOutput
ToOrderMapOutputWithContext(context.Context) OrderMapOutput
}
type OrderMap map[string]OrderInput
func (OrderMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Order)(nil)).Elem()
}
func (i OrderMap) ToOrderMapOutput() OrderMapOutput {
return i.ToOrderMapOutputWithContext(context.Background())
}
func (i OrderMap) ToOrderMapOutputWithContext(ctx context.Context) OrderMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrderMapOutput)
}
type OrderOutput struct{ *pulumi.OutputState }
func (OrderOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Order)(nil)).Elem()
}
func (o OrderOutput) ToOrderOutput() OrderOutput {
return o
}
func (o OrderOutput) ToOrderOutputWithContext(ctx context.Context) OrderOutput {
return o
}
// A `contact` block as defined below.
func (o OrderOutput) Contact() OrderContactOutput {
return o.ApplyT(func(v *Order) OrderContactOutput { return v.Contact }).(OrderContactOutput)
}
// The name of the Databox Edge Device this order is for. Changing this forces a new Databox Edge Order to be created.
func (o OrderOutput) DeviceName() pulumi.StringOutput {
return o.ApplyT(func(v *Order) pulumi.StringOutput { return v.DeviceName }).(pulumi.StringOutput)
}
// The Name of this Databox Edge Order.
func (o OrderOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Order) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The name of the Resource Group where the Databox Edge Order should exist. Changing this forces a new Databox Edge Order to be created.
func (o OrderOutput) ResourceGroupName() pulumi.StringOutput {
return o.ApplyT(func(v *Order) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)
}
// Tracking information for the package returned from the customer whether it has an original or a replacement device. A `returnTracking` block as defined below.
func (o OrderOutput) ReturnTrackings() OrderReturnTrackingArrayOutput {
return o.ApplyT(func(v *Order) OrderReturnTrackingArrayOutput { return v.ReturnTrackings }).(OrderReturnTrackingArrayOutput)
}
// Serial number of the device being tracked.
func (o OrderOutput) SerialNumber() pulumi.StringOutput {
return o.ApplyT(func(v *Order) pulumi.StringOutput { return v.SerialNumber }).(pulumi.StringOutput)
}
// A `shipmentAddress` block as defined below.
func (o OrderOutput) ShipmentAddress() OrderShipmentAddressOutput {
return o.ApplyT(func(v *Order) OrderShipmentAddressOutput { return v.ShipmentAddress }).(OrderShipmentAddressOutput)
}
// List of status changes in the order. A `shipmentHistory` block as defined below.
func (o OrderOutput) ShipmentHistories() OrderShipmentHistoryArrayOutput {
return o.ApplyT(func(v *Order) OrderShipmentHistoryArrayOutput { return v.ShipmentHistories }).(OrderShipmentHistoryArrayOutput)
}
// Tracking information for the package delivered to the customer whether it has an original or a replacement device. A `shipmentTracking` block as defined below.
func (o OrderOutput) ShipmentTrackings() OrderShipmentTrackingArrayOutput {
return o.ApplyT(func(v *Order) OrderShipmentTrackingArrayOutput { return v.ShipmentTrackings }).(OrderShipmentTrackingArrayOutput)
}
// The current status of the order. A `status` block as defined below.
func (o OrderOutput) Statuses() OrderStatusArrayOutput {
return o.ApplyT(func(v *Order) OrderStatusArrayOutput { return v.Statuses }).(OrderStatusArrayOutput)
}
type OrderArrayOutput struct{ *pulumi.OutputState }
func (OrderArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Order)(nil)).Elem()
}
func (o OrderArrayOutput) ToOrderArrayOutput() OrderArrayOutput {
return o
}
func (o OrderArrayOutput) ToOrderArrayOutputWithContext(ctx context.Context) OrderArrayOutput {
return o
}
func (o OrderArrayOutput) Index(i pulumi.IntInput) OrderOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Order {
return vs[0].([]*Order)[vs[1].(int)]
}).(OrderOutput)
}
type OrderMapOutput struct{ *pulumi.OutputState }
func (OrderMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Order)(nil)).Elem()
}
func (o OrderMapOutput) ToOrderMapOutput() OrderMapOutput {
return o
}
func (o OrderMapOutput) ToOrderMapOutputWithContext(ctx context.Context) OrderMapOutput {
return o
}
func (o OrderMapOutput) MapIndex(k pulumi.StringInput) OrderOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Order {
return vs[0].(map[string]*Order)[vs[1].(string)]
}).(OrderOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*OrderInput)(nil)).Elem(), &Order{})
pulumi.RegisterInputType(reflect.TypeOf((*OrderArrayInput)(nil)).Elem(), OrderArray{})
pulumi.RegisterInputType(reflect.TypeOf((*OrderMapInput)(nil)).Elem(), OrderMap{})
pulumi.RegisterOutputType(OrderOutput{})
pulumi.RegisterOutputType(OrderArrayOutput{})
pulumi.RegisterOutputType(OrderMapOutput{})
}