forked from Azure/azure-sdk-for-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
520 lines (473 loc) · 18.7 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
package storage
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// 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"
"net/http"
)
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2015-06-15/storage"
// AccountStatus enumerates the values for account status.
type AccountStatus string
const (
// Available ...
Available AccountStatus = "Available"
// Unavailable ...
Unavailable AccountStatus = "Unavailable"
)
// PossibleAccountStatusValues returns an array of possible values for the AccountStatus const type.
func PossibleAccountStatusValues() []AccountStatus {
return []AccountStatus{Available, Unavailable}
}
// AccountType enumerates the values for account type.
type AccountType string
const (
// PremiumLRS ...
PremiumLRS AccountType = "Premium_LRS"
// StandardGRS ...
StandardGRS AccountType = "Standard_GRS"
// StandardLRS ...
StandardLRS AccountType = "Standard_LRS"
// StandardRAGRS ...
StandardRAGRS AccountType = "Standard_RAGRS"
// StandardZRS ...
StandardZRS AccountType = "Standard_ZRS"
)
// PossibleAccountTypeValues returns an array of possible values for the AccountType const type.
func PossibleAccountTypeValues() []AccountType {
return []AccountType{PremiumLRS, StandardGRS, StandardLRS, StandardRAGRS, StandardZRS}
}
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Creating ...
Creating ProvisioningState = "Creating"
// ResolvingDNS ...
ResolvingDNS ProvisioningState = "ResolvingDNS"
// Succeeded ...
Succeeded ProvisioningState = "Succeeded"
)
// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{Creating, ResolvingDNS, Succeeded}
}
// Reason enumerates the values for reason.
type Reason string
const (
// AccountNameInvalid ...
AccountNameInvalid Reason = "AccountNameInvalid"
// AlreadyExists ...
AlreadyExists Reason = "AlreadyExists"
)
// PossibleReasonValues returns an array of possible values for the Reason const type.
func PossibleReasonValues() []Reason {
return []Reason{AccountNameInvalid, AlreadyExists}
}
// UsageUnit enumerates the values for usage unit.
type UsageUnit string
const (
// Bytes ...
Bytes UsageUnit = "Bytes"
// BytesPerSecond ...
BytesPerSecond UsageUnit = "BytesPerSecond"
// Count ...
Count UsageUnit = "Count"
// CountsPerSecond ...
CountsPerSecond UsageUnit = "CountsPerSecond"
// Percent ...
Percent UsageUnit = "Percent"
// Seconds ...
Seconds UsageUnit = "Seconds"
)
// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type.
func PossibleUsageUnitValues() []UsageUnit {
return []UsageUnit{Bytes, BytesPerSecond, Count, CountsPerSecond, Percent, Seconds}
}
// Account the storage account.
type Account struct {
autorest.Response `json:"-"`
*AccountProperties `json:"properties,omitempty"`
// ID - READ-ONLY; Resource Id
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Account.
func (a Account) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if a.AccountProperties != nil {
objectMap["properties"] = a.AccountProperties
}
if a.Location != nil {
objectMap["location"] = a.Location
}
if a.Tags != nil {
objectMap["tags"] = a.Tags
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for Account struct.
func (a *Account) 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 accountProperties AccountProperties
err = json.Unmarshal(*v, &accountProperties)
if err != nil {
return err
}
a.AccountProperties = &accountProperties
}
case "id":
if v != nil {
var ID string
err = json.Unmarshal(*v, &ID)
if err != nil {
return err
}
a.ID = &ID
}
case "name":
if v != nil {
var name string
err = json.Unmarshal(*v, &name)
if err != nil {
return err
}
a.Name = &name
}
case "type":
if v != nil {
var typeVar string
err = json.Unmarshal(*v, &typeVar)
if err != nil {
return err
}
a.Type = &typeVar
}
case "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
a.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
a.Tags = tags
}
}
}
return nil
}
// AccountCheckNameAvailabilityParameters the parameters used to check the availability of the storage
// account name.
type AccountCheckNameAvailabilityParameters struct {
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
}
// AccountCreateParameters the parameters to provide for the account.
type AccountCreateParameters struct {
// Location - The location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed.
Location *string `json:"location,omitempty"`
// Tags - A list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters.
Tags map[string]*string `json:"tags"`
*AccountPropertiesCreateParameters `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountCreateParameters.
func (acp AccountCreateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if acp.Location != nil {
objectMap["location"] = acp.Location
}
if acp.Tags != nil {
objectMap["tags"] = acp.Tags
}
if acp.AccountPropertiesCreateParameters != nil {
objectMap["properties"] = acp.AccountPropertiesCreateParameters
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AccountCreateParameters struct.
func (acp *AccountCreateParameters) 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 "location":
if v != nil {
var location string
err = json.Unmarshal(*v, &location)
if err != nil {
return err
}
acp.Location = &location
}
case "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
acp.Tags = tags
}
case "properties":
if v != nil {
var accountPropertiesCreateParameters AccountPropertiesCreateParameters
err = json.Unmarshal(*v, &accountPropertiesCreateParameters)
if err != nil {
return err
}
acp.AccountPropertiesCreateParameters = &accountPropertiesCreateParameters
}
}
}
return nil
}
// AccountKeys the access keys for the storage account.
type AccountKeys struct {
autorest.Response `json:"-"`
// Key1 - The value of key 1.
Key1 *string `json:"key1,omitempty"`
// Key2 - The value of key 2.
Key2 *string `json:"key2,omitempty"`
}
// AccountListResult the list storage accounts operation response.
type AccountListResult struct {
autorest.Response `json:"-"`
// Value - The list of storage accounts and their properties.
Value *[]Account `json:"value,omitempty"`
}
// AccountProperties properties of the storage account.
type AccountProperties struct {
// ProvisioningState - The status of the storage account at the time the operation was called. Possible values include: 'Creating', 'ResolvingDNS', 'Succeeded'
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
// AccountType - The type of the storage account. Possible values include: 'StandardLRS', 'StandardZRS', 'StandardGRS', 'StandardRAGRS', 'PremiumLRS'
AccountType AccountType `json:"accountType,omitempty"`
// PrimaryEndpoints - The URLs that are used to perform a retrieval of a public blob, queue, or table object. Note that Standard_ZRS and Premium_LRS accounts only return the blob endpoint.
PrimaryEndpoints *Endpoints `json:"primaryEndpoints,omitempty"`
// PrimaryLocation - The location of the primary data center for the storage account.
PrimaryLocation *string `json:"primaryLocation,omitempty"`
// StatusOfPrimary - The status indicating whether the primary location of the storage account is available or unavailable. Possible values include: 'Available', 'Unavailable'
StatusOfPrimary AccountStatus `json:"statusOfPrimary,omitempty"`
// LastGeoFailoverTime - The timestamp of the most recent instance of a failover to the secondary location. Only the most recent timestamp is retained. This element is not returned if there has never been a failover instance. Only available if the accountType is Standard_GRS or Standard_RAGRS.
LastGeoFailoverTime *date.Time `json:"lastGeoFailoverTime,omitempty"`
// SecondaryLocation - The location of the geo-replicated secondary for the storage account. Only available if the accountType is Standard_GRS or Standard_RAGRS.
SecondaryLocation *string `json:"secondaryLocation,omitempty"`
// StatusOfSecondary - The status indicating whether the secondary location of the storage account is available or unavailable. Only available if the SKU name is Standard_GRS or Standard_RAGRS. Possible values include: 'Available', 'Unavailable'
StatusOfSecondary AccountStatus `json:"statusOfSecondary,omitempty"`
// CreationTime - The creation date and time of the storage account in UTC.
CreationTime *date.Time `json:"creationTime,omitempty"`
// CustomDomain - The custom domain the user assigned to this storage account.
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
// SecondaryEndpoints - The URLs that are used to perform a retrieval of a public blob, queue, or table object from the secondary location of the storage account. Only available if the SKU name is Standard_RAGRS.
SecondaryEndpoints *Endpoints `json:"secondaryEndpoints,omitempty"`
}
// AccountPropertiesCreateParameters the parameters used to create the storage account.
type AccountPropertiesCreateParameters struct {
// AccountType - The sku name. Required for account creation; optional for update. Note that in older versions, sku name was called accountType. Possible values include: 'StandardLRS', 'StandardZRS', 'StandardGRS', 'StandardRAGRS', 'PremiumLRS'
AccountType AccountType `json:"accountType,omitempty"`
}
// AccountPropertiesUpdateParameters the parameters used when updating a storage account.
type AccountPropertiesUpdateParameters struct {
// AccountType - The account type. Note that StandardZRS and PremiumLRS accounts cannot be changed to other account types, and other account types cannot be changed to StandardZRS or PremiumLRS. Possible values include: 'StandardLRS', 'StandardZRS', 'StandardGRS', 'StandardRAGRS', 'PremiumLRS'
AccountType AccountType `json:"accountType,omitempty"`
// CustomDomain - User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property.
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
}
// AccountRegenerateKeyParameters the parameters used to regenerate the storage account key.
type AccountRegenerateKeyParameters struct {
KeyName *string `json:"keyName,omitempty"`
}
// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type AccountsCreateFuture struct {
azure.Future
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func (future *AccountsCreateFuture) Result(client AccountsClient) (a Account, err error) {
var done bool
done, err = future.DoneWithContext(context.Background(), client)
if err != nil {
err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", future.Response(), "Polling failure")
return
}
if !done {
err = azure.NewAsyncOpIncompleteError("storage.AccountsCreateFuture")
return
}
sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent {
a, err = client.CreateResponder(a.Response.Response)
if err != nil {
err = autorest.NewErrorWithError(err, "storage.AccountsCreateFuture", "Result", a.Response.Response, "Failure responding to request")
}
}
return
}
// AccountUpdateParameters the parameters to update on the account.
type AccountUpdateParameters struct {
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
*AccountPropertiesUpdateParameters `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for AccountUpdateParameters.
func (aup AccountUpdateParameters) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if aup.Tags != nil {
objectMap["tags"] = aup.Tags
}
if aup.AccountPropertiesUpdateParameters != nil {
objectMap["properties"] = aup.AccountPropertiesUpdateParameters
}
return json.Marshal(objectMap)
}
// UnmarshalJSON is the custom unmarshaler for AccountUpdateParameters struct.
func (aup *AccountUpdateParameters) 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 "tags":
if v != nil {
var tags map[string]*string
err = json.Unmarshal(*v, &tags)
if err != nil {
return err
}
aup.Tags = tags
}
case "properties":
if v != nil {
var accountPropertiesUpdateParameters AccountPropertiesUpdateParameters
err = json.Unmarshal(*v, &accountPropertiesUpdateParameters)
if err != nil {
return err
}
aup.AccountPropertiesUpdateParameters = &accountPropertiesUpdateParameters
}
}
}
return nil
}
// CheckNameAvailabilityResult the CheckNameAvailability operation response.
type CheckNameAvailabilityResult struct {
autorest.Response `json:"-"`
// NameAvailable - Boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or is invalid and cannot be used.
NameAvailable *bool `json:"nameAvailable,omitempty"`
// Reason - The reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', 'AlreadyExists'
Reason Reason `json:"reason,omitempty"`
// Message - The error message explaining the Reason value in more detail.
Message *string `json:"message,omitempty"`
}
// CustomDomain the custom domain assigned to this storage account. This can be set via Update.
type CustomDomain struct {
// Name - The custom domain name. Name is the CNAME source.
Name *string `json:"name,omitempty"`
// UseSubDomainName - Indicates whether indirect CName validation is enabled. Default value is false. This should only be set on updates
UseSubDomainName *bool `json:"useSubDomainName,omitempty"`
}
// Endpoints the URIs that are used to perform a retrieval of a public blob, queue or table object.
type Endpoints struct {
// Blob - The blob endpoint.
Blob *string `json:"blob,omitempty"`
// Queue - The queue endpoint.
Queue *string `json:"queue,omitempty"`
// Table - The table endpoint.
Table *string `json:"table,omitempty"`
// File - The file endpoint.
File *string `json:"file,omitempty"`
}
// Resource describes a storage resource.
type Resource struct {
// ID - READ-ONLY; Resource Id
ID *string `json:"id,omitempty"`
// Name - READ-ONLY; Resource name
Name *string `json:"name,omitempty"`
// Type - READ-ONLY; Resource type
Type *string `json:"type,omitempty"`
// Location - Resource location
Location *string `json:"location,omitempty"`
// Tags - Resource tags
Tags map[string]*string `json:"tags"`
}
// MarshalJSON is the custom marshaler for Resource.
func (r Resource) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if r.Location != nil {
objectMap["location"] = r.Location
}
if r.Tags != nil {
objectMap["tags"] = r.Tags
}
return json.Marshal(objectMap)
}
// Usage describes Storage Resource Usage.
type Usage struct {
// Unit - The unit of measurement. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond', 'BytesPerSecond'
Unit UsageUnit `json:"unit,omitempty"`
// CurrentValue - The current count of the allocated resources in the subscription.
CurrentValue *int32 `json:"currentValue,omitempty"`
// Limit - The maximum count of the resources that can be allocated in the subscription.
Limit *int32 `json:"limit,omitempty"`
// Name - The name of the type of usage.
Name *UsageName `json:"name,omitempty"`
}
// UsageListResult the List Usages operation response.
type UsageListResult struct {
autorest.Response `json:"-"`
// Value - The list Storage Resource Usages.
Value *[]Usage `json:"value,omitempty"`
}
// UsageName the Usage Names.
type UsageName struct {
// Value - A string describing the resource name.
Value *string `json:"value,omitempty"`
// LocalizedValue - A localized string describing the resource name.
LocalizedValue *string `json:"localizedValue,omitempty"`
}