forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
3206 lines (2927 loc) · 110 KB
/
models.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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package databox
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"encoding/json"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/to"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/databox/mgmt/2018-01-01/databox"
// AccountCopyLogDetails copy log details for a storage account of a DataBox job
type AccountCopyLogDetails struct {
// AccountName - READ-ONLY; Destination account name.
AccountName *string `json:"accountName,omitempty"`
// CopyLogLink - READ-ONLY; Link for copy logs.
CopyLogLink *string `json:"copyLogLink,omitempty"`
// CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy'
CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountCopyLogDetails.
func (acld AccountCopyLogDetails) MarshalJSON() ([]byte, error) {
acld.CopyLogDetailsType = CopyLogDetailsTypeDataBox
objectMap := make(map[string]interface{})
if acld.CopyLogDetailsType != "" {
objectMap["copyLogDetailsType"] = acld.CopyLogDetailsType
}
return json.Marshal(objectMap)
}
// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails.
func (acld AccountCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) {
return &acld, true
}
// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails.
func (acld AccountCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) {
return nil, false
}
// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails.
func (acld AccountCopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) {
return nil, false
}
// AsCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails.
func (acld AccountCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) {
return nil, false
}
// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails.
func (acld AccountCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) {
return &acld, true
}
// AccountCredentialDetails credential details of the account.
type AccountCredentialDetails struct {
// AccountName - READ-ONLY; Name of the account.
AccountName *string `json:"accountName,omitempty"`
// AccountConnectionString - READ-ONLY; Connection string of the account endpoint to use the account as a storage endpoint on the device.
AccountConnectionString *string `json:"accountConnectionString,omitempty"`
// ShareCredentialDetails - READ-ONLY; Per share level unencrypted access credentials.
ShareCredentialDetails *[]ShareCredentialDetails `json:"shareCredentialDetails,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountCredentialDetails.
func (acd AccountCredentialDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// AddressValidationOutput output of the address validation api.
type AddressValidationOutput struct {
autorest.Response `json:"-"`
// AddressValidationProperties - READ-ONLY; The address validation properties.
*AddressValidationProperties `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AddressValidationOutput.
func (avo AddressValidationOutput) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AddressValidationOutput struct.
func (avo *AddressValidationOutput) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "properties":
if v != nil {
var addressValidationProperties AddressValidationProperties
err = json.Unmarshal(*v, &addressValidationProperties)
if err != nil {
return err
}
avo.AddressValidationProperties = &addressValidationProperties
}
}
}
return nil
}
// AddressValidationProperties the address validation output.
type AddressValidationProperties struct {
// ValidationStatus - READ-ONLY; The address validation status. Possible values include: 'Valid', 'Invalid', 'Ambiguous'
ValidationStatus AddressValidationStatus `json:"validationStatus,omitempty"`
// AlternateAddresses - READ-ONLY; List of alternate addresses.
AlternateAddresses *[]ShippingAddress `json:"alternateAddresses,omitempty"`
}
// MarshalJSON is the custom marshaler for AddressValidationProperties.
func (avp AddressValidationProperties) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ApplianceNetworkConfiguration the Network Adapter configuration of a DataBox.
type ApplianceNetworkConfiguration struct {
// Name - READ-ONLY; Name of the network.
Name *string `json:"name,omitempty"`
// MacAddress - READ-ONLY; Mac Address.
MacAddress *string `json:"macAddress,omitempty"`
}
// MarshalJSON is the custom marshaler for ApplianceNetworkConfiguration.
func (anc ApplianceNetworkConfiguration) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// ArmBaseObject base class for all objects under resource.
type ArmBaseObject struct {
// Name - READ-ONLY; Name of the object.
Name *string `json:"name,omitempty"`
// ID - READ-ONLY; Id of the object.
ID *string `json:"id,omitempty"`
// Type - READ-ONLY; Type of the object.
Type *string `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for ArmBaseObject.
func (abo ArmBaseObject) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// AvailableSkuRequest the filters for showing the available skus.
type AvailableSkuRequest struct {
// TransferType - Type of the transfer.
TransferType *string `json:"transferType,omitempty"`
// Country - ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
Country *string `json:"country,omitempty"`
// Location - Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01
Location *string `json:"location,omitempty"`
// SkuNames - Sku Names to filter for available skus
SkuNames *[]SkuName `json:"skuNames,omitempty"`
}
// AvailableSkusResult the available skus operation response.
type AvailableSkusResult struct {
autorest.Response `json:"-"`
// Value - READ-ONLY; List of available skus.
Value *[]SkuInformation `json:"value,omitempty"`
// NextLink - Link for the next set of skus.
NextLink *string `json:"nextLink,omitempty"`
}
// MarshalJSON is the custom marshaler for AvailableSkusResult.
func (asr AvailableSkusResult) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if asr.NextLink != nil {
objectMap["nextLink"] = asr.NextLink
}
return json.Marshal(objectMap)
}
// AvailableSkusResultIterator provides access to a complete listing of SkuInformation values.
type AvailableSkusResultIterator struct {
i int
page AvailableSkusResultPage
}
// NextWithContext advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func (iter *AvailableSkusResultIterator) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AvailableSkusResultIterator.NextWithContext")
defer func() {
sc := -1
if iter.Response().Response.Response != nil {
sc = iter.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
iter.i++
if iter.i < len(iter.page.Values()) {
return nil
}
err = iter.page.NextWithContext(ctx)
if err != nil {
iter.i--
return err
}
iter.i = 0
return nil
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (iter *AvailableSkusResultIterator) Next() error {
return iter.NextWithContext(context.Background())
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func (iter AvailableSkusResultIterator) NotDone() bool {
return iter.page.NotDone() && iter.i < len(iter.page.Values())
}
// Response returns the raw server response from the last page request.
func (iter AvailableSkusResultIterator) Response() AvailableSkusResult {
return iter.page.Response()
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func (iter AvailableSkusResultIterator) Value() SkuInformation {
if !iter.page.NotDone() {
return SkuInformation{}
}
return iter.page.Values()[iter.i]
}
// Creates a new instance of the AvailableSkusResultIterator type.
func NewAvailableSkusResultIterator(page AvailableSkusResultPage) AvailableSkusResultIterator {
return AvailableSkusResultIterator{page: page}
}
// IsEmpty returns true if the ListResult contains no values.
func (asr AvailableSkusResult) IsEmpty() bool {
return asr.Value == nil || len(*asr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (asr AvailableSkusResult) hasNextLink() bool {
return asr.NextLink != nil && len(*asr.NextLink) != 0
}
// availableSkusResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (asr AvailableSkusResult) availableSkusResultPreparer(ctx context.Context) (*http.Request, error) {
if !asr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
autorest.AsJSON(),
autorest.AsGet(),
autorest.WithBaseURL(to.String(asr.NextLink)))
}
// AvailableSkusResultPage contains a page of SkuInformation values.
type AvailableSkusResultPage struct {
fn func(context.Context, AvailableSkusResult) (AvailableSkusResult, error)
asr AvailableSkusResult
}
// NextWithContext advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func (page *AvailableSkusResultPage) NextWithContext(ctx context.Context) (err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/AvailableSkusResultPage.NextWithContext")
defer func() {
sc := -1
if page.Response().Response.Response != nil {
sc = page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
for {
next, err := page.fn(ctx, page.asr)
if err != nil {
return err
}
page.asr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
return nil
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
// Deprecated: Use NextWithContext() instead.
func (page *AvailableSkusResultPage) Next() error {
return page.NextWithContext(context.Background())
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func (page AvailableSkusResultPage) NotDone() bool {
return !page.asr.IsEmpty()
}
// Response returns the raw server response from the last page request.
func (page AvailableSkusResultPage) Response() AvailableSkusResult {
return page.asr
}
// Values returns the slice of values for the current page or nil if there are no values.
func (page AvailableSkusResultPage) Values() []SkuInformation {
if page.asr.IsEmpty() {
return nil
}
return *page.asr.Value
}
// Creates a new instance of the AvailableSkusResultPage type.
func NewAvailableSkusResultPage(cur AvailableSkusResult, getNextPage func(context.Context, AvailableSkusResult) (AvailableSkusResult, error)) AvailableSkusResultPage {
return AvailableSkusResultPage{
fn: getNextPage,
asr: cur,
}
}
// CancellationReason reason for cancellation.
type CancellationReason struct {
// Reason - Reason for cancellation.
Reason *string `json:"reason,omitempty"`
}
// ContactDetails contact Details.
type ContactDetails struct {
// ContactName - Contact name of the person.
ContactName *string `json:"contactName,omitempty"`
// Phone - Phone number of the contact person.
Phone *string `json:"phone,omitempty"`
// PhoneExtension - Phone extension number of the contact person.
PhoneExtension *string `json:"phoneExtension,omitempty"`
// Mobile - Mobile number of the contact person.
Mobile *string `json:"mobile,omitempty"`
// EmailList - List of Email-ids to be notified about job progress.
EmailList *[]string `json:"emailList,omitempty"`
// NotificationPreference - Notification preference for a job stage.
NotificationPreference *[]NotificationPreference `json:"notificationPreference,omitempty"`
}
// BasicCopyLogDetails details for log generated during copy.
type BasicCopyLogDetails interface {
AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool)
AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool)
AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool)
AsCopyLogDetails() (*CopyLogDetails, bool)
}
// CopyLogDetails details for log generated during copy.
type CopyLogDetails struct {
// CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy'
CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"`
}
func unmarshalBasicCopyLogDetails(body []byte) (BasicCopyLogDetails, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["copyLogDetailsType"] {
case string(CopyLogDetailsTypeDataBox):
var acld AccountCopyLogDetails
err := json.Unmarshal(body, &acld)
return acld, err
case string(CopyLogDetailsTypeDataBoxDisk):
var dcld DiskCopyLogDetails
err := json.Unmarshal(body, &dcld)
return dcld, err
case string(CopyLogDetailsTypeDataBoxHeavy):
var hacld HeavyAccountCopyLogDetails
err := json.Unmarshal(body, &hacld)
return hacld, err
default:
var cld CopyLogDetails
err := json.Unmarshal(body, &cld)
return cld, err
}
}
func unmarshalBasicCopyLogDetailsArray(body []byte) ([]BasicCopyLogDetails, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
cldArray := make([]BasicCopyLogDetails, len(rawMessages))
for index, rawMessage := range rawMessages {
cld, err := unmarshalBasicCopyLogDetails(*rawMessage)
if err != nil {
return nil, err
}
cldArray[index] = cld
}
return cldArray, nil
}
// MarshalJSON is the custom marshaler for CopyLogDetails.
func (cld CopyLogDetails) MarshalJSON() ([]byte, error) {
cld.CopyLogDetailsType = CopyLogDetailsTypeCopyLogDetails
objectMap := make(map[string]interface{})
if cld.CopyLogDetailsType != "" {
objectMap["copyLogDetailsType"] = cld.CopyLogDetailsType
}
return json.Marshal(objectMap)
}
// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails.
func (cld CopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) {
return nil, false
}
// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails.
func (cld CopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) {
return nil, false
}
// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails.
func (cld CopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) {
return nil, false
}
// AsCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails.
func (cld CopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) {
return &cld, true
}
// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails.
func (cld CopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) {
return &cld, true
}
// CopyProgress copy progress.
type CopyProgress struct {
// StorageAccountName - READ-ONLY; Name of the storage account where the data needs to be uploaded.
StorageAccountName *string `json:"storageAccountName,omitempty"`
// AccountID - READ-ONLY; Id of the account where the data needs to be uploaded.
AccountID *string `json:"accountId,omitempty"`
// BytesSentToCloud - READ-ONLY; Amount of data uploaded by the job as of now.
BytesSentToCloud *int64 `json:"bytesSentToCloud,omitempty"`
// TotalBytesToProcess - READ-ONLY; Total amount of data to be processed by the job.
TotalBytesToProcess *int64 `json:"totalBytesToProcess,omitempty"`
// FilesProcessed - READ-ONLY; Number of files processed by the job as of now.
FilesProcessed *int64 `json:"filesProcessed,omitempty"`
// TotalFilesToProcess - READ-ONLY; Total number of files to be processed by the job.
TotalFilesToProcess *int64 `json:"totalFilesToProcess,omitempty"`
}
// MarshalJSON is the custom marshaler for CopyProgress.
func (cp CopyProgress) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// BasicDestinationAccountDetails details of the destination of the data
type BasicDestinationAccountDetails interface {
AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool)
AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool)
AsDestinationAccountDetails() (*DestinationAccountDetails, bool)
}
// DestinationAccountDetails details of the destination of the data
type DestinationAccountDetails struct {
// AccountID - Arm Id of the destination where the data has to be moved.
AccountID *string `json:"accountId,omitempty"`
// DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount'
DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"`
}
func unmarshalBasicDestinationAccountDetails(body []byte) (BasicDestinationAccountDetails, error) {
var m map[string]interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return nil, err
}
switch m["dataDestinationType"] {
case string(DataDestinationTypeManagedDisk):
var dmdd DestinationManagedDiskDetails
err := json.Unmarshal(body, &dmdd)
return dmdd, err
case string(DataDestinationTypeStorageAccount):
var dsad DestinationStorageAccountDetails
err := json.Unmarshal(body, &dsad)
return dsad, err
default:
var dad DestinationAccountDetails
err := json.Unmarshal(body, &dad)
return dad, err
}
}
func unmarshalBasicDestinationAccountDetailsArray(body []byte) ([]BasicDestinationAccountDetails, error) {
var rawMessages []*json.RawMessage
err := json.Unmarshal(body, &rawMessages)
if err != nil {
return nil, err
}
dadArray := make([]BasicDestinationAccountDetails, len(rawMessages))
for index, rawMessage := range rawMessages {
dad, err := unmarshalBasicDestinationAccountDetails(*rawMessage)
if err != nil {
return nil, err
}
dadArray[index] = dad
}
return dadArray, nil
}
// MarshalJSON is the custom marshaler for DestinationAccountDetails.
func (dad DestinationAccountDetails) MarshalJSON() ([]byte, error) {
dad.DataDestinationType = DataDestinationTypeDestinationAccountDetails
objectMap := make(map[string]interface{})
if dad.AccountID != nil {
objectMap["accountId"] = dad.AccountID
}
if dad.DataDestinationType != "" {
objectMap["dataDestinationType"] = dad.DataDestinationType
}
return json.Marshal(objectMap)
}
// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails.
func (dad DestinationAccountDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) {
return nil, false
}
// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails.
func (dad DestinationAccountDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) {
return nil, false
}
// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails.
func (dad DestinationAccountDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) {
return &dad, true
}
// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails.
func (dad DestinationAccountDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) {
return &dad, true
}
// DestinationManagedDiskDetails details for the destination compute disks.
type DestinationManagedDiskDetails struct {
// ResourceGroupID - Destination Resource Group Id where the Compute disks should be created.
ResourceGroupID *string `json:"resourceGroupId,omitempty"`
// StagingStorageAccountID - Arm Id of the storage account that can be used to copy the vhd for staging.
StagingStorageAccountID *string `json:"stagingStorageAccountId,omitempty"`
// AccountID - Arm Id of the destination where the data has to be moved.
AccountID *string `json:"accountId,omitempty"`
// DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount'
DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"`
}
// MarshalJSON is the custom marshaler for DestinationManagedDiskDetails.
func (dmdd DestinationManagedDiskDetails) MarshalJSON() ([]byte, error) {
dmdd.DataDestinationType = DataDestinationTypeManagedDisk
objectMap := make(map[string]interface{})
if dmdd.ResourceGroupID != nil {
objectMap["resourceGroupId"] = dmdd.ResourceGroupID
}
if dmdd.StagingStorageAccountID != nil {
objectMap["stagingStorageAccountId"] = dmdd.StagingStorageAccountID
}
if dmdd.AccountID != nil {
objectMap["accountId"] = dmdd.AccountID
}
if dmdd.DataDestinationType != "" {
objectMap["dataDestinationType"] = dmdd.DataDestinationType
}
return json.Marshal(objectMap)
}
// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails.
func (dmdd DestinationManagedDiskDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) {
return &dmdd, true
}
// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails.
func (dmdd DestinationManagedDiskDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) {
return nil, false
}
// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails.
func (dmdd DestinationManagedDiskDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) {
return nil, false
}
// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails.
func (dmdd DestinationManagedDiskDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) {
return &dmdd, true
}
// DestinationStorageAccountDetails details for the destination storage account.
type DestinationStorageAccountDetails struct {
// StorageAccountID - Destination Storage Account Arm Id.
StorageAccountID *string `json:"storageAccountId,omitempty"`
// AccountID - Arm Id of the destination where the data has to be moved.
AccountID *string `json:"accountId,omitempty"`
// DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount'
DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"`
}
// MarshalJSON is the custom marshaler for DestinationStorageAccountDetails.
func (dsad DestinationStorageAccountDetails) MarshalJSON() ([]byte, error) {
dsad.DataDestinationType = DataDestinationTypeStorageAccount
objectMap := make(map[string]interface{})
if dsad.StorageAccountID != nil {
objectMap["storageAccountId"] = dsad.StorageAccountID
}
if dsad.AccountID != nil {
objectMap["accountId"] = dsad.AccountID
}
if dsad.DataDestinationType != "" {
objectMap["dataDestinationType"] = dsad.DataDestinationType
}
return json.Marshal(objectMap)
}
// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails.
func (dsad DestinationStorageAccountDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) {
return nil, false
}
// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails.
func (dsad DestinationStorageAccountDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) {
return &dsad, true
}
// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails.
func (dsad DestinationStorageAccountDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) {
return nil, false
}
// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails.
func (dsad DestinationStorageAccountDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) {
return &dsad, true
}
// DestinationToServiceLocationMap map of destination location to service location
type DestinationToServiceLocationMap struct {
// DestinationLocation - READ-ONLY; Location of the destination.
DestinationLocation *string `json:"destinationLocation,omitempty"`
// ServiceLocation - READ-ONLY; Location of the service.
ServiceLocation *string `json:"serviceLocation,omitempty"`
}
// MarshalJSON is the custom marshaler for DestinationToServiceLocationMap.
func (dtslm DestinationToServiceLocationMap) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// DiskCopyLogDetails copy Log Details for a disk
type DiskCopyLogDetails struct {
// DiskSerialNumber - READ-ONLY; Disk Serial Number.
DiskSerialNumber *string `json:"diskSerialNumber,omitempty"`
// ErrorLogLink - READ-ONLY; Link for copy error logs.
ErrorLogLink *string `json:"errorLogLink,omitempty"`
// VerboseLogLink - READ-ONLY; Link for copy verbose logs.
VerboseLogLink *string `json:"verboseLogLink,omitempty"`
// CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy'
CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"`
}
// MarshalJSON is the custom marshaler for DiskCopyLogDetails.
func (dcld DiskCopyLogDetails) MarshalJSON() ([]byte, error) {
dcld.CopyLogDetailsType = CopyLogDetailsTypeDataBoxDisk
objectMap := make(map[string]interface{})
if dcld.CopyLogDetailsType != "" {
objectMap["copyLogDetailsType"] = dcld.CopyLogDetailsType
}
return json.Marshal(objectMap)
}
// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails.
func (dcld DiskCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) {
return nil, false
}
// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails.
func (dcld DiskCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) {
return &dcld, true
}
// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails.
func (dcld DiskCopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) {
return nil, false
}
// AsCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails.
func (dcld DiskCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) {
return nil, false
}
// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails.
func (dcld DiskCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) {
return &dcld, true
}
// DiskCopyProgress dataBox Disk Copy Progress
type DiskCopyProgress struct {
// SerialNumber - READ-ONLY; The serial number of the disk
SerialNumber *string `json:"serialNumber,omitempty"`
// BytesCopied - READ-ONLY; Bytes copied during the copy of disk.
BytesCopied *int64 `json:"bytesCopied,omitempty"`
// PercentComplete - READ-ONLY; Indicates the percentage completed for the copy of the disk.
PercentComplete *int32 `json:"percentComplete,omitempty"`
// Status - READ-ONLY; The Status of the copy. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'NotReturned'
Status CopyStatus `json:"status,omitempty"`
}
// MarshalJSON is the custom marshaler for DiskCopyProgress.
func (dcp DiskCopyProgress) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
return json.Marshal(objectMap)
}
// DiskJobDetails dataBox Disk Job Details.
type DiskJobDetails struct {
// PreferredDisks - User preference on what size disks are needed for the job. The map is from the disk size in TB to the count. Eg. {2,5} means 5 disks of 2 TB size. Key is string but will be checked against an int.
PreferredDisks map[string]*int32 `json:"preferredDisks"`
// CopyProgress - READ-ONLY; Copy progress per disk.
CopyProgress *[]DiskCopyProgress `json:"copyProgress,omitempty"`
// DisksAndSizeDetails - READ-ONLY; Contains the map of disk serial number to the disk size being used for the job. Is returned only after the disks are shipped to the customer.
DisksAndSizeDetails map[string]*int32 `json:"disksAndSizeDetails"`
// Passkey - User entered passkey for DataBox Disk job.
Passkey *string `json:"passkey,omitempty"`
// ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transferred in this job, in terabytes.
ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"`
// JobStages - READ-ONLY; List of stages that run in the job.
JobStages *[]JobStages `json:"jobStages,omitempty"`
// ContactDetails - Contact details for notification and shipping.
ContactDetails *ContactDetails `json:"contactDetails,omitempty"`
// ShippingAddress - Shipping address of the customer.
ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"`
// DeliveryPackage - READ-ONLY; Delivery package shipping details.
DeliveryPackage *PackageShippingDetails `json:"deliveryPackage,omitempty"`
// ReturnPackage - READ-ONLY; Return package shipping details.
ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"`
// DestinationAccountDetails - Destination account details.
DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"`
// ErrorDetails - READ-ONLY; Error details for failure. This is optional.
ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"`
// Preferences - Preferences for the order.
Preferences *Preferences `json:"preferences,omitempty"`
// CopyLogDetails - READ-ONLY; List of copy log details.
CopyLogDetails *[]BasicCopyLogDetails `json:"copyLogDetails,omitempty"`
// ReverseShipmentLabelSasKey - READ-ONLY; Shared access key to download the return shipment label
ReverseShipmentLabelSasKey *string `json:"reverseShipmentLabelSasKey,omitempty"`
// ChainOfCustodySasKey - READ-ONLY; Shared access key to download the chain of custody logs
ChainOfCustodySasKey *string `json:"chainOfCustodySasKey,omitempty"`
// JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDataBoxDisk', 'JobDetailsTypeDataBoxHeavy', 'JobDetailsTypeDataBox'
JobDetailsType JobDetailsTypeEnum `json:"jobDetailsType,omitempty"`
}
// MarshalJSON is the custom marshaler for DiskJobDetails.
func (djd DiskJobDetails) MarshalJSON() ([]byte, error) {
djd.JobDetailsType = JobDetailsTypeDataBoxDisk
objectMap := make(map[string]interface{})
if djd.PreferredDisks != nil {
objectMap["preferredDisks"] = djd.PreferredDisks
}
if djd.Passkey != nil {
objectMap["passkey"] = djd.Passkey
}
if djd.ExpectedDataSizeInTeraBytes != nil {
objectMap["expectedDataSizeInTeraBytes"] = djd.ExpectedDataSizeInTeraBytes
}
if djd.ContactDetails != nil {
objectMap["contactDetails"] = djd.ContactDetails
}
if djd.ShippingAddress != nil {
objectMap["shippingAddress"] = djd.ShippingAddress
}
if djd.DestinationAccountDetails != nil {
objectMap["destinationAccountDetails"] = djd.DestinationAccountDetails
}
if djd.Preferences != nil {
objectMap["preferences"] = djd.Preferences
}
if djd.JobDetailsType != "" {
objectMap["jobDetailsType"] = djd.JobDetailsType
}
return json.Marshal(objectMap)
}
// AsDiskJobDetails is the BasicJobDetails implementation for DiskJobDetails.
func (djd DiskJobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) {
return &djd, true
}
// AsHeavyJobDetails is the BasicJobDetails implementation for DiskJobDetails.
func (djd DiskJobDetails) AsHeavyJobDetails() (*HeavyJobDetails, bool) {
return nil, false
}
// AsJobDetailsType is the BasicJobDetails implementation for DiskJobDetails.
func (djd DiskJobDetails) AsJobDetailsType() (*JobDetailsType, bool) {
return nil, false
}
// AsJobDetails is the BasicJobDetails implementation for DiskJobDetails.
func (djd DiskJobDetails) AsJobDetails() (*JobDetails, bool) {
return nil, false
}
// AsBasicJobDetails is the BasicJobDetails implementation for DiskJobDetails.
func (djd DiskJobDetails) AsBasicJobDetails() (BasicJobDetails, bool) {
return &djd, true
}
// UnmarshalJSON is the custom unmarshaler for DiskJobDetails struct.
func (djd *DiskJobDetails) UnmarshalJSON(body []byte) error {
var m map[string]*json.RawMessage
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
for k, v := range m {
switch k {
case "preferredDisks":
if v != nil {
var preferredDisks map[string]*int32
err = json.Unmarshal(*v, &preferredDisks)
if err != nil {
return err
}
djd.PreferredDisks = preferredDisks
}
case "copyProgress":
if v != nil {
var copyProgress []DiskCopyProgress
err = json.Unmarshal(*v, ©Progress)
if err != nil {
return err
}
djd.CopyProgress = ©Progress
}
case "disksAndSizeDetails":
if v != nil {
var disksAndSizeDetails map[string]*int32
err = json.Unmarshal(*v, &disksAndSizeDetails)
if err != nil {
return err
}
djd.DisksAndSizeDetails = disksAndSizeDetails
}
case "passkey":
if v != nil {
var passkey string
err = json.Unmarshal(*v, &passkey)
if err != nil {
return err
}
djd.Passkey = &passkey
}
case "expectedDataSizeInTeraBytes":
if v != nil {
var expectedDataSizeInTeraBytes int32
err = json.Unmarshal(*v, &expectedDataSizeInTeraBytes)
if err != nil {
return err
}
djd.ExpectedDataSizeInTeraBytes = &expectedDataSizeInTeraBytes
}
case "jobStages":
if v != nil {
var jobStages []JobStages
err = json.Unmarshal(*v, &jobStages)
if err != nil {
return err
}
djd.JobStages = &jobStages
}
case "contactDetails":
if v != nil {
var contactDetails ContactDetails
err = json.Unmarshal(*v, &contactDetails)
if err != nil {
return err
}
djd.ContactDetails = &contactDetails
}
case "shippingAddress":
if v != nil {
var shippingAddress ShippingAddress
err = json.Unmarshal(*v, &shippingAddress)
if err != nil {
return err
}
djd.ShippingAddress = &shippingAddress
}
case "deliveryPackage":
if v != nil {
var deliveryPackage PackageShippingDetails
err = json.Unmarshal(*v, &deliveryPackage)
if err != nil {
return err
}
djd.DeliveryPackage = &deliveryPackage
}
case "returnPackage":
if v != nil {
var returnPackage PackageShippingDetails
err = json.Unmarshal(*v, &returnPackage)
if err != nil {
return err
}
djd.ReturnPackage = &returnPackage
}
case "destinationAccountDetails":
if v != nil {
destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v)
if err != nil {
return err
}
djd.DestinationAccountDetails = &destinationAccountDetails
}
case "errorDetails":
if v != nil {
var errorDetails []JobErrorDetails
err = json.Unmarshal(*v, &errorDetails)
if err != nil {
return err
}
djd.ErrorDetails = &errorDetails
}
case "preferences":
if v != nil {
var preferences Preferences
err = json.Unmarshal(*v, &preferences)
if err != nil {
return err
}
djd.Preferences = &preferences
}
case "copyLogDetails":
if v != nil {
copyLogDetails, err := unmarshalBasicCopyLogDetailsArray(*v)
if err != nil {
return err
}
djd.CopyLogDetails = ©LogDetails
}
case "reverseShipmentLabelSasKey":
if v != nil {
var reverseShipmentLabelSasKey string
err = json.Unmarshal(*v, &reverseShipmentLabelSasKey)
if err != nil {
return err
}
djd.ReverseShipmentLabelSasKey = &reverseShipmentLabelSasKey
}
case "chainOfCustodySasKey":
if v != nil {
var chainOfCustodySasKey string
err = json.Unmarshal(*v, &chainOfCustodySasKey)
if err != nil {
return err
}
djd.ChainOfCustodySasKey = &chainOfCustodySasKey
}
case "jobDetailsType":
if v != nil {
var jobDetailsType JobDetailsTypeEnum
err = json.Unmarshal(*v, &jobDetailsType)
if err != nil {
return err
}
djd.JobDetailsType = jobDetailsType