-
Notifications
You must be signed in to change notification settings - Fork 13
/
JobsCreateExport.go
194 lines (191 loc) · 7.8 KB
/
JobsCreateExport.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
package armdatabox_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databox/armdatabox"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/databox/resource-manager/Microsoft.DataBox/stable/2022-02-01/examples/JobsCreateExport.json
func ExampleJobsClient_BeginCreate_jobsCreateExport() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armdatabox.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewJobsClient().BeginCreate(ctx, "SdkRg8091", "SdkJob6429", armdatabox.JobResource{
Location: to.Ptr("westus"),
SKU: &armdatabox.SKU{
Name: to.Ptr(armdatabox.SKUNameDataBox),
},
Properties: &armdatabox.JobProperties{
TransferType: to.Ptr(armdatabox.TransferTypeExportFromAzure),
Details: &armdatabox.JobDetails{
ContactDetails: &armdatabox.ContactDetails{
ContactName: to.Ptr("Public SDK Test"),
EmailList: []*string{
to.Ptr("testing@microsoft.com")},
Phone: to.Ptr("1234567890"),
PhoneExtension: to.Ptr("1234"),
},
DataExportDetails: []*armdatabox.DataExportDetails{
{
AccountDetails: &armdatabox.StorageAccountDetails{
DataAccountType: to.Ptr(armdatabox.DataAccountTypeStorageAccount),
StorageAccountID: to.Ptr("/subscriptions/fa68082f-8ff7-4a25-95c7-ce9da541242f/resourceGroups/akvenkat/providers/Microsoft.Storage/storageAccounts/aaaaaa2"),
},
TransferConfiguration: &armdatabox.TransferConfiguration{
TransferAllDetails: &armdatabox.TransferConfigurationTransferAllDetails{
Include: &armdatabox.TransferAllDetails{
DataAccountType: to.Ptr(armdatabox.DataAccountTypeStorageAccount),
TransferAllBlobs: to.Ptr(true),
TransferAllFiles: to.Ptr(true),
},
},
TransferConfigurationType: to.Ptr(armdatabox.TransferConfigurationTypeTransferAll),
},
}},
JobDetailsType: to.Ptr(armdatabox.ClassDiscriminatorDataBox),
ShippingAddress: &armdatabox.ShippingAddress{
AddressType: to.Ptr(armdatabox.AddressTypeCommercial),
City: to.Ptr("San Francisco"),
CompanyName: to.Ptr("Microsoft"),
Country: to.Ptr("US"),
PostalCode: to.Ptr("94107"),
StateOrProvince: to.Ptr("CA"),
StreetAddress1: to.Ptr("16 TOWNSEND ST"),
StreetAddress2: to.Ptr("Unit 1"),
},
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.JobResource = armdatabox.JobResource{
// Location: to.Ptr("westus"),
// SKU: &armdatabox.SKU{
// Name: to.Ptr(armdatabox.SKUNameDataBox),
// },
// Tags: map[string]*string{
// },
// Name: to.Ptr("SdkJob6429"),
// Type: to.Ptr("Microsoft.DataBox/jobs"),
// ID: to.Ptr("/subscriptions/fa68082f-8ff7-4a25-95c7-ce9da541242f/resourceGroups/SdkRg8091/providers/Microsoft.DataBox/jobs/SdkJob6429"),
// Properties: &armdatabox.JobProperties{
// DeliveryInfo: &armdatabox.JobDeliveryInfo{
// ScheduledDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T05:30:00+05:30"); return t}()),
// },
// DeliveryType: to.Ptr(armdatabox.JobDeliveryTypeNonScheduled),
// IsCancellable: to.Ptr(true),
// IsCancellableWithoutFee: to.Ptr(true),
// IsDeletable: to.Ptr(false),
// IsShippingAddressEditable: to.Ptr(true),
// StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-21T14:49:49.0027611+05:30"); return t}()),
// Status: to.Ptr(armdatabox.StageNameDeviceOrdered),
// TransferType: to.Ptr(armdatabox.TransferTypeExportFromAzure),
// Details: &armdatabox.JobDetails{
// ContactDetails: &armdatabox.ContactDetails{
// ContactName: to.Ptr("Public SDK Test"),
// EmailList: []*string{
// to.Ptr("testing@microsoft.com")},
// NotificationPreference: []*armdatabox.NotificationPreference{
// {
// SendNotification: to.Ptr(true),
// StageName: to.Ptr(armdatabox.NotificationStageNameDevicePrepared),
// },
// {
// SendNotification: to.Ptr(true),
// StageName: to.Ptr(armdatabox.NotificationStageNameDataCopy),
// },
// {
// SendNotification: to.Ptr(true),
// StageName: to.Ptr(armdatabox.NotificationStageNameDispatched),
// },
// {
// SendNotification: to.Ptr(true),
// StageName: to.Ptr(armdatabox.NotificationStageNameDelivered),
// },
// {
// SendNotification: to.Ptr(true),
// StageName: to.Ptr(armdatabox.NotificationStageNamePickedUp),
// },
// {
// SendNotification: to.Ptr(true),
// StageName: to.Ptr(armdatabox.NotificationStageNameAtAzureDC),
// }},
// Phone: to.Ptr("1234567890"),
// PhoneExtension: to.Ptr("1234"),
// },
// CopyLogDetails: []armdatabox.CopyLogDetailsClassification{
// },
// JobDetailsType: to.Ptr(armdatabox.ClassDiscriminatorDataBox),
// JobStages: []*armdatabox.JobStages{
// {
// DisplayName: to.Ptr("Ordered"),
// StageName: to.Ptr(armdatabox.StageNameDeviceOrdered),
// StageStatus: to.Ptr(armdatabox.StageStatusSucceeded),
// StageTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-21T14:49:52.3995743+05:30"); return t}()),
// },
// {
// DisplayName: to.Ptr("Processed"),
// StageName: to.Ptr(armdatabox.StageNameDevicePrepared),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// },
// {
// DisplayName: to.Ptr("Data copy in progress"),
// StageName: to.Ptr(armdatabox.StageNameDataCopy),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// },
// {
// DisplayName: to.Ptr("Dispatched"),
// StageName: to.Ptr(armdatabox.StageNameDispatched),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// },
// {
// DisplayName: to.Ptr("Delivered"),
// StageName: to.Ptr(armdatabox.StageNameDelivered),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// },
// {
// DisplayName: to.Ptr("Picked up"),
// StageName: to.Ptr(armdatabox.StageNamePickedUp),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// },
// {
// DisplayName: to.Ptr("Received"),
// StageName: to.Ptr(armdatabox.StageNameAtAzureDC),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// },
// {
// DisplayName: to.Ptr("Completed"),
// StageName: to.Ptr(armdatabox.StageNameCompleted),
// StageStatus: to.Ptr(armdatabox.StageStatusNone),
// }},
// ShippingAddress: &armdatabox.ShippingAddress{
// AddressType: to.Ptr(armdatabox.AddressTypeCommercial),
// City: to.Ptr("San Francisco"),
// CompanyName: to.Ptr("Microsoft"),
// Country: to.Ptr("US"),
// PostalCode: to.Ptr("94107"),
// StateOrProvince: to.Ptr("CA"),
// StreetAddress1: to.Ptr("16 TOWNSEND ST"),
// StreetAddress2: to.Ptr("Unit 1"),
// },
// CopyProgress: []*armdatabox.CopyProgress{
// },
// },
// },
// }
}