1package databox 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "encoding/json" 23 "github.com/Azure/go-autorest/autorest" 24 "github.com/Azure/go-autorest/autorest/azure" 25 "github.com/Azure/go-autorest/autorest/date" 26 "github.com/Azure/go-autorest/autorest/to" 27 "github.com/Azure/go-autorest/tracing" 28 "net/http" 29) 30 31// The package's fully qualified name. 32const fqdn = "github.com/Azure/azure-sdk-for-go/services/databox/mgmt/2018-01-01/databox" 33 34// AccessProtocol enumerates the values for access protocol. 35type AccessProtocol string 36 37const ( 38 // NFS Network File System protocol(NFS). 39 NFS AccessProtocol = "NFS" 40 // SMB Server Message Block protocol(SMB). 41 SMB AccessProtocol = "SMB" 42) 43 44// PossibleAccessProtocolValues returns an array of possible values for the AccessProtocol const type. 45func PossibleAccessProtocolValues() []AccessProtocol { 46 return []AccessProtocol{NFS, SMB} 47} 48 49// AddressType enumerates the values for address type. 50type AddressType string 51 52const ( 53 // Commercial Commercial Address. 54 Commercial AddressType = "Commercial" 55 // None Address type not known. 56 None AddressType = "None" 57 // Residential Residential Address. 58 Residential AddressType = "Residential" 59) 60 61// PossibleAddressTypeValues returns an array of possible values for the AddressType const type. 62func PossibleAddressTypeValues() []AddressType { 63 return []AddressType{Commercial, None, Residential} 64} 65 66// AddressValidationStatus enumerates the values for address validation status. 67type AddressValidationStatus string 68 69const ( 70 // Ambiguous Address provided is ambiguous, please choose one of the alternate addresses returned. 71 Ambiguous AddressValidationStatus = "Ambiguous" 72 // Invalid Address provided is invalid or not supported. 73 Invalid AddressValidationStatus = "Invalid" 74 // Valid Address provided is valid. 75 Valid AddressValidationStatus = "Valid" 76) 77 78// PossibleAddressValidationStatusValues returns an array of possible values for the AddressValidationStatus const type. 79func PossibleAddressValidationStatusValues() []AddressValidationStatus { 80 return []AddressValidationStatus{Ambiguous, Invalid, Valid} 81} 82 83// CopyLogDetailsType enumerates the values for copy log details type. 84type CopyLogDetailsType string 85 86const ( 87 // CopyLogDetailsTypeCopyLogDetails ... 88 CopyLogDetailsTypeCopyLogDetails CopyLogDetailsType = "CopyLogDetails" 89 // CopyLogDetailsTypeDataBox ... 90 CopyLogDetailsTypeDataBox CopyLogDetailsType = "DataBox" 91 // CopyLogDetailsTypeDataBoxDisk ... 92 CopyLogDetailsTypeDataBoxDisk CopyLogDetailsType = "DataBoxDisk" 93 // CopyLogDetailsTypeDataBoxHeavy ... 94 CopyLogDetailsTypeDataBoxHeavy CopyLogDetailsType = "DataBoxHeavy" 95) 96 97// PossibleCopyLogDetailsTypeValues returns an array of possible values for the CopyLogDetailsType const type. 98func PossibleCopyLogDetailsTypeValues() []CopyLogDetailsType { 99 return []CopyLogDetailsType{CopyLogDetailsTypeCopyLogDetails, CopyLogDetailsTypeDataBox, CopyLogDetailsTypeDataBoxDisk, CopyLogDetailsTypeDataBoxHeavy} 100} 101 102// CopyStatus enumerates the values for copy status. 103type CopyStatus string 104 105const ( 106 // Completed Data copy completed. 107 Completed CopyStatus = "Completed" 108 // CompletedWithErrors Data copy completed with errors. 109 CompletedWithErrors CopyStatus = "CompletedWithErrors" 110 // Failed Data copy failed. No data was copied. 111 Failed CopyStatus = "Failed" 112 // InProgress Data copy is in progress. 113 InProgress CopyStatus = "InProgress" 114 // NotReturned No copy triggered as device was not returned. 115 NotReturned CopyStatus = "NotReturned" 116 // NotStarted Data copy hasn't started yet. 117 NotStarted CopyStatus = "NotStarted" 118) 119 120// PossibleCopyStatusValues returns an array of possible values for the CopyStatus const type. 121func PossibleCopyStatusValues() []CopyStatus { 122 return []CopyStatus{Completed, CompletedWithErrors, Failed, InProgress, NotReturned, NotStarted} 123} 124 125// DataDestinationType enumerates the values for data destination type. 126type DataDestinationType string 127 128const ( 129 // DataDestinationTypeDestinationAccountDetails ... 130 DataDestinationTypeDestinationAccountDetails DataDestinationType = "DestinationAccountDetails" 131 // DataDestinationTypeManagedDisk ... 132 DataDestinationTypeManagedDisk DataDestinationType = "ManagedDisk" 133 // DataDestinationTypeStorageAccount ... 134 DataDestinationTypeStorageAccount DataDestinationType = "StorageAccount" 135) 136 137// PossibleDataDestinationTypeValues returns an array of possible values for the DataDestinationType const type. 138func PossibleDataDestinationTypeValues() []DataDestinationType { 139 return []DataDestinationType{DataDestinationTypeDestinationAccountDetails, DataDestinationTypeManagedDisk, DataDestinationTypeStorageAccount} 140} 141 142// JobDetailsTypeEnum enumerates the values for job details type enum. 143type JobDetailsTypeEnum string 144 145const ( 146 // JobDetailsTypeDataBox ... 147 JobDetailsTypeDataBox JobDetailsTypeEnum = "DataBox" 148 // JobDetailsTypeDataBoxDisk ... 149 JobDetailsTypeDataBoxDisk JobDetailsTypeEnum = "DataBoxDisk" 150 // JobDetailsTypeDataBoxHeavy ... 151 JobDetailsTypeDataBoxHeavy JobDetailsTypeEnum = "DataBoxHeavy" 152 // JobDetailsTypeJobDetails ... 153 JobDetailsTypeJobDetails JobDetailsTypeEnum = "JobDetails" 154) 155 156// PossibleJobDetailsTypeEnumValues returns an array of possible values for the JobDetailsTypeEnum const type. 157func PossibleJobDetailsTypeEnumValues() []JobDetailsTypeEnum { 158 return []JobDetailsTypeEnum{JobDetailsTypeDataBox, JobDetailsTypeDataBoxDisk, JobDetailsTypeDataBoxHeavy, JobDetailsTypeJobDetails} 159} 160 161// JobSecretsTypeEnum enumerates the values for job secrets type enum. 162type JobSecretsTypeEnum string 163 164const ( 165 // JobSecretsTypeDataBox ... 166 JobSecretsTypeDataBox JobSecretsTypeEnum = "DataBox" 167 // JobSecretsTypeDataBoxDisk ... 168 JobSecretsTypeDataBoxDisk JobSecretsTypeEnum = "DataBoxDisk" 169 // JobSecretsTypeDataBoxHeavy ... 170 JobSecretsTypeDataBoxHeavy JobSecretsTypeEnum = "DataBoxHeavy" 171 // JobSecretsTypeJobSecrets ... 172 JobSecretsTypeJobSecrets JobSecretsTypeEnum = "JobSecrets" 173) 174 175// PossibleJobSecretsTypeEnumValues returns an array of possible values for the JobSecretsTypeEnum const type. 176func PossibleJobSecretsTypeEnumValues() []JobSecretsTypeEnum { 177 return []JobSecretsTypeEnum{JobSecretsTypeDataBox, JobSecretsTypeDataBoxDisk, JobSecretsTypeDataBoxHeavy, JobSecretsTypeJobSecrets} 178} 179 180// NotificationStageName enumerates the values for notification stage name. 181type NotificationStageName string 182 183const ( 184 // AtAzureDC Notification at device received at azure datacenter stage. 185 AtAzureDC NotificationStageName = "AtAzureDC" 186 // DataCopy Notification at data copy started stage. 187 DataCopy NotificationStageName = "DataCopy" 188 // Delivered Notification at device delivered stage. 189 Delivered NotificationStageName = "Delivered" 190 // DevicePrepared Notification at device prepared stage. 191 DevicePrepared NotificationStageName = "DevicePrepared" 192 // Dispatched Notification at device dispatched stage. 193 Dispatched NotificationStageName = "Dispatched" 194 // PickedUp Notification at device picked up from user stage. 195 PickedUp NotificationStageName = "PickedUp" 196) 197 198// PossibleNotificationStageNameValues returns an array of possible values for the NotificationStageName const type. 199func PossibleNotificationStageNameValues() []NotificationStageName { 200 return []NotificationStageName{AtAzureDC, DataCopy, Delivered, DevicePrepared, Dispatched, PickedUp} 201} 202 203// ShareDestinationFormatType enumerates the values for share destination format type. 204type ShareDestinationFormatType string 205 206const ( 207 // AzureFile Azure storage file format. 208 AzureFile ShareDestinationFormatType = "AzureFile" 209 // BlockBlob Azure storage block blob format. 210 BlockBlob ShareDestinationFormatType = "BlockBlob" 211 // HCS StorSimple data format. 212 HCS ShareDestinationFormatType = "HCS" 213 // ManagedDisk Azure Compute Disk. 214 ManagedDisk ShareDestinationFormatType = "ManagedDisk" 215 // PageBlob Azure storage page blob format. 216 PageBlob ShareDestinationFormatType = "PageBlob" 217 // UnknownType Unknown format. 218 UnknownType ShareDestinationFormatType = "UnknownType" 219) 220 221// PossibleShareDestinationFormatTypeValues returns an array of possible values for the ShareDestinationFormatType const type. 222func PossibleShareDestinationFormatTypeValues() []ShareDestinationFormatType { 223 return []ShareDestinationFormatType{AzureFile, BlockBlob, HCS, ManagedDisk, PageBlob, UnknownType} 224} 225 226// SkuDisabledReason enumerates the values for sku disabled reason. 227type SkuDisabledReason string 228 229const ( 230 // SkuDisabledReasonCountry SKU is not available in the requested country. 231 SkuDisabledReasonCountry SkuDisabledReason = "Country" 232 // SkuDisabledReasonFeature Required features are not enabled for the SKU. 233 SkuDisabledReasonFeature SkuDisabledReason = "Feature" 234 // SkuDisabledReasonNone SKU is not disabled. 235 SkuDisabledReasonNone SkuDisabledReason = "None" 236 // SkuDisabledReasonNoSubscriptionInfo Subscription has not registered to Microsoft.DataBox and Service 237 // does not have the subscription notification. 238 SkuDisabledReasonNoSubscriptionInfo SkuDisabledReason = "NoSubscriptionInfo" 239 // SkuDisabledReasonOfferType Subscription does not have required offer types for the SKU. 240 SkuDisabledReasonOfferType SkuDisabledReason = "OfferType" 241 // SkuDisabledReasonRegion SKU is not available to push data to the requested Azure region. 242 SkuDisabledReasonRegion SkuDisabledReason = "Region" 243) 244 245// PossibleSkuDisabledReasonValues returns an array of possible values for the SkuDisabledReason const type. 246func PossibleSkuDisabledReasonValues() []SkuDisabledReason { 247 return []SkuDisabledReason{SkuDisabledReasonCountry, SkuDisabledReasonFeature, SkuDisabledReasonNone, SkuDisabledReasonNoSubscriptionInfo, SkuDisabledReasonOfferType, SkuDisabledReasonRegion} 248} 249 250// SkuName enumerates the values for sku name. 251type SkuName string 252 253const ( 254 // DataBox DataBox. 255 DataBox SkuName = "DataBox" 256 // DataBoxDisk DataBoxDisk. 257 DataBoxDisk SkuName = "DataBoxDisk" 258 // DataBoxHeavy DataBoxHeavy. 259 DataBoxHeavy SkuName = "DataBoxHeavy" 260) 261 262// PossibleSkuNameValues returns an array of possible values for the SkuName const type. 263func PossibleSkuNameValues() []SkuName { 264 return []SkuName{DataBox, DataBoxDisk, DataBoxHeavy} 265} 266 267// StageName enumerates the values for stage name. 268type StageName string 269 270const ( 271 // StageNameAborted Order has been aborted. 272 StageNameAborted StageName = "Aborted" 273 // StageNameAtAzureDC Device has been received at azure datacenter from the user. 274 StageNameAtAzureDC StageName = "AtAzureDC" 275 // StageNameCancelled Order has been cancelled. 276 StageNameCancelled StageName = "Cancelled" 277 // StageNameCompleted Order has completed. 278 StageNameCompleted StageName = "Completed" 279 // StageNameCompletedWithErrors Order has completed with errors. 280 StageNameCompletedWithErrors StageName = "CompletedWithErrors" 281 // StageNameDataCopy Data copy from the device at azure datacenter. 282 StageNameDataCopy StageName = "DataCopy" 283 // StageNameDelivered Device has been delivered to the user of the order. 284 StageNameDelivered StageName = "Delivered" 285 // StageNameDeviceOrdered An order has been created. 286 StageNameDeviceOrdered StageName = "DeviceOrdered" 287 // StageNameDevicePrepared A device has been prepared for the order. 288 StageNameDevicePrepared StageName = "DevicePrepared" 289 // StageNameDispatched Device has been dispatched to the user of the order. 290 StageNameDispatched StageName = "Dispatched" 291 // StageNameFailedIssueDetectedAtAzureDC Order has failed due to issue detected at azure datacenter. 292 StageNameFailedIssueDetectedAtAzureDC StageName = "Failed_IssueDetectedAtAzureDC" 293 // StageNameFailedIssueReportedAtCustomer Order has failed due to issue reported by user. 294 StageNameFailedIssueReportedAtCustomer StageName = "Failed_IssueReportedAtCustomer" 295 // StageNamePickedUp Device has been picked up from user and in transit to azure datacenter. 296 StageNamePickedUp StageName = "PickedUp" 297) 298 299// PossibleStageNameValues returns an array of possible values for the StageName const type. 300func PossibleStageNameValues() []StageName { 301 return []StageName{StageNameAborted, StageNameAtAzureDC, StageNameCancelled, StageNameCompleted, StageNameCompletedWithErrors, StageNameDataCopy, StageNameDelivered, StageNameDeviceOrdered, StageNameDevicePrepared, StageNameDispatched, StageNameFailedIssueDetectedAtAzureDC, StageNameFailedIssueReportedAtCustomer, StageNamePickedUp} 302} 303 304// StageStatus enumerates the values for stage status. 305type StageStatus string 306 307const ( 308 // StageStatusCancelled Stage has been cancelled. 309 StageStatusCancelled StageStatus = "Cancelled" 310 // StageStatusCancelling Stage is cancelling. 311 StageStatusCancelling StageStatus = "Cancelling" 312 // StageStatusFailed Stage has failed. 313 StageStatusFailed StageStatus = "Failed" 314 // StageStatusInProgress Stage is in progress. 315 StageStatusInProgress StageStatus = "InProgress" 316 // StageStatusNone No status available yet. 317 StageStatusNone StageStatus = "None" 318 // StageStatusSucceeded Stage has succeeded. 319 StageStatusSucceeded StageStatus = "Succeeded" 320 // StageStatusSucceededWithErrors Stage has succeeded with errors. 321 StageStatusSucceededWithErrors StageStatus = "SucceededWithErrors" 322) 323 324// PossibleStageStatusValues returns an array of possible values for the StageStatus const type. 325func PossibleStageStatusValues() []StageStatus { 326 return []StageStatus{StageStatusCancelled, StageStatusCancelling, StageStatusFailed, StageStatusInProgress, StageStatusNone, StageStatusSucceeded, StageStatusSucceededWithErrors} 327} 328 329// AccountCopyLogDetails copy log details for a storage account of a DataBox job 330type AccountCopyLogDetails struct { 331 // AccountName - READ-ONLY; Destination account name. 332 AccountName *string `json:"accountName,omitempty"` 333 // CopyLogLink - READ-ONLY; Link for copy logs. 334 CopyLogLink *string `json:"copyLogLink,omitempty"` 335 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy' 336 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 337} 338 339// MarshalJSON is the custom marshaler for AccountCopyLogDetails. 340func (acld AccountCopyLogDetails) MarshalJSON() ([]byte, error) { 341 acld.CopyLogDetailsType = CopyLogDetailsTypeDataBox 342 objectMap := make(map[string]interface{}) 343 if acld.CopyLogDetailsType != "" { 344 objectMap["copyLogDetailsType"] = acld.CopyLogDetailsType 345 } 346 return json.Marshal(objectMap) 347} 348 349// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 350func (acld AccountCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 351 return &acld, true 352} 353 354// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 355func (acld AccountCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 356 return nil, false 357} 358 359// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 360func (acld AccountCopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) { 361 return nil, false 362} 363 364// AsCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 365func (acld AccountCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 366 return nil, false 367} 368 369// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 370func (acld AccountCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 371 return &acld, true 372} 373 374// AccountCredentialDetails credential details of the account. 375type AccountCredentialDetails struct { 376 // AccountName - READ-ONLY; Name of the account. 377 AccountName *string `json:"accountName,omitempty"` 378 // AccountConnectionString - READ-ONLY; Connection string of the account endpoint to use the account as a storage endpoint on the device. 379 AccountConnectionString *string `json:"accountConnectionString,omitempty"` 380 // ShareCredentialDetails - READ-ONLY; Per share level unencrypted access credentials. 381 ShareCredentialDetails *[]ShareCredentialDetails `json:"shareCredentialDetails,omitempty"` 382} 383 384// AddressValidationOutput output of the address validation api. 385type AddressValidationOutput struct { 386 autorest.Response `json:"-"` 387 // AddressValidationProperties - READ-ONLY; The address validation properties. 388 *AddressValidationProperties `json:"properties,omitempty"` 389} 390 391// MarshalJSON is the custom marshaler for AddressValidationOutput. 392func (avo AddressValidationOutput) MarshalJSON() ([]byte, error) { 393 objectMap := make(map[string]interface{}) 394 return json.Marshal(objectMap) 395} 396 397// UnmarshalJSON is the custom unmarshaler for AddressValidationOutput struct. 398func (avo *AddressValidationOutput) UnmarshalJSON(body []byte) error { 399 var m map[string]*json.RawMessage 400 err := json.Unmarshal(body, &m) 401 if err != nil { 402 return err 403 } 404 for k, v := range m { 405 switch k { 406 case "properties": 407 if v != nil { 408 var addressValidationProperties AddressValidationProperties 409 err = json.Unmarshal(*v, &addressValidationProperties) 410 if err != nil { 411 return err 412 } 413 avo.AddressValidationProperties = &addressValidationProperties 414 } 415 } 416 } 417 418 return nil 419} 420 421// AddressValidationProperties the address validation output. 422type AddressValidationProperties struct { 423 // ValidationStatus - READ-ONLY; The address validation status. Possible values include: 'Valid', 'Invalid', 'Ambiguous' 424 ValidationStatus AddressValidationStatus `json:"validationStatus,omitempty"` 425 // AlternateAddresses - READ-ONLY; List of alternate addresses. 426 AlternateAddresses *[]ShippingAddress `json:"alternateAddresses,omitempty"` 427} 428 429// ApplianceNetworkConfiguration the Network Adapter configuration of a DataBox. 430type ApplianceNetworkConfiguration struct { 431 // Name - READ-ONLY; Name of the network. 432 Name *string `json:"name,omitempty"` 433 // MacAddress - READ-ONLY; Mac Address. 434 MacAddress *string `json:"macAddress,omitempty"` 435} 436 437// ArmBaseObject base class for all objects under resource. 438type ArmBaseObject struct { 439 // Name - READ-ONLY; Name of the object. 440 Name *string `json:"name,omitempty"` 441 // ID - READ-ONLY; Id of the object. 442 ID *string `json:"id,omitempty"` 443 // Type - READ-ONLY; Type of the object. 444 Type *string `json:"type,omitempty"` 445} 446 447// AvailableSkuRequest the filters for showing the available skus. 448type AvailableSkuRequest struct { 449 // TransferType - Type of the transfer. 450 TransferType *string `json:"transferType,omitempty"` 451 // 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 452 Country *string `json:"country,omitempty"` 453 // Location - Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 454 Location *string `json:"location,omitempty"` 455 // SkuNames - Sku Names to filter for available skus 456 SkuNames *[]SkuName `json:"skuNames,omitempty"` 457} 458 459// AvailableSkusResult the available skus operation response. 460type AvailableSkusResult struct { 461 autorest.Response `json:"-"` 462 // Value - READ-ONLY; List of available skus. 463 Value *[]SkuInformation `json:"value,omitempty"` 464 // NextLink - Link for the next set of skus. 465 NextLink *string `json:"nextLink,omitempty"` 466} 467 468// AvailableSkusResultIterator provides access to a complete listing of SkuInformation values. 469type AvailableSkusResultIterator struct { 470 i int 471 page AvailableSkusResultPage 472} 473 474// NextWithContext advances to the next value. If there was an error making 475// the request the iterator does not advance and the error is returned. 476func (iter *AvailableSkusResultIterator) NextWithContext(ctx context.Context) (err error) { 477 if tracing.IsEnabled() { 478 ctx = tracing.StartSpan(ctx, fqdn+"/AvailableSkusResultIterator.NextWithContext") 479 defer func() { 480 sc := -1 481 if iter.Response().Response.Response != nil { 482 sc = iter.Response().Response.Response.StatusCode 483 } 484 tracing.EndSpan(ctx, sc, err) 485 }() 486 } 487 iter.i++ 488 if iter.i < len(iter.page.Values()) { 489 return nil 490 } 491 err = iter.page.NextWithContext(ctx) 492 if err != nil { 493 iter.i-- 494 return err 495 } 496 iter.i = 0 497 return nil 498} 499 500// Next advances to the next value. If there was an error making 501// the request the iterator does not advance and the error is returned. 502// Deprecated: Use NextWithContext() instead. 503func (iter *AvailableSkusResultIterator) Next() error { 504 return iter.NextWithContext(context.Background()) 505} 506 507// NotDone returns true if the enumeration should be started or is not yet complete. 508func (iter AvailableSkusResultIterator) NotDone() bool { 509 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 510} 511 512// Response returns the raw server response from the last page request. 513func (iter AvailableSkusResultIterator) Response() AvailableSkusResult { 514 return iter.page.Response() 515} 516 517// Value returns the current value or a zero-initialized value if the 518// iterator has advanced beyond the end of the collection. 519func (iter AvailableSkusResultIterator) Value() SkuInformation { 520 if !iter.page.NotDone() { 521 return SkuInformation{} 522 } 523 return iter.page.Values()[iter.i] 524} 525 526// Creates a new instance of the AvailableSkusResultIterator type. 527func NewAvailableSkusResultIterator(page AvailableSkusResultPage) AvailableSkusResultIterator { 528 return AvailableSkusResultIterator{page: page} 529} 530 531// IsEmpty returns true if the ListResult contains no values. 532func (asr AvailableSkusResult) IsEmpty() bool { 533 return asr.Value == nil || len(*asr.Value) == 0 534} 535 536// availableSkusResultPreparer prepares a request to retrieve the next set of results. 537// It returns nil if no more results exist. 538func (asr AvailableSkusResult) availableSkusResultPreparer(ctx context.Context) (*http.Request, error) { 539 if asr.NextLink == nil || len(to.String(asr.NextLink)) < 1 { 540 return nil, nil 541 } 542 return autorest.Prepare((&http.Request{}).WithContext(ctx), 543 autorest.AsJSON(), 544 autorest.AsGet(), 545 autorest.WithBaseURL(to.String(asr.NextLink))) 546} 547 548// AvailableSkusResultPage contains a page of SkuInformation values. 549type AvailableSkusResultPage struct { 550 fn func(context.Context, AvailableSkusResult) (AvailableSkusResult, error) 551 asr AvailableSkusResult 552} 553 554// NextWithContext advances to the next page of values. If there was an error making 555// the request the page does not advance and the error is returned. 556func (page *AvailableSkusResultPage) NextWithContext(ctx context.Context) (err error) { 557 if tracing.IsEnabled() { 558 ctx = tracing.StartSpan(ctx, fqdn+"/AvailableSkusResultPage.NextWithContext") 559 defer func() { 560 sc := -1 561 if page.Response().Response.Response != nil { 562 sc = page.Response().Response.Response.StatusCode 563 } 564 tracing.EndSpan(ctx, sc, err) 565 }() 566 } 567 next, err := page.fn(ctx, page.asr) 568 if err != nil { 569 return err 570 } 571 page.asr = next 572 return nil 573} 574 575// Next advances to the next page of values. If there was an error making 576// the request the page does not advance and the error is returned. 577// Deprecated: Use NextWithContext() instead. 578func (page *AvailableSkusResultPage) Next() error { 579 return page.NextWithContext(context.Background()) 580} 581 582// NotDone returns true if the page enumeration should be started or is not yet complete. 583func (page AvailableSkusResultPage) NotDone() bool { 584 return !page.asr.IsEmpty() 585} 586 587// Response returns the raw server response from the last page request. 588func (page AvailableSkusResultPage) Response() AvailableSkusResult { 589 return page.asr 590} 591 592// Values returns the slice of values for the current page or nil if there are no values. 593func (page AvailableSkusResultPage) Values() []SkuInformation { 594 if page.asr.IsEmpty() { 595 return nil 596 } 597 return *page.asr.Value 598} 599 600// Creates a new instance of the AvailableSkusResultPage type. 601func NewAvailableSkusResultPage(getNextPage func(context.Context, AvailableSkusResult) (AvailableSkusResult, error)) AvailableSkusResultPage { 602 return AvailableSkusResultPage{fn: getNextPage} 603} 604 605// CancellationReason reason for cancellation. 606type CancellationReason struct { 607 // Reason - Reason for cancellation. 608 Reason *string `json:"reason,omitempty"` 609} 610 611// ContactDetails contact Details. 612type ContactDetails struct { 613 // ContactName - Contact name of the person. 614 ContactName *string `json:"contactName,omitempty"` 615 // Phone - Phone number of the contact person. 616 Phone *string `json:"phone,omitempty"` 617 // PhoneExtension - Phone extension number of the contact person. 618 PhoneExtension *string `json:"phoneExtension,omitempty"` 619 // Mobile - Mobile number of the contact person. 620 Mobile *string `json:"mobile,omitempty"` 621 // EmailList - List of Email-ids to be notified about job progress. 622 EmailList *[]string `json:"emailList,omitempty"` 623 // NotificationPreference - Notification preference for a job stage. 624 NotificationPreference *[]NotificationPreference `json:"notificationPreference,omitempty"` 625} 626 627// BasicCopyLogDetails details for log generated during copy. 628type BasicCopyLogDetails interface { 629 AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) 630 AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) 631 AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) 632 AsCopyLogDetails() (*CopyLogDetails, bool) 633} 634 635// CopyLogDetails details for log generated during copy. 636type CopyLogDetails struct { 637 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy' 638 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 639} 640 641func unmarshalBasicCopyLogDetails(body []byte) (BasicCopyLogDetails, error) { 642 var m map[string]interface{} 643 err := json.Unmarshal(body, &m) 644 if err != nil { 645 return nil, err 646 } 647 648 switch m["copyLogDetailsType"] { 649 case string(CopyLogDetailsTypeDataBox): 650 var acld AccountCopyLogDetails 651 err := json.Unmarshal(body, &acld) 652 return acld, err 653 case string(CopyLogDetailsTypeDataBoxDisk): 654 var dcld DiskCopyLogDetails 655 err := json.Unmarshal(body, &dcld) 656 return dcld, err 657 case string(CopyLogDetailsTypeDataBoxHeavy): 658 var hacld HeavyAccountCopyLogDetails 659 err := json.Unmarshal(body, &hacld) 660 return hacld, err 661 default: 662 var cld CopyLogDetails 663 err := json.Unmarshal(body, &cld) 664 return cld, err 665 } 666} 667func unmarshalBasicCopyLogDetailsArray(body []byte) ([]BasicCopyLogDetails, error) { 668 var rawMessages []*json.RawMessage 669 err := json.Unmarshal(body, &rawMessages) 670 if err != nil { 671 return nil, err 672 } 673 674 cldArray := make([]BasicCopyLogDetails, len(rawMessages)) 675 676 for index, rawMessage := range rawMessages { 677 cld, err := unmarshalBasicCopyLogDetails(*rawMessage) 678 if err != nil { 679 return nil, err 680 } 681 cldArray[index] = cld 682 } 683 return cldArray, nil 684} 685 686// MarshalJSON is the custom marshaler for CopyLogDetails. 687func (cld CopyLogDetails) MarshalJSON() ([]byte, error) { 688 cld.CopyLogDetailsType = CopyLogDetailsTypeCopyLogDetails 689 objectMap := make(map[string]interface{}) 690 if cld.CopyLogDetailsType != "" { 691 objectMap["copyLogDetailsType"] = cld.CopyLogDetailsType 692 } 693 return json.Marshal(objectMap) 694} 695 696// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 697func (cld CopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 698 return nil, false 699} 700 701// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 702func (cld CopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 703 return nil, false 704} 705 706// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 707func (cld CopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) { 708 return nil, false 709} 710 711// AsCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 712func (cld CopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 713 return &cld, true 714} 715 716// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 717func (cld CopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 718 return &cld, true 719} 720 721// CopyProgress copy progress. 722type CopyProgress struct { 723 // StorageAccountName - READ-ONLY; Name of the storage account where the data needs to be uploaded. 724 StorageAccountName *string `json:"storageAccountName,omitempty"` 725 // AccountID - READ-ONLY; Id of the account where the data needs to be uploaded. 726 AccountID *string `json:"accountId,omitempty"` 727 // BytesSentToCloud - READ-ONLY; Amount of data uploaded by the job as of now. 728 BytesSentToCloud *int64 `json:"bytesSentToCloud,omitempty"` 729 // TotalBytesToProcess - READ-ONLY; Total amount of data to be processed by the job. 730 TotalBytesToProcess *int64 `json:"totalBytesToProcess,omitempty"` 731 // FilesProcessed - READ-ONLY; Number of files processed by the job as of now. 732 FilesProcessed *int64 `json:"filesProcessed,omitempty"` 733 // TotalFilesToProcess - READ-ONLY; Total number of files to be processed by the job. 734 TotalFilesToProcess *int64 `json:"totalFilesToProcess,omitempty"` 735} 736 737// BasicDestinationAccountDetails details of the destination of the data 738type BasicDestinationAccountDetails interface { 739 AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) 740 AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) 741 AsDestinationAccountDetails() (*DestinationAccountDetails, bool) 742} 743 744// DestinationAccountDetails details of the destination of the data 745type DestinationAccountDetails struct { 746 // AccountID - Arm Id of the destination where the data has to be moved. 747 AccountID *string `json:"accountId,omitempty"` 748 // DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount' 749 DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"` 750} 751 752func unmarshalBasicDestinationAccountDetails(body []byte) (BasicDestinationAccountDetails, error) { 753 var m map[string]interface{} 754 err := json.Unmarshal(body, &m) 755 if err != nil { 756 return nil, err 757 } 758 759 switch m["dataDestinationType"] { 760 case string(DataDestinationTypeManagedDisk): 761 var dmdd DestinationManagedDiskDetails 762 err := json.Unmarshal(body, &dmdd) 763 return dmdd, err 764 case string(DataDestinationTypeStorageAccount): 765 var dsad DestinationStorageAccountDetails 766 err := json.Unmarshal(body, &dsad) 767 return dsad, err 768 default: 769 var dad DestinationAccountDetails 770 err := json.Unmarshal(body, &dad) 771 return dad, err 772 } 773} 774func unmarshalBasicDestinationAccountDetailsArray(body []byte) ([]BasicDestinationAccountDetails, error) { 775 var rawMessages []*json.RawMessage 776 err := json.Unmarshal(body, &rawMessages) 777 if err != nil { 778 return nil, err 779 } 780 781 dadArray := make([]BasicDestinationAccountDetails, len(rawMessages)) 782 783 for index, rawMessage := range rawMessages { 784 dad, err := unmarshalBasicDestinationAccountDetails(*rawMessage) 785 if err != nil { 786 return nil, err 787 } 788 dadArray[index] = dad 789 } 790 return dadArray, nil 791} 792 793// MarshalJSON is the custom marshaler for DestinationAccountDetails. 794func (dad DestinationAccountDetails) MarshalJSON() ([]byte, error) { 795 dad.DataDestinationType = DataDestinationTypeDestinationAccountDetails 796 objectMap := make(map[string]interface{}) 797 if dad.AccountID != nil { 798 objectMap["accountId"] = dad.AccountID 799 } 800 if dad.DataDestinationType != "" { 801 objectMap["dataDestinationType"] = dad.DataDestinationType 802 } 803 return json.Marshal(objectMap) 804} 805 806// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. 807func (dad DestinationAccountDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) { 808 return nil, false 809} 810 811// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. 812func (dad DestinationAccountDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) { 813 return nil, false 814} 815 816// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. 817func (dad DestinationAccountDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) { 818 return &dad, true 819} 820 821// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. 822func (dad DestinationAccountDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) { 823 return &dad, true 824} 825 826// DestinationManagedDiskDetails details for the destination compute disks. 827type DestinationManagedDiskDetails struct { 828 // ResourceGroupID - Destination Resource Group Id where the Compute disks should be created. 829 ResourceGroupID *string `json:"resourceGroupId,omitempty"` 830 // StagingStorageAccountID - Arm Id of the storage account that can be used to copy the vhd for staging. 831 StagingStorageAccountID *string `json:"stagingStorageAccountId,omitempty"` 832 // AccountID - Arm Id of the destination where the data has to be moved. 833 AccountID *string `json:"accountId,omitempty"` 834 // DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount' 835 DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"` 836} 837 838// MarshalJSON is the custom marshaler for DestinationManagedDiskDetails. 839func (dmdd DestinationManagedDiskDetails) MarshalJSON() ([]byte, error) { 840 dmdd.DataDestinationType = DataDestinationTypeManagedDisk 841 objectMap := make(map[string]interface{}) 842 if dmdd.ResourceGroupID != nil { 843 objectMap["resourceGroupId"] = dmdd.ResourceGroupID 844 } 845 if dmdd.StagingStorageAccountID != nil { 846 objectMap["stagingStorageAccountId"] = dmdd.StagingStorageAccountID 847 } 848 if dmdd.AccountID != nil { 849 objectMap["accountId"] = dmdd.AccountID 850 } 851 if dmdd.DataDestinationType != "" { 852 objectMap["dataDestinationType"] = dmdd.DataDestinationType 853 } 854 return json.Marshal(objectMap) 855} 856 857// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. 858func (dmdd DestinationManagedDiskDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) { 859 return &dmdd, true 860} 861 862// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. 863func (dmdd DestinationManagedDiskDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) { 864 return nil, false 865} 866 867// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. 868func (dmdd DestinationManagedDiskDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) { 869 return nil, false 870} 871 872// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. 873func (dmdd DestinationManagedDiskDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) { 874 return &dmdd, true 875} 876 877// DestinationStorageAccountDetails details for the destination storage account. 878type DestinationStorageAccountDetails struct { 879 // StorageAccountID - Destination Storage Account Arm Id. 880 StorageAccountID *string `json:"storageAccountId,omitempty"` 881 // AccountID - Arm Id of the destination where the data has to be moved. 882 AccountID *string `json:"accountId,omitempty"` 883 // DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount' 884 DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"` 885} 886 887// MarshalJSON is the custom marshaler for DestinationStorageAccountDetails. 888func (dsad DestinationStorageAccountDetails) MarshalJSON() ([]byte, error) { 889 dsad.DataDestinationType = DataDestinationTypeStorageAccount 890 objectMap := make(map[string]interface{}) 891 if dsad.StorageAccountID != nil { 892 objectMap["storageAccountId"] = dsad.StorageAccountID 893 } 894 if dsad.AccountID != nil { 895 objectMap["accountId"] = dsad.AccountID 896 } 897 if dsad.DataDestinationType != "" { 898 objectMap["dataDestinationType"] = dsad.DataDestinationType 899 } 900 return json.Marshal(objectMap) 901} 902 903// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. 904func (dsad DestinationStorageAccountDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) { 905 return nil, false 906} 907 908// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. 909func (dsad DestinationStorageAccountDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) { 910 return &dsad, true 911} 912 913// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. 914func (dsad DestinationStorageAccountDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) { 915 return nil, false 916} 917 918// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. 919func (dsad DestinationStorageAccountDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) { 920 return &dsad, true 921} 922 923// DestinationToServiceLocationMap map of destination location to service location 924type DestinationToServiceLocationMap struct { 925 // DestinationLocation - READ-ONLY; Location of the destination. 926 DestinationLocation *string `json:"destinationLocation,omitempty"` 927 // ServiceLocation - READ-ONLY; Location of the service. 928 ServiceLocation *string `json:"serviceLocation,omitempty"` 929} 930 931// DiskCopyLogDetails copy Log Details for a disk 932type DiskCopyLogDetails struct { 933 // DiskSerialNumber - READ-ONLY; Disk Serial Number. 934 DiskSerialNumber *string `json:"diskSerialNumber,omitempty"` 935 // ErrorLogLink - READ-ONLY; Link for copy error logs. 936 ErrorLogLink *string `json:"errorLogLink,omitempty"` 937 // VerboseLogLink - READ-ONLY; Link for copy verbose logs. 938 VerboseLogLink *string `json:"verboseLogLink,omitempty"` 939 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy' 940 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 941} 942 943// MarshalJSON is the custom marshaler for DiskCopyLogDetails. 944func (dcld DiskCopyLogDetails) MarshalJSON() ([]byte, error) { 945 dcld.CopyLogDetailsType = CopyLogDetailsTypeDataBoxDisk 946 objectMap := make(map[string]interface{}) 947 if dcld.CopyLogDetailsType != "" { 948 objectMap["copyLogDetailsType"] = dcld.CopyLogDetailsType 949 } 950 return json.Marshal(objectMap) 951} 952 953// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 954func (dcld DiskCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 955 return nil, false 956} 957 958// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 959func (dcld DiskCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 960 return &dcld, true 961} 962 963// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 964func (dcld DiskCopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) { 965 return nil, false 966} 967 968// AsCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 969func (dcld DiskCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 970 return nil, false 971} 972 973// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 974func (dcld DiskCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 975 return &dcld, true 976} 977 978// DiskCopyProgress dataBox Disk Copy Progress 979type DiskCopyProgress struct { 980 // SerialNumber - READ-ONLY; The serial number of the disk 981 SerialNumber *string `json:"serialNumber,omitempty"` 982 // BytesCopied - READ-ONLY; Bytes copied during the copy of disk. 983 BytesCopied *int64 `json:"bytesCopied,omitempty"` 984 // PercentComplete - READ-ONLY; Indicates the percentage completed for the copy of the disk. 985 PercentComplete *int32 `json:"percentComplete,omitempty"` 986 // Status - READ-ONLY; The Status of the copy. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'NotReturned' 987 Status CopyStatus `json:"status,omitempty"` 988} 989 990// DiskJobDetails dataBox Disk Job Details. 991type DiskJobDetails struct { 992 // 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. 993 PreferredDisks map[string]*int32 `json:"preferredDisks"` 994 // CopyProgress - READ-ONLY; Copy progress per disk. 995 CopyProgress *[]DiskCopyProgress `json:"copyProgress,omitempty"` 996 // 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. 997 DisksAndSizeDetails map[string]*int32 `json:"disksAndSizeDetails"` 998 // Passkey - User entered passkey for DataBox Disk job. 999 Passkey *string `json:"passkey,omitempty"` 1000 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transferred in this job, in terabytes. 1001 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 1002 // JobStages - READ-ONLY; List of stages that run in the job. 1003 JobStages *[]JobStages `json:"jobStages,omitempty"` 1004 // ContactDetails - Contact details for notification and shipping. 1005 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 1006 // ShippingAddress - Shipping address of the customer. 1007 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 1008 // DeliveryPackage - READ-ONLY; Delivery package shipping details. 1009 DeliveryPackage *PackageShippingDetails `json:"deliveryPackage,omitempty"` 1010 // ReturnPackage - READ-ONLY; Return package shipping details. 1011 ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` 1012 // DestinationAccountDetails - Destination account details. 1013 DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` 1014 // ErrorDetails - READ-ONLY; Error details for failure. This is optional. 1015 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 1016 // Preferences - Preferences for the order. 1017 Preferences *Preferences `json:"preferences,omitempty"` 1018 // CopyLogDetails - READ-ONLY; List of copy log details. 1019 CopyLogDetails *[]BasicCopyLogDetails `json:"copyLogDetails,omitempty"` 1020 // ReverseShipmentLabelSasKey - READ-ONLY; Shared access key to download the return shipment label 1021 ReverseShipmentLabelSasKey *string `json:"reverseShipmentLabelSasKey,omitempty"` 1022 // ChainOfCustodySasKey - READ-ONLY; Shared access key to download the chain of custody logs 1023 ChainOfCustodySasKey *string `json:"chainOfCustodySasKey,omitempty"` 1024 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDataBoxDisk', 'JobDetailsTypeDataBoxHeavy', 'JobDetailsTypeDataBox' 1025 JobDetailsType JobDetailsTypeEnum `json:"jobDetailsType,omitempty"` 1026} 1027 1028// MarshalJSON is the custom marshaler for DiskJobDetails. 1029func (djd DiskJobDetails) MarshalJSON() ([]byte, error) { 1030 djd.JobDetailsType = JobDetailsTypeDataBoxDisk 1031 objectMap := make(map[string]interface{}) 1032 if djd.PreferredDisks != nil { 1033 objectMap["preferredDisks"] = djd.PreferredDisks 1034 } 1035 if djd.Passkey != nil { 1036 objectMap["passkey"] = djd.Passkey 1037 } 1038 if djd.ExpectedDataSizeInTeraBytes != nil { 1039 objectMap["expectedDataSizeInTeraBytes"] = djd.ExpectedDataSizeInTeraBytes 1040 } 1041 if djd.ContactDetails != nil { 1042 objectMap["contactDetails"] = djd.ContactDetails 1043 } 1044 if djd.ShippingAddress != nil { 1045 objectMap["shippingAddress"] = djd.ShippingAddress 1046 } 1047 if djd.DestinationAccountDetails != nil { 1048 objectMap["destinationAccountDetails"] = djd.DestinationAccountDetails 1049 } 1050 if djd.Preferences != nil { 1051 objectMap["preferences"] = djd.Preferences 1052 } 1053 if djd.JobDetailsType != "" { 1054 objectMap["jobDetailsType"] = djd.JobDetailsType 1055 } 1056 return json.Marshal(objectMap) 1057} 1058 1059// AsDiskJobDetails is the BasicJobDetails implementation for DiskJobDetails. 1060func (djd DiskJobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) { 1061 return &djd, true 1062} 1063 1064// AsHeavyJobDetails is the BasicJobDetails implementation for DiskJobDetails. 1065func (djd DiskJobDetails) AsHeavyJobDetails() (*HeavyJobDetails, bool) { 1066 return nil, false 1067} 1068 1069// AsJobDetailsType is the BasicJobDetails implementation for DiskJobDetails. 1070func (djd DiskJobDetails) AsJobDetailsType() (*JobDetailsType, bool) { 1071 return nil, false 1072} 1073 1074// AsJobDetails is the BasicJobDetails implementation for DiskJobDetails. 1075func (djd DiskJobDetails) AsJobDetails() (*JobDetails, bool) { 1076 return nil, false 1077} 1078 1079// AsBasicJobDetails is the BasicJobDetails implementation for DiskJobDetails. 1080func (djd DiskJobDetails) AsBasicJobDetails() (BasicJobDetails, bool) { 1081 return &djd, true 1082} 1083 1084// UnmarshalJSON is the custom unmarshaler for DiskJobDetails struct. 1085func (djd *DiskJobDetails) UnmarshalJSON(body []byte) error { 1086 var m map[string]*json.RawMessage 1087 err := json.Unmarshal(body, &m) 1088 if err != nil { 1089 return err 1090 } 1091 for k, v := range m { 1092 switch k { 1093 case "preferredDisks": 1094 if v != nil { 1095 var preferredDisks map[string]*int32 1096 err = json.Unmarshal(*v, &preferredDisks) 1097 if err != nil { 1098 return err 1099 } 1100 djd.PreferredDisks = preferredDisks 1101 } 1102 case "copyProgress": 1103 if v != nil { 1104 var copyProgress []DiskCopyProgress 1105 err = json.Unmarshal(*v, ©Progress) 1106 if err != nil { 1107 return err 1108 } 1109 djd.CopyProgress = ©Progress 1110 } 1111 case "disksAndSizeDetails": 1112 if v != nil { 1113 var disksAndSizeDetails map[string]*int32 1114 err = json.Unmarshal(*v, &disksAndSizeDetails) 1115 if err != nil { 1116 return err 1117 } 1118 djd.DisksAndSizeDetails = disksAndSizeDetails 1119 } 1120 case "passkey": 1121 if v != nil { 1122 var passkey string 1123 err = json.Unmarshal(*v, &passkey) 1124 if err != nil { 1125 return err 1126 } 1127 djd.Passkey = &passkey 1128 } 1129 case "expectedDataSizeInTeraBytes": 1130 if v != nil { 1131 var expectedDataSizeInTeraBytes int32 1132 err = json.Unmarshal(*v, &expectedDataSizeInTeraBytes) 1133 if err != nil { 1134 return err 1135 } 1136 djd.ExpectedDataSizeInTeraBytes = &expectedDataSizeInTeraBytes 1137 } 1138 case "jobStages": 1139 if v != nil { 1140 var jobStages []JobStages 1141 err = json.Unmarshal(*v, &jobStages) 1142 if err != nil { 1143 return err 1144 } 1145 djd.JobStages = &jobStages 1146 } 1147 case "contactDetails": 1148 if v != nil { 1149 var contactDetails ContactDetails 1150 err = json.Unmarshal(*v, &contactDetails) 1151 if err != nil { 1152 return err 1153 } 1154 djd.ContactDetails = &contactDetails 1155 } 1156 case "shippingAddress": 1157 if v != nil { 1158 var shippingAddress ShippingAddress 1159 err = json.Unmarshal(*v, &shippingAddress) 1160 if err != nil { 1161 return err 1162 } 1163 djd.ShippingAddress = &shippingAddress 1164 } 1165 case "deliveryPackage": 1166 if v != nil { 1167 var deliveryPackage PackageShippingDetails 1168 err = json.Unmarshal(*v, &deliveryPackage) 1169 if err != nil { 1170 return err 1171 } 1172 djd.DeliveryPackage = &deliveryPackage 1173 } 1174 case "returnPackage": 1175 if v != nil { 1176 var returnPackage PackageShippingDetails 1177 err = json.Unmarshal(*v, &returnPackage) 1178 if err != nil { 1179 return err 1180 } 1181 djd.ReturnPackage = &returnPackage 1182 } 1183 case "destinationAccountDetails": 1184 if v != nil { 1185 destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) 1186 if err != nil { 1187 return err 1188 } 1189 djd.DestinationAccountDetails = &destinationAccountDetails 1190 } 1191 case "errorDetails": 1192 if v != nil { 1193 var errorDetails []JobErrorDetails 1194 err = json.Unmarshal(*v, &errorDetails) 1195 if err != nil { 1196 return err 1197 } 1198 djd.ErrorDetails = &errorDetails 1199 } 1200 case "preferences": 1201 if v != nil { 1202 var preferences Preferences 1203 err = json.Unmarshal(*v, &preferences) 1204 if err != nil { 1205 return err 1206 } 1207 djd.Preferences = &preferences 1208 } 1209 case "copyLogDetails": 1210 if v != nil { 1211 copyLogDetails, err := unmarshalBasicCopyLogDetailsArray(*v) 1212 if err != nil { 1213 return err 1214 } 1215 djd.CopyLogDetails = ©LogDetails 1216 } 1217 case "reverseShipmentLabelSasKey": 1218 if v != nil { 1219 var reverseShipmentLabelSasKey string 1220 err = json.Unmarshal(*v, &reverseShipmentLabelSasKey) 1221 if err != nil { 1222 return err 1223 } 1224 djd.ReverseShipmentLabelSasKey = &reverseShipmentLabelSasKey 1225 } 1226 case "chainOfCustodySasKey": 1227 if v != nil { 1228 var chainOfCustodySasKey string 1229 err = json.Unmarshal(*v, &chainOfCustodySasKey) 1230 if err != nil { 1231 return err 1232 } 1233 djd.ChainOfCustodySasKey = &chainOfCustodySasKey 1234 } 1235 case "jobDetailsType": 1236 if v != nil { 1237 var jobDetailsType JobDetailsTypeEnum 1238 err = json.Unmarshal(*v, &jobDetailsType) 1239 if err != nil { 1240 return err 1241 } 1242 djd.JobDetailsType = jobDetailsType 1243 } 1244 } 1245 } 1246 1247 return nil 1248} 1249 1250// DiskJobSecrets the secrets related to disk job. 1251type DiskJobSecrets struct { 1252 // DiskSecrets - READ-ONLY; Contains the list of secrets object for that device. 1253 DiskSecrets *[]DiskSecret `json:"diskSecrets,omitempty"` 1254 // PassKey - READ-ONLY; PassKey for the disk Job. 1255 PassKey *string `json:"passKey,omitempty"` 1256 // IsPasskeyUserDefined - READ-ONLY; Whether passkey was provided by user. 1257 IsPasskeyUserDefined *bool `json:"isPasskeyUserDefined,omitempty"` 1258 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeDataBoxDisk', 'JobSecretsTypeDataBoxHeavy', 'JobSecretsTypeDataBox' 1259 JobSecretsType JobSecretsTypeEnum `json:"jobSecretsType,omitempty"` 1260} 1261 1262// MarshalJSON is the custom marshaler for DiskJobSecrets. 1263func (djs DiskJobSecrets) MarshalJSON() ([]byte, error) { 1264 djs.JobSecretsType = JobSecretsTypeDataBoxDisk 1265 objectMap := make(map[string]interface{}) 1266 if djs.JobSecretsType != "" { 1267 objectMap["jobSecretsType"] = djs.JobSecretsType 1268 } 1269 return json.Marshal(objectMap) 1270} 1271 1272// AsDiskJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 1273func (djs DiskJobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 1274 return &djs, true 1275} 1276 1277// AsHeavyJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 1278func (djs DiskJobSecrets) AsHeavyJobSecrets() (*HeavyJobSecrets, bool) { 1279 return nil, false 1280} 1281 1282// AsJobSecretsType is the BasicJobSecrets implementation for DiskJobSecrets. 1283func (djs DiskJobSecrets) AsJobSecretsType() (*JobSecretsType, bool) { 1284 return nil, false 1285} 1286 1287// AsJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 1288func (djs DiskJobSecrets) AsJobSecrets() (*JobSecrets, bool) { 1289 return nil, false 1290} 1291 1292// AsBasicJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 1293func (djs DiskJobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 1294 return &djs, true 1295} 1296 1297// DiskSecret contains all the secrets of a Disk. 1298type DiskSecret struct { 1299 // DiskSerialNumber - READ-ONLY; Serial number of the assigned disk. 1300 DiskSerialNumber *string `json:"diskSerialNumber,omitempty"` 1301 // BitLockerKey - READ-ONLY; Bit Locker key of the disk which can be used to unlock the disk to copy data. 1302 BitLockerKey *string `json:"bitLockerKey,omitempty"` 1303} 1304 1305// Error top level error for the job. 1306type Error struct { 1307 // Code - READ-ONLY; Error code that can be used to programmatically identify the error. 1308 Code *string `json:"code,omitempty"` 1309 // Message - READ-ONLY; Describes the error in detail and provides debugging information. 1310 Message *string `json:"message,omitempty"` 1311} 1312 1313// HeavyAccountCopyLogDetails copy log details for a storage account for DataBoxHeavy 1314type HeavyAccountCopyLogDetails struct { 1315 // AccountName - READ-ONLY; Destination account name. 1316 AccountName *string `json:"accountName,omitempty"` 1317 // CopyLogLink - READ-ONLY; Link for copy logs. 1318 CopyLogLink *[]string `json:"copyLogLink,omitempty"` 1319 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypeDataBox', 'CopyLogDetailsTypeDataBoxDisk', 'CopyLogDetailsTypeDataBoxHeavy' 1320 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 1321} 1322 1323// MarshalJSON is the custom marshaler for HeavyAccountCopyLogDetails. 1324func (hacld HeavyAccountCopyLogDetails) MarshalJSON() ([]byte, error) { 1325 hacld.CopyLogDetailsType = CopyLogDetailsTypeDataBoxHeavy 1326 objectMap := make(map[string]interface{}) 1327 if hacld.CopyLogDetailsType != "" { 1328 objectMap["copyLogDetailsType"] = hacld.CopyLogDetailsType 1329 } 1330 return json.Marshal(objectMap) 1331} 1332 1333// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for HeavyAccountCopyLogDetails. 1334func (hacld HeavyAccountCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 1335 return nil, false 1336} 1337 1338// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for HeavyAccountCopyLogDetails. 1339func (hacld HeavyAccountCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 1340 return nil, false 1341} 1342 1343// AsHeavyAccountCopyLogDetails is the BasicCopyLogDetails implementation for HeavyAccountCopyLogDetails. 1344func (hacld HeavyAccountCopyLogDetails) AsHeavyAccountCopyLogDetails() (*HeavyAccountCopyLogDetails, bool) { 1345 return &hacld, true 1346} 1347 1348// AsCopyLogDetails is the BasicCopyLogDetails implementation for HeavyAccountCopyLogDetails. 1349func (hacld HeavyAccountCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 1350 return nil, false 1351} 1352 1353// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for HeavyAccountCopyLogDetails. 1354func (hacld HeavyAccountCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 1355 return &hacld, true 1356} 1357 1358// HeavyJobDetails dataBoxHeavy Device Job Details 1359type HeavyJobDetails struct { 1360 // CopyProgress - READ-ONLY; Copy progress per account. 1361 CopyProgress *[]CopyProgress `json:"copyProgress,omitempty"` 1362 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transferred in this job, in terabytes. 1363 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 1364 // JobStages - READ-ONLY; List of stages that run in the job. 1365 JobStages *[]JobStages `json:"jobStages,omitempty"` 1366 // ContactDetails - Contact details for notification and shipping. 1367 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 1368 // ShippingAddress - Shipping address of the customer. 1369 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 1370 // DeliveryPackage - READ-ONLY; Delivery package shipping details. 1371 DeliveryPackage *PackageShippingDetails `json:"deliveryPackage,omitempty"` 1372 // ReturnPackage - READ-ONLY; Return package shipping details. 1373 ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` 1374 // DestinationAccountDetails - Destination account details. 1375 DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` 1376 // ErrorDetails - READ-ONLY; Error details for failure. This is optional. 1377 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 1378 // Preferences - Preferences for the order. 1379 Preferences *Preferences `json:"preferences,omitempty"` 1380 // CopyLogDetails - READ-ONLY; List of copy log details. 1381 CopyLogDetails *[]BasicCopyLogDetails `json:"copyLogDetails,omitempty"` 1382 // ReverseShipmentLabelSasKey - READ-ONLY; Shared access key to download the return shipment label 1383 ReverseShipmentLabelSasKey *string `json:"reverseShipmentLabelSasKey,omitempty"` 1384 // ChainOfCustodySasKey - READ-ONLY; Shared access key to download the chain of custody logs 1385 ChainOfCustodySasKey *string `json:"chainOfCustodySasKey,omitempty"` 1386 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDataBoxDisk', 'JobDetailsTypeDataBoxHeavy', 'JobDetailsTypeDataBox' 1387 JobDetailsType JobDetailsTypeEnum `json:"jobDetailsType,omitempty"` 1388} 1389 1390// MarshalJSON is the custom marshaler for HeavyJobDetails. 1391func (hjd HeavyJobDetails) MarshalJSON() ([]byte, error) { 1392 hjd.JobDetailsType = JobDetailsTypeDataBoxHeavy 1393 objectMap := make(map[string]interface{}) 1394 if hjd.ExpectedDataSizeInTeraBytes != nil { 1395 objectMap["expectedDataSizeInTeraBytes"] = hjd.ExpectedDataSizeInTeraBytes 1396 } 1397 if hjd.ContactDetails != nil { 1398 objectMap["contactDetails"] = hjd.ContactDetails 1399 } 1400 if hjd.ShippingAddress != nil { 1401 objectMap["shippingAddress"] = hjd.ShippingAddress 1402 } 1403 if hjd.DestinationAccountDetails != nil { 1404 objectMap["destinationAccountDetails"] = hjd.DestinationAccountDetails 1405 } 1406 if hjd.Preferences != nil { 1407 objectMap["preferences"] = hjd.Preferences 1408 } 1409 if hjd.JobDetailsType != "" { 1410 objectMap["jobDetailsType"] = hjd.JobDetailsType 1411 } 1412 return json.Marshal(objectMap) 1413} 1414 1415// AsDiskJobDetails is the BasicJobDetails implementation for HeavyJobDetails. 1416func (hjd HeavyJobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) { 1417 return nil, false 1418} 1419 1420// AsHeavyJobDetails is the BasicJobDetails implementation for HeavyJobDetails. 1421func (hjd HeavyJobDetails) AsHeavyJobDetails() (*HeavyJobDetails, bool) { 1422 return &hjd, true 1423} 1424 1425// AsJobDetailsType is the BasicJobDetails implementation for HeavyJobDetails. 1426func (hjd HeavyJobDetails) AsJobDetailsType() (*JobDetailsType, bool) { 1427 return nil, false 1428} 1429 1430// AsJobDetails is the BasicJobDetails implementation for HeavyJobDetails. 1431func (hjd HeavyJobDetails) AsJobDetails() (*JobDetails, bool) { 1432 return nil, false 1433} 1434 1435// AsBasicJobDetails is the BasicJobDetails implementation for HeavyJobDetails. 1436func (hjd HeavyJobDetails) AsBasicJobDetails() (BasicJobDetails, bool) { 1437 return &hjd, true 1438} 1439 1440// UnmarshalJSON is the custom unmarshaler for HeavyJobDetails struct. 1441func (hjd *HeavyJobDetails) UnmarshalJSON(body []byte) error { 1442 var m map[string]*json.RawMessage 1443 err := json.Unmarshal(body, &m) 1444 if err != nil { 1445 return err 1446 } 1447 for k, v := range m { 1448 switch k { 1449 case "copyProgress": 1450 if v != nil { 1451 var copyProgress []CopyProgress 1452 err = json.Unmarshal(*v, ©Progress) 1453 if err != nil { 1454 return err 1455 } 1456 hjd.CopyProgress = ©Progress 1457 } 1458 case "expectedDataSizeInTeraBytes": 1459 if v != nil { 1460 var expectedDataSizeInTeraBytes int32 1461 err = json.Unmarshal(*v, &expectedDataSizeInTeraBytes) 1462 if err != nil { 1463 return err 1464 } 1465 hjd.ExpectedDataSizeInTeraBytes = &expectedDataSizeInTeraBytes 1466 } 1467 case "jobStages": 1468 if v != nil { 1469 var jobStages []JobStages 1470 err = json.Unmarshal(*v, &jobStages) 1471 if err != nil { 1472 return err 1473 } 1474 hjd.JobStages = &jobStages 1475 } 1476 case "contactDetails": 1477 if v != nil { 1478 var contactDetails ContactDetails 1479 err = json.Unmarshal(*v, &contactDetails) 1480 if err != nil { 1481 return err 1482 } 1483 hjd.ContactDetails = &contactDetails 1484 } 1485 case "shippingAddress": 1486 if v != nil { 1487 var shippingAddress ShippingAddress 1488 err = json.Unmarshal(*v, &shippingAddress) 1489 if err != nil { 1490 return err 1491 } 1492 hjd.ShippingAddress = &shippingAddress 1493 } 1494 case "deliveryPackage": 1495 if v != nil { 1496 var deliveryPackage PackageShippingDetails 1497 err = json.Unmarshal(*v, &deliveryPackage) 1498 if err != nil { 1499 return err 1500 } 1501 hjd.DeliveryPackage = &deliveryPackage 1502 } 1503 case "returnPackage": 1504 if v != nil { 1505 var returnPackage PackageShippingDetails 1506 err = json.Unmarshal(*v, &returnPackage) 1507 if err != nil { 1508 return err 1509 } 1510 hjd.ReturnPackage = &returnPackage 1511 } 1512 case "destinationAccountDetails": 1513 if v != nil { 1514 destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) 1515 if err != nil { 1516 return err 1517 } 1518 hjd.DestinationAccountDetails = &destinationAccountDetails 1519 } 1520 case "errorDetails": 1521 if v != nil { 1522 var errorDetails []JobErrorDetails 1523 err = json.Unmarshal(*v, &errorDetails) 1524 if err != nil { 1525 return err 1526 } 1527 hjd.ErrorDetails = &errorDetails 1528 } 1529 case "preferences": 1530 if v != nil { 1531 var preferences Preferences 1532 err = json.Unmarshal(*v, &preferences) 1533 if err != nil { 1534 return err 1535 } 1536 hjd.Preferences = &preferences 1537 } 1538 case "copyLogDetails": 1539 if v != nil { 1540 copyLogDetails, err := unmarshalBasicCopyLogDetailsArray(*v) 1541 if err != nil { 1542 return err 1543 } 1544 hjd.CopyLogDetails = ©LogDetails 1545 } 1546 case "reverseShipmentLabelSasKey": 1547 if v != nil { 1548 var reverseShipmentLabelSasKey string 1549 err = json.Unmarshal(*v, &reverseShipmentLabelSasKey) 1550 if err != nil { 1551 return err 1552 } 1553 hjd.ReverseShipmentLabelSasKey = &reverseShipmentLabelSasKey 1554 } 1555 case "chainOfCustodySasKey": 1556 if v != nil { 1557 var chainOfCustodySasKey string 1558 err = json.Unmarshal(*v, &chainOfCustodySasKey) 1559 if err != nil { 1560 return err 1561 } 1562 hjd.ChainOfCustodySasKey = &chainOfCustodySasKey 1563 } 1564 case "jobDetailsType": 1565 if v != nil { 1566 var jobDetailsType JobDetailsTypeEnum 1567 err = json.Unmarshal(*v, &jobDetailsType) 1568 if err != nil { 1569 return err 1570 } 1571 hjd.JobDetailsType = jobDetailsType 1572 } 1573 } 1574 } 1575 1576 return nil 1577} 1578 1579// HeavyJobSecrets the secrets related to a DataBoxHeavy job. 1580type HeavyJobSecrets struct { 1581 // CabinetPodSecrets - READ-ONLY; Contains the list of secret objects for a DataBoxHeavy job. 1582 CabinetPodSecrets *[]HeavySecret `json:"cabinetPodSecrets,omitempty"` 1583 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeDataBoxDisk', 'JobSecretsTypeDataBoxHeavy', 'JobSecretsTypeDataBox' 1584 JobSecretsType JobSecretsTypeEnum `json:"jobSecretsType,omitempty"` 1585} 1586 1587// MarshalJSON is the custom marshaler for HeavyJobSecrets. 1588func (hjs HeavyJobSecrets) MarshalJSON() ([]byte, error) { 1589 hjs.JobSecretsType = JobSecretsTypeDataBoxHeavy 1590 objectMap := make(map[string]interface{}) 1591 if hjs.JobSecretsType != "" { 1592 objectMap["jobSecretsType"] = hjs.JobSecretsType 1593 } 1594 return json.Marshal(objectMap) 1595} 1596 1597// AsDiskJobSecrets is the BasicJobSecrets implementation for HeavyJobSecrets. 1598func (hjs HeavyJobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 1599 return nil, false 1600} 1601 1602// AsHeavyJobSecrets is the BasicJobSecrets implementation for HeavyJobSecrets. 1603func (hjs HeavyJobSecrets) AsHeavyJobSecrets() (*HeavyJobSecrets, bool) { 1604 return &hjs, true 1605} 1606 1607// AsJobSecretsType is the BasicJobSecrets implementation for HeavyJobSecrets. 1608func (hjs HeavyJobSecrets) AsJobSecretsType() (*JobSecretsType, bool) { 1609 return nil, false 1610} 1611 1612// AsJobSecrets is the BasicJobSecrets implementation for HeavyJobSecrets. 1613func (hjs HeavyJobSecrets) AsJobSecrets() (*JobSecrets, bool) { 1614 return nil, false 1615} 1616 1617// AsBasicJobSecrets is the BasicJobSecrets implementation for HeavyJobSecrets. 1618func (hjs HeavyJobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 1619 return &hjs, true 1620} 1621 1622// HeavySecret the secrets related to a DataBoxHeavy. 1623type HeavySecret struct { 1624 // DeviceSerialNumber - READ-ONLY; Serial number of the assigned device. 1625 DeviceSerialNumber *string `json:"deviceSerialNumber,omitempty"` 1626 // DevicePassword - READ-ONLY; Password for out of the box experience on device. 1627 DevicePassword *string `json:"devicePassword,omitempty"` 1628 // NetworkConfigurations - READ-ONLY; Network configuration of the appliance. 1629 NetworkConfigurations *[]ApplianceNetworkConfiguration `json:"networkConfigurations,omitempty"` 1630 // EncodedValidationCertPubKey - READ-ONLY; The base 64 encoded public key to authenticate with the device 1631 EncodedValidationCertPubKey *string `json:"encodedValidationCertPubKey,omitempty"` 1632 // AccountCredentialDetails - READ-ONLY; Per account level access credentials. 1633 AccountCredentialDetails *[]AccountCredentialDetails `json:"accountCredentialDetails,omitempty"` 1634} 1635 1636// BasicJobDetails job details. 1637type BasicJobDetails interface { 1638 AsDiskJobDetails() (*DiskJobDetails, bool) 1639 AsHeavyJobDetails() (*HeavyJobDetails, bool) 1640 AsJobDetailsType() (*JobDetailsType, bool) 1641 AsJobDetails() (*JobDetails, bool) 1642} 1643 1644// JobDetails job details. 1645type JobDetails struct { 1646 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transferred in this job, in terabytes. 1647 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 1648 // JobStages - READ-ONLY; List of stages that run in the job. 1649 JobStages *[]JobStages `json:"jobStages,omitempty"` 1650 // ContactDetails - Contact details for notification and shipping. 1651 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 1652 // ShippingAddress - Shipping address of the customer. 1653 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 1654 // DeliveryPackage - READ-ONLY; Delivery package shipping details. 1655 DeliveryPackage *PackageShippingDetails `json:"deliveryPackage,omitempty"` 1656 // ReturnPackage - READ-ONLY; Return package shipping details. 1657 ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` 1658 // DestinationAccountDetails - Destination account details. 1659 DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` 1660 // ErrorDetails - READ-ONLY; Error details for failure. This is optional. 1661 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 1662 // Preferences - Preferences for the order. 1663 Preferences *Preferences `json:"preferences,omitempty"` 1664 // CopyLogDetails - READ-ONLY; List of copy log details. 1665 CopyLogDetails *[]BasicCopyLogDetails `json:"copyLogDetails,omitempty"` 1666 // ReverseShipmentLabelSasKey - READ-ONLY; Shared access key to download the return shipment label 1667 ReverseShipmentLabelSasKey *string `json:"reverseShipmentLabelSasKey,omitempty"` 1668 // ChainOfCustodySasKey - READ-ONLY; Shared access key to download the chain of custody logs 1669 ChainOfCustodySasKey *string `json:"chainOfCustodySasKey,omitempty"` 1670 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDataBoxDisk', 'JobDetailsTypeDataBoxHeavy', 'JobDetailsTypeDataBox' 1671 JobDetailsType JobDetailsTypeEnum `json:"jobDetailsType,omitempty"` 1672} 1673 1674func unmarshalBasicJobDetails(body []byte) (BasicJobDetails, error) { 1675 var m map[string]interface{} 1676 err := json.Unmarshal(body, &m) 1677 if err != nil { 1678 return nil, err 1679 } 1680 1681 switch m["jobDetailsType"] { 1682 case string(JobDetailsTypeDataBoxDisk): 1683 var djd DiskJobDetails 1684 err := json.Unmarshal(body, &djd) 1685 return djd, err 1686 case string(JobDetailsTypeDataBoxHeavy): 1687 var hjd HeavyJobDetails 1688 err := json.Unmarshal(body, &hjd) 1689 return hjd, err 1690 case string(JobDetailsTypeDataBox): 1691 var jdt JobDetailsType 1692 err := json.Unmarshal(body, &jdt) 1693 return jdt, err 1694 default: 1695 var jd JobDetails 1696 err := json.Unmarshal(body, &jd) 1697 return jd, err 1698 } 1699} 1700func unmarshalBasicJobDetailsArray(body []byte) ([]BasicJobDetails, error) { 1701 var rawMessages []*json.RawMessage 1702 err := json.Unmarshal(body, &rawMessages) 1703 if err != nil { 1704 return nil, err 1705 } 1706 1707 jdArray := make([]BasicJobDetails, len(rawMessages)) 1708 1709 for index, rawMessage := range rawMessages { 1710 jd, err := unmarshalBasicJobDetails(*rawMessage) 1711 if err != nil { 1712 return nil, err 1713 } 1714 jdArray[index] = jd 1715 } 1716 return jdArray, nil 1717} 1718 1719// MarshalJSON is the custom marshaler for JobDetails. 1720func (jd JobDetails) MarshalJSON() ([]byte, error) { 1721 jd.JobDetailsType = JobDetailsTypeJobDetails 1722 objectMap := make(map[string]interface{}) 1723 if jd.ExpectedDataSizeInTeraBytes != nil { 1724 objectMap["expectedDataSizeInTeraBytes"] = jd.ExpectedDataSizeInTeraBytes 1725 } 1726 if jd.ContactDetails != nil { 1727 objectMap["contactDetails"] = jd.ContactDetails 1728 } 1729 if jd.ShippingAddress != nil { 1730 objectMap["shippingAddress"] = jd.ShippingAddress 1731 } 1732 if jd.DestinationAccountDetails != nil { 1733 objectMap["destinationAccountDetails"] = jd.DestinationAccountDetails 1734 } 1735 if jd.Preferences != nil { 1736 objectMap["preferences"] = jd.Preferences 1737 } 1738 if jd.JobDetailsType != "" { 1739 objectMap["jobDetailsType"] = jd.JobDetailsType 1740 } 1741 return json.Marshal(objectMap) 1742} 1743 1744// AsDiskJobDetails is the BasicJobDetails implementation for JobDetails. 1745func (jd JobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) { 1746 return nil, false 1747} 1748 1749// AsHeavyJobDetails is the BasicJobDetails implementation for JobDetails. 1750func (jd JobDetails) AsHeavyJobDetails() (*HeavyJobDetails, bool) { 1751 return nil, false 1752} 1753 1754// AsJobDetailsType is the BasicJobDetails implementation for JobDetails. 1755func (jd JobDetails) AsJobDetailsType() (*JobDetailsType, bool) { 1756 return nil, false 1757} 1758 1759// AsJobDetails is the BasicJobDetails implementation for JobDetails. 1760func (jd JobDetails) AsJobDetails() (*JobDetails, bool) { 1761 return &jd, true 1762} 1763 1764// AsBasicJobDetails is the BasicJobDetails implementation for JobDetails. 1765func (jd JobDetails) AsBasicJobDetails() (BasicJobDetails, bool) { 1766 return &jd, true 1767} 1768 1769// UnmarshalJSON is the custom unmarshaler for JobDetails struct. 1770func (jd *JobDetails) UnmarshalJSON(body []byte) error { 1771 var m map[string]*json.RawMessage 1772 err := json.Unmarshal(body, &m) 1773 if err != nil { 1774 return err 1775 } 1776 for k, v := range m { 1777 switch k { 1778 case "expectedDataSizeInTeraBytes": 1779 if v != nil { 1780 var expectedDataSizeInTeraBytes int32 1781 err = json.Unmarshal(*v, &expectedDataSizeInTeraBytes) 1782 if err != nil { 1783 return err 1784 } 1785 jd.ExpectedDataSizeInTeraBytes = &expectedDataSizeInTeraBytes 1786 } 1787 case "jobStages": 1788 if v != nil { 1789 var jobStages []JobStages 1790 err = json.Unmarshal(*v, &jobStages) 1791 if err != nil { 1792 return err 1793 } 1794 jd.JobStages = &jobStages 1795 } 1796 case "contactDetails": 1797 if v != nil { 1798 var contactDetails ContactDetails 1799 err = json.Unmarshal(*v, &contactDetails) 1800 if err != nil { 1801 return err 1802 } 1803 jd.ContactDetails = &contactDetails 1804 } 1805 case "shippingAddress": 1806 if v != nil { 1807 var shippingAddress ShippingAddress 1808 err = json.Unmarshal(*v, &shippingAddress) 1809 if err != nil { 1810 return err 1811 } 1812 jd.ShippingAddress = &shippingAddress 1813 } 1814 case "deliveryPackage": 1815 if v != nil { 1816 var deliveryPackage PackageShippingDetails 1817 err = json.Unmarshal(*v, &deliveryPackage) 1818 if err != nil { 1819 return err 1820 } 1821 jd.DeliveryPackage = &deliveryPackage 1822 } 1823 case "returnPackage": 1824 if v != nil { 1825 var returnPackage PackageShippingDetails 1826 err = json.Unmarshal(*v, &returnPackage) 1827 if err != nil { 1828 return err 1829 } 1830 jd.ReturnPackage = &returnPackage 1831 } 1832 case "destinationAccountDetails": 1833 if v != nil { 1834 destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) 1835 if err != nil { 1836 return err 1837 } 1838 jd.DestinationAccountDetails = &destinationAccountDetails 1839 } 1840 case "errorDetails": 1841 if v != nil { 1842 var errorDetails []JobErrorDetails 1843 err = json.Unmarshal(*v, &errorDetails) 1844 if err != nil { 1845 return err 1846 } 1847 jd.ErrorDetails = &errorDetails 1848 } 1849 case "preferences": 1850 if v != nil { 1851 var preferences Preferences 1852 err = json.Unmarshal(*v, &preferences) 1853 if err != nil { 1854 return err 1855 } 1856 jd.Preferences = &preferences 1857 } 1858 case "copyLogDetails": 1859 if v != nil { 1860 copyLogDetails, err := unmarshalBasicCopyLogDetailsArray(*v) 1861 if err != nil { 1862 return err 1863 } 1864 jd.CopyLogDetails = ©LogDetails 1865 } 1866 case "reverseShipmentLabelSasKey": 1867 if v != nil { 1868 var reverseShipmentLabelSasKey string 1869 err = json.Unmarshal(*v, &reverseShipmentLabelSasKey) 1870 if err != nil { 1871 return err 1872 } 1873 jd.ReverseShipmentLabelSasKey = &reverseShipmentLabelSasKey 1874 } 1875 case "chainOfCustodySasKey": 1876 if v != nil { 1877 var chainOfCustodySasKey string 1878 err = json.Unmarshal(*v, &chainOfCustodySasKey) 1879 if err != nil { 1880 return err 1881 } 1882 jd.ChainOfCustodySasKey = &chainOfCustodySasKey 1883 } 1884 case "jobDetailsType": 1885 if v != nil { 1886 var jobDetailsType JobDetailsTypeEnum 1887 err = json.Unmarshal(*v, &jobDetailsType) 1888 if err != nil { 1889 return err 1890 } 1891 jd.JobDetailsType = jobDetailsType 1892 } 1893 } 1894 } 1895 1896 return nil 1897} 1898 1899// JobDetailsType dataBox Job Details 1900type JobDetailsType struct { 1901 // CopyProgress - READ-ONLY; Copy progress per storage account. 1902 CopyProgress *[]CopyProgress `json:"copyProgress,omitempty"` 1903 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transferred in this job, in terabytes. 1904 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 1905 // JobStages - READ-ONLY; List of stages that run in the job. 1906 JobStages *[]JobStages `json:"jobStages,omitempty"` 1907 // ContactDetails - Contact details for notification and shipping. 1908 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 1909 // ShippingAddress - Shipping address of the customer. 1910 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 1911 // DeliveryPackage - READ-ONLY; Delivery package shipping details. 1912 DeliveryPackage *PackageShippingDetails `json:"deliveryPackage,omitempty"` 1913 // ReturnPackage - READ-ONLY; Return package shipping details. 1914 ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` 1915 // DestinationAccountDetails - Destination account details. 1916 DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` 1917 // ErrorDetails - READ-ONLY; Error details for failure. This is optional. 1918 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 1919 // Preferences - Preferences for the order. 1920 Preferences *Preferences `json:"preferences,omitempty"` 1921 // CopyLogDetails - READ-ONLY; List of copy log details. 1922 CopyLogDetails *[]BasicCopyLogDetails `json:"copyLogDetails,omitempty"` 1923 // ReverseShipmentLabelSasKey - READ-ONLY; Shared access key to download the return shipment label 1924 ReverseShipmentLabelSasKey *string `json:"reverseShipmentLabelSasKey,omitempty"` 1925 // ChainOfCustodySasKey - READ-ONLY; Shared access key to download the chain of custody logs 1926 ChainOfCustodySasKey *string `json:"chainOfCustodySasKey,omitempty"` 1927 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDataBoxDisk', 'JobDetailsTypeDataBoxHeavy', 'JobDetailsTypeDataBox' 1928 JobDetailsType JobDetailsTypeEnum `json:"jobDetailsType,omitempty"` 1929} 1930 1931// MarshalJSON is the custom marshaler for JobDetailsType. 1932func (jdt JobDetailsType) MarshalJSON() ([]byte, error) { 1933 jdt.JobDetailsType = JobDetailsTypeDataBox 1934 objectMap := make(map[string]interface{}) 1935 if jdt.ExpectedDataSizeInTeraBytes != nil { 1936 objectMap["expectedDataSizeInTeraBytes"] = jdt.ExpectedDataSizeInTeraBytes 1937 } 1938 if jdt.ContactDetails != nil { 1939 objectMap["contactDetails"] = jdt.ContactDetails 1940 } 1941 if jdt.ShippingAddress != nil { 1942 objectMap["shippingAddress"] = jdt.ShippingAddress 1943 } 1944 if jdt.DestinationAccountDetails != nil { 1945 objectMap["destinationAccountDetails"] = jdt.DestinationAccountDetails 1946 } 1947 if jdt.Preferences != nil { 1948 objectMap["preferences"] = jdt.Preferences 1949 } 1950 if jdt.JobDetailsType != "" { 1951 objectMap["jobDetailsType"] = jdt.JobDetailsType 1952 } 1953 return json.Marshal(objectMap) 1954} 1955 1956// AsDiskJobDetails is the BasicJobDetails implementation for JobDetailsType. 1957func (jdt JobDetailsType) AsDiskJobDetails() (*DiskJobDetails, bool) { 1958 return nil, false 1959} 1960 1961// AsHeavyJobDetails is the BasicJobDetails implementation for JobDetailsType. 1962func (jdt JobDetailsType) AsHeavyJobDetails() (*HeavyJobDetails, bool) { 1963 return nil, false 1964} 1965 1966// AsJobDetailsType is the BasicJobDetails implementation for JobDetailsType. 1967func (jdt JobDetailsType) AsJobDetailsType() (*JobDetailsType, bool) { 1968 return &jdt, true 1969} 1970 1971// AsJobDetails is the BasicJobDetails implementation for JobDetailsType. 1972func (jdt JobDetailsType) AsJobDetails() (*JobDetails, bool) { 1973 return nil, false 1974} 1975 1976// AsBasicJobDetails is the BasicJobDetails implementation for JobDetailsType. 1977func (jdt JobDetailsType) AsBasicJobDetails() (BasicJobDetails, bool) { 1978 return &jdt, true 1979} 1980 1981// UnmarshalJSON is the custom unmarshaler for JobDetailsType struct. 1982func (jdt *JobDetailsType) UnmarshalJSON(body []byte) error { 1983 var m map[string]*json.RawMessage 1984 err := json.Unmarshal(body, &m) 1985 if err != nil { 1986 return err 1987 } 1988 for k, v := range m { 1989 switch k { 1990 case "copyProgress": 1991 if v != nil { 1992 var copyProgress []CopyProgress 1993 err = json.Unmarshal(*v, ©Progress) 1994 if err != nil { 1995 return err 1996 } 1997 jdt.CopyProgress = ©Progress 1998 } 1999 case "expectedDataSizeInTeraBytes": 2000 if v != nil { 2001 var expectedDataSizeInTeraBytes int32 2002 err = json.Unmarshal(*v, &expectedDataSizeInTeraBytes) 2003 if err != nil { 2004 return err 2005 } 2006 jdt.ExpectedDataSizeInTeraBytes = &expectedDataSizeInTeraBytes 2007 } 2008 case "jobStages": 2009 if v != nil { 2010 var jobStages []JobStages 2011 err = json.Unmarshal(*v, &jobStages) 2012 if err != nil { 2013 return err 2014 } 2015 jdt.JobStages = &jobStages 2016 } 2017 case "contactDetails": 2018 if v != nil { 2019 var contactDetails ContactDetails 2020 err = json.Unmarshal(*v, &contactDetails) 2021 if err != nil { 2022 return err 2023 } 2024 jdt.ContactDetails = &contactDetails 2025 } 2026 case "shippingAddress": 2027 if v != nil { 2028 var shippingAddress ShippingAddress 2029 err = json.Unmarshal(*v, &shippingAddress) 2030 if err != nil { 2031 return err 2032 } 2033 jdt.ShippingAddress = &shippingAddress 2034 } 2035 case "deliveryPackage": 2036 if v != nil { 2037 var deliveryPackage PackageShippingDetails 2038 err = json.Unmarshal(*v, &deliveryPackage) 2039 if err != nil { 2040 return err 2041 } 2042 jdt.DeliveryPackage = &deliveryPackage 2043 } 2044 case "returnPackage": 2045 if v != nil { 2046 var returnPackage PackageShippingDetails 2047 err = json.Unmarshal(*v, &returnPackage) 2048 if err != nil { 2049 return err 2050 } 2051 jdt.ReturnPackage = &returnPackage 2052 } 2053 case "destinationAccountDetails": 2054 if v != nil { 2055 destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) 2056 if err != nil { 2057 return err 2058 } 2059 jdt.DestinationAccountDetails = &destinationAccountDetails 2060 } 2061 case "errorDetails": 2062 if v != nil { 2063 var errorDetails []JobErrorDetails 2064 err = json.Unmarshal(*v, &errorDetails) 2065 if err != nil { 2066 return err 2067 } 2068 jdt.ErrorDetails = &errorDetails 2069 } 2070 case "preferences": 2071 if v != nil { 2072 var preferences Preferences 2073 err = json.Unmarshal(*v, &preferences) 2074 if err != nil { 2075 return err 2076 } 2077 jdt.Preferences = &preferences 2078 } 2079 case "copyLogDetails": 2080 if v != nil { 2081 copyLogDetails, err := unmarshalBasicCopyLogDetailsArray(*v) 2082 if err != nil { 2083 return err 2084 } 2085 jdt.CopyLogDetails = ©LogDetails 2086 } 2087 case "reverseShipmentLabelSasKey": 2088 if v != nil { 2089 var reverseShipmentLabelSasKey string 2090 err = json.Unmarshal(*v, &reverseShipmentLabelSasKey) 2091 if err != nil { 2092 return err 2093 } 2094 jdt.ReverseShipmentLabelSasKey = &reverseShipmentLabelSasKey 2095 } 2096 case "chainOfCustodySasKey": 2097 if v != nil { 2098 var chainOfCustodySasKey string 2099 err = json.Unmarshal(*v, &chainOfCustodySasKey) 2100 if err != nil { 2101 return err 2102 } 2103 jdt.ChainOfCustodySasKey = &chainOfCustodySasKey 2104 } 2105 case "jobDetailsType": 2106 if v != nil { 2107 var jobDetailsType JobDetailsTypeEnum 2108 err = json.Unmarshal(*v, &jobDetailsType) 2109 if err != nil { 2110 return err 2111 } 2112 jdt.JobDetailsType = jobDetailsType 2113 } 2114 } 2115 } 2116 2117 return nil 2118} 2119 2120// JobErrorDetails job Error Details for providing the information and recommended action. 2121type JobErrorDetails struct { 2122 // ErrorMessage - READ-ONLY; Message for the error. 2123 ErrorMessage *string `json:"errorMessage,omitempty"` 2124 // ErrorCode - READ-ONLY; Code for the error. 2125 ErrorCode *int32 `json:"errorCode,omitempty"` 2126 // RecommendedAction - READ-ONLY; Recommended action for the error. 2127 RecommendedAction *string `json:"recommendedAction,omitempty"` 2128 // ExceptionMessage - READ-ONLY; Contains the non localized exception message 2129 ExceptionMessage *string `json:"exceptionMessage,omitempty"` 2130} 2131 2132// JobProperties job Properties 2133type JobProperties struct { 2134 // IsCancellable - READ-ONLY; Describes whether the job is cancellable or not. 2135 IsCancellable *bool `json:"isCancellable,omitempty"` 2136 // IsDeletable - READ-ONLY; Describes whether the job is deletable or not. 2137 IsDeletable *bool `json:"isDeletable,omitempty"` 2138 // IsShippingAddressEditable - READ-ONLY; Describes whether the shipping address is editable or not. 2139 IsShippingAddressEditable *bool `json:"isShippingAddressEditable,omitempty"` 2140 // Status - READ-ONLY; Name of the stage which is in progress. Possible values include: 'StageNameDeviceOrdered', 'StageNameDevicePrepared', 'StageNameDispatched', 'StageNameDelivered', 'StageNamePickedUp', 'StageNameAtAzureDC', 'StageNameDataCopy', 'StageNameCompleted', 'StageNameCompletedWithErrors', 'StageNameCancelled', 'StageNameFailedIssueReportedAtCustomer', 'StageNameFailedIssueDetectedAtAzureDC', 'StageNameAborted' 2141 Status StageName `json:"status,omitempty"` 2142 // StartTime - READ-ONLY; Time at which the job was started in UTC ISO 8601 format. 2143 StartTime *date.Time `json:"startTime,omitempty"` 2144 // Error - READ-ONLY; Top level error for the job. 2145 Error *Error `json:"error,omitempty"` 2146 // Details - Details of a job run. This field will only be sent for expand details filter. 2147 Details BasicJobDetails `json:"details,omitempty"` 2148 // CancellationReason - READ-ONLY; Reason for cancellation. 2149 CancellationReason *string `json:"cancellationReason,omitempty"` 2150} 2151 2152// UnmarshalJSON is the custom unmarshaler for JobProperties struct. 2153func (jp *JobProperties) UnmarshalJSON(body []byte) error { 2154 var m map[string]*json.RawMessage 2155 err := json.Unmarshal(body, &m) 2156 if err != nil { 2157 return err 2158 } 2159 for k, v := range m { 2160 switch k { 2161 case "isCancellable": 2162 if v != nil { 2163 var isCancellable bool 2164 err = json.Unmarshal(*v, &isCancellable) 2165 if err != nil { 2166 return err 2167 } 2168 jp.IsCancellable = &isCancellable 2169 } 2170 case "isDeletable": 2171 if v != nil { 2172 var isDeletable bool 2173 err = json.Unmarshal(*v, &isDeletable) 2174 if err != nil { 2175 return err 2176 } 2177 jp.IsDeletable = &isDeletable 2178 } 2179 case "isShippingAddressEditable": 2180 if v != nil { 2181 var isShippingAddressEditable bool 2182 err = json.Unmarshal(*v, &isShippingAddressEditable) 2183 if err != nil { 2184 return err 2185 } 2186 jp.IsShippingAddressEditable = &isShippingAddressEditable 2187 } 2188 case "status": 2189 if v != nil { 2190 var status StageName 2191 err = json.Unmarshal(*v, &status) 2192 if err != nil { 2193 return err 2194 } 2195 jp.Status = status 2196 } 2197 case "startTime": 2198 if v != nil { 2199 var startTime date.Time 2200 err = json.Unmarshal(*v, &startTime) 2201 if err != nil { 2202 return err 2203 } 2204 jp.StartTime = &startTime 2205 } 2206 case "error": 2207 if v != nil { 2208 var errorVar Error 2209 err = json.Unmarshal(*v, &errorVar) 2210 if err != nil { 2211 return err 2212 } 2213 jp.Error = &errorVar 2214 } 2215 case "details": 2216 if v != nil { 2217 details, err := unmarshalBasicJobDetails(*v) 2218 if err != nil { 2219 return err 2220 } 2221 jp.Details = details 2222 } 2223 case "cancellationReason": 2224 if v != nil { 2225 var cancellationReason string 2226 err = json.Unmarshal(*v, &cancellationReason) 2227 if err != nil { 2228 return err 2229 } 2230 jp.CancellationReason = &cancellationReason 2231 } 2232 } 2233 } 2234 2235 return nil 2236} 2237 2238// JobResource job Resource. 2239type JobResource struct { 2240 autorest.Response `json:"-"` 2241 // JobProperties - Properties of a job. 2242 *JobProperties `json:"properties,omitempty"` 2243 // Name - READ-ONLY; Name of the object. 2244 Name *string `json:"name,omitempty"` 2245 // ID - READ-ONLY; Id of the object. 2246 ID *string `json:"id,omitempty"` 2247 // Type - READ-ONLY; Type of the object. 2248 Type *string `json:"type,omitempty"` 2249 // Location - The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed. 2250 Location *string `json:"location,omitempty"` 2251 // Tags - The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). 2252 Tags map[string]*string `json:"tags"` 2253 // Sku - The sku type. 2254 Sku *Sku `json:"sku,omitempty"` 2255} 2256 2257// MarshalJSON is the custom marshaler for JobResource. 2258func (jr JobResource) MarshalJSON() ([]byte, error) { 2259 objectMap := make(map[string]interface{}) 2260 if jr.JobProperties != nil { 2261 objectMap["properties"] = jr.JobProperties 2262 } 2263 if jr.Location != nil { 2264 objectMap["location"] = jr.Location 2265 } 2266 if jr.Tags != nil { 2267 objectMap["tags"] = jr.Tags 2268 } 2269 if jr.Sku != nil { 2270 objectMap["sku"] = jr.Sku 2271 } 2272 return json.Marshal(objectMap) 2273} 2274 2275// UnmarshalJSON is the custom unmarshaler for JobResource struct. 2276func (jr *JobResource) UnmarshalJSON(body []byte) error { 2277 var m map[string]*json.RawMessage 2278 err := json.Unmarshal(body, &m) 2279 if err != nil { 2280 return err 2281 } 2282 for k, v := range m { 2283 switch k { 2284 case "properties": 2285 if v != nil { 2286 var jobProperties JobProperties 2287 err = json.Unmarshal(*v, &jobProperties) 2288 if err != nil { 2289 return err 2290 } 2291 jr.JobProperties = &jobProperties 2292 } 2293 case "name": 2294 if v != nil { 2295 var name string 2296 err = json.Unmarshal(*v, &name) 2297 if err != nil { 2298 return err 2299 } 2300 jr.Name = &name 2301 } 2302 case "id": 2303 if v != nil { 2304 var ID string 2305 err = json.Unmarshal(*v, &ID) 2306 if err != nil { 2307 return err 2308 } 2309 jr.ID = &ID 2310 } 2311 case "type": 2312 if v != nil { 2313 var typeVar string 2314 err = json.Unmarshal(*v, &typeVar) 2315 if err != nil { 2316 return err 2317 } 2318 jr.Type = &typeVar 2319 } 2320 case "location": 2321 if v != nil { 2322 var location string 2323 err = json.Unmarshal(*v, &location) 2324 if err != nil { 2325 return err 2326 } 2327 jr.Location = &location 2328 } 2329 case "tags": 2330 if v != nil { 2331 var tags map[string]*string 2332 err = json.Unmarshal(*v, &tags) 2333 if err != nil { 2334 return err 2335 } 2336 jr.Tags = tags 2337 } 2338 case "sku": 2339 if v != nil { 2340 var sku Sku 2341 err = json.Unmarshal(*v, &sku) 2342 if err != nil { 2343 return err 2344 } 2345 jr.Sku = &sku 2346 } 2347 } 2348 } 2349 2350 return nil 2351} 2352 2353// JobResourceList job Resource Collection 2354type JobResourceList struct { 2355 autorest.Response `json:"-"` 2356 // Value - List of job resources. 2357 Value *[]JobResource `json:"value,omitempty"` 2358 // NextLink - Link for the next set of job resources. 2359 NextLink *string `json:"nextLink,omitempty"` 2360} 2361 2362// JobResourceListIterator provides access to a complete listing of JobResource values. 2363type JobResourceListIterator struct { 2364 i int 2365 page JobResourceListPage 2366} 2367 2368// NextWithContext advances to the next value. If there was an error making 2369// the request the iterator does not advance and the error is returned. 2370func (iter *JobResourceListIterator) NextWithContext(ctx context.Context) (err error) { 2371 if tracing.IsEnabled() { 2372 ctx = tracing.StartSpan(ctx, fqdn+"/JobResourceListIterator.NextWithContext") 2373 defer func() { 2374 sc := -1 2375 if iter.Response().Response.Response != nil { 2376 sc = iter.Response().Response.Response.StatusCode 2377 } 2378 tracing.EndSpan(ctx, sc, err) 2379 }() 2380 } 2381 iter.i++ 2382 if iter.i < len(iter.page.Values()) { 2383 return nil 2384 } 2385 err = iter.page.NextWithContext(ctx) 2386 if err != nil { 2387 iter.i-- 2388 return err 2389 } 2390 iter.i = 0 2391 return nil 2392} 2393 2394// Next advances to the next value. If there was an error making 2395// the request the iterator does not advance and the error is returned. 2396// Deprecated: Use NextWithContext() instead. 2397func (iter *JobResourceListIterator) Next() error { 2398 return iter.NextWithContext(context.Background()) 2399} 2400 2401// NotDone returns true if the enumeration should be started or is not yet complete. 2402func (iter JobResourceListIterator) NotDone() bool { 2403 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2404} 2405 2406// Response returns the raw server response from the last page request. 2407func (iter JobResourceListIterator) Response() JobResourceList { 2408 return iter.page.Response() 2409} 2410 2411// Value returns the current value or a zero-initialized value if the 2412// iterator has advanced beyond the end of the collection. 2413func (iter JobResourceListIterator) Value() JobResource { 2414 if !iter.page.NotDone() { 2415 return JobResource{} 2416 } 2417 return iter.page.Values()[iter.i] 2418} 2419 2420// Creates a new instance of the JobResourceListIterator type. 2421func NewJobResourceListIterator(page JobResourceListPage) JobResourceListIterator { 2422 return JobResourceListIterator{page: page} 2423} 2424 2425// IsEmpty returns true if the ListResult contains no values. 2426func (jrl JobResourceList) IsEmpty() bool { 2427 return jrl.Value == nil || len(*jrl.Value) == 0 2428} 2429 2430// jobResourceListPreparer prepares a request to retrieve the next set of results. 2431// It returns nil if no more results exist. 2432func (jrl JobResourceList) jobResourceListPreparer(ctx context.Context) (*http.Request, error) { 2433 if jrl.NextLink == nil || len(to.String(jrl.NextLink)) < 1 { 2434 return nil, nil 2435 } 2436 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2437 autorest.AsJSON(), 2438 autorest.AsGet(), 2439 autorest.WithBaseURL(to.String(jrl.NextLink))) 2440} 2441 2442// JobResourceListPage contains a page of JobResource values. 2443type JobResourceListPage struct { 2444 fn func(context.Context, JobResourceList) (JobResourceList, error) 2445 jrl JobResourceList 2446} 2447 2448// NextWithContext advances to the next page of values. If there was an error making 2449// the request the page does not advance and the error is returned. 2450func (page *JobResourceListPage) NextWithContext(ctx context.Context) (err error) { 2451 if tracing.IsEnabled() { 2452 ctx = tracing.StartSpan(ctx, fqdn+"/JobResourceListPage.NextWithContext") 2453 defer func() { 2454 sc := -1 2455 if page.Response().Response.Response != nil { 2456 sc = page.Response().Response.Response.StatusCode 2457 } 2458 tracing.EndSpan(ctx, sc, err) 2459 }() 2460 } 2461 next, err := page.fn(ctx, page.jrl) 2462 if err != nil { 2463 return err 2464 } 2465 page.jrl = next 2466 return nil 2467} 2468 2469// Next advances to the next page of values. If there was an error making 2470// the request the page does not advance and the error is returned. 2471// Deprecated: Use NextWithContext() instead. 2472func (page *JobResourceListPage) Next() error { 2473 return page.NextWithContext(context.Background()) 2474} 2475 2476// NotDone returns true if the page enumeration should be started or is not yet complete. 2477func (page JobResourceListPage) NotDone() bool { 2478 return !page.jrl.IsEmpty() 2479} 2480 2481// Response returns the raw server response from the last page request. 2482func (page JobResourceListPage) Response() JobResourceList { 2483 return page.jrl 2484} 2485 2486// Values returns the slice of values for the current page or nil if there are no values. 2487func (page JobResourceListPage) Values() []JobResource { 2488 if page.jrl.IsEmpty() { 2489 return nil 2490 } 2491 return *page.jrl.Value 2492} 2493 2494// Creates a new instance of the JobResourceListPage type. 2495func NewJobResourceListPage(getNextPage func(context.Context, JobResourceList) (JobResourceList, error)) JobResourceListPage { 2496 return JobResourceListPage{fn: getNextPage} 2497} 2498 2499// JobResourceUpdateParameter the JobResourceUpdateParameter. 2500type JobResourceUpdateParameter struct { 2501 // UpdateJobProperties - Properties of a job to be updated. 2502 *UpdateJobProperties `json:"properties,omitempty"` 2503 // Tags - The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). 2504 Tags map[string]*string `json:"tags"` 2505} 2506 2507// MarshalJSON is the custom marshaler for JobResourceUpdateParameter. 2508func (jrup JobResourceUpdateParameter) MarshalJSON() ([]byte, error) { 2509 objectMap := make(map[string]interface{}) 2510 if jrup.UpdateJobProperties != nil { 2511 objectMap["properties"] = jrup.UpdateJobProperties 2512 } 2513 if jrup.Tags != nil { 2514 objectMap["tags"] = jrup.Tags 2515 } 2516 return json.Marshal(objectMap) 2517} 2518 2519// UnmarshalJSON is the custom unmarshaler for JobResourceUpdateParameter struct. 2520func (jrup *JobResourceUpdateParameter) UnmarshalJSON(body []byte) error { 2521 var m map[string]*json.RawMessage 2522 err := json.Unmarshal(body, &m) 2523 if err != nil { 2524 return err 2525 } 2526 for k, v := range m { 2527 switch k { 2528 case "properties": 2529 if v != nil { 2530 var updateJobProperties UpdateJobProperties 2531 err = json.Unmarshal(*v, &updateJobProperties) 2532 if err != nil { 2533 return err 2534 } 2535 jrup.UpdateJobProperties = &updateJobProperties 2536 } 2537 case "tags": 2538 if v != nil { 2539 var tags map[string]*string 2540 err = json.Unmarshal(*v, &tags) 2541 if err != nil { 2542 return err 2543 } 2544 jrup.Tags = tags 2545 } 2546 } 2547 } 2548 2549 return nil 2550} 2551 2552// JobsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2553type JobsCreateFuture struct { 2554 azure.Future 2555} 2556 2557// Result returns the result of the asynchronous operation. 2558// If the operation has not completed it will return an error. 2559func (future *JobsCreateFuture) Result(client JobsClient) (jr JobResource, err error) { 2560 var done bool 2561 done, err = future.DoneWithContext(context.Background(), client) 2562 if err != nil { 2563 err = autorest.NewErrorWithError(err, "databox.JobsCreateFuture", "Result", future.Response(), "Polling failure") 2564 return 2565 } 2566 if !done { 2567 err = azure.NewAsyncOpIncompleteError("databox.JobsCreateFuture") 2568 return 2569 } 2570 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2571 if jr.Response.Response, err = future.GetResult(sender); err == nil && jr.Response.Response.StatusCode != http.StatusNoContent { 2572 jr, err = client.CreateResponder(jr.Response.Response) 2573 if err != nil { 2574 err = autorest.NewErrorWithError(err, "databox.JobsCreateFuture", "Result", jr.Response.Response, "Failure responding to request") 2575 } 2576 } 2577 return 2578} 2579 2580// JobsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2581type JobsDeleteFuture struct { 2582 azure.Future 2583} 2584 2585// Result returns the result of the asynchronous operation. 2586// If the operation has not completed it will return an error. 2587func (future *JobsDeleteFuture) Result(client JobsClient) (ar autorest.Response, err error) { 2588 var done bool 2589 done, err = future.DoneWithContext(context.Background(), client) 2590 if err != nil { 2591 err = autorest.NewErrorWithError(err, "databox.JobsDeleteFuture", "Result", future.Response(), "Polling failure") 2592 return 2593 } 2594 if !done { 2595 err = azure.NewAsyncOpIncompleteError("databox.JobsDeleteFuture") 2596 return 2597 } 2598 ar.Response = future.Response() 2599 return 2600} 2601 2602// BasicJobSecrets the base class for the secrets 2603type BasicJobSecrets interface { 2604 AsDiskJobSecrets() (*DiskJobSecrets, bool) 2605 AsHeavyJobSecrets() (*HeavyJobSecrets, bool) 2606 AsJobSecretsType() (*JobSecretsType, bool) 2607 AsJobSecrets() (*JobSecrets, bool) 2608} 2609 2610// JobSecrets the base class for the secrets 2611type JobSecrets struct { 2612 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeDataBoxDisk', 'JobSecretsTypeDataBoxHeavy', 'JobSecretsTypeDataBox' 2613 JobSecretsType JobSecretsTypeEnum `json:"jobSecretsType,omitempty"` 2614} 2615 2616func unmarshalBasicJobSecrets(body []byte) (BasicJobSecrets, error) { 2617 var m map[string]interface{} 2618 err := json.Unmarshal(body, &m) 2619 if err != nil { 2620 return nil, err 2621 } 2622 2623 switch m["jobSecretsType"] { 2624 case string(JobSecretsTypeDataBoxDisk): 2625 var djs DiskJobSecrets 2626 err := json.Unmarshal(body, &djs) 2627 return djs, err 2628 case string(JobSecretsTypeDataBoxHeavy): 2629 var hjs HeavyJobSecrets 2630 err := json.Unmarshal(body, &hjs) 2631 return hjs, err 2632 case string(JobSecretsTypeDataBox): 2633 var jst JobSecretsType 2634 err := json.Unmarshal(body, &jst) 2635 return jst, err 2636 default: 2637 var js JobSecrets 2638 err := json.Unmarshal(body, &js) 2639 return js, err 2640 } 2641} 2642func unmarshalBasicJobSecretsArray(body []byte) ([]BasicJobSecrets, error) { 2643 var rawMessages []*json.RawMessage 2644 err := json.Unmarshal(body, &rawMessages) 2645 if err != nil { 2646 return nil, err 2647 } 2648 2649 jsArray := make([]BasicJobSecrets, len(rawMessages)) 2650 2651 for index, rawMessage := range rawMessages { 2652 js, err := unmarshalBasicJobSecrets(*rawMessage) 2653 if err != nil { 2654 return nil, err 2655 } 2656 jsArray[index] = js 2657 } 2658 return jsArray, nil 2659} 2660 2661// MarshalJSON is the custom marshaler for JobSecrets. 2662func (js JobSecrets) MarshalJSON() ([]byte, error) { 2663 js.JobSecretsType = JobSecretsTypeJobSecrets 2664 objectMap := make(map[string]interface{}) 2665 if js.JobSecretsType != "" { 2666 objectMap["jobSecretsType"] = js.JobSecretsType 2667 } 2668 return json.Marshal(objectMap) 2669} 2670 2671// AsDiskJobSecrets is the BasicJobSecrets implementation for JobSecrets. 2672func (js JobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 2673 return nil, false 2674} 2675 2676// AsHeavyJobSecrets is the BasicJobSecrets implementation for JobSecrets. 2677func (js JobSecrets) AsHeavyJobSecrets() (*HeavyJobSecrets, bool) { 2678 return nil, false 2679} 2680 2681// AsJobSecretsType is the BasicJobSecrets implementation for JobSecrets. 2682func (js JobSecrets) AsJobSecretsType() (*JobSecretsType, bool) { 2683 return nil, false 2684} 2685 2686// AsJobSecrets is the BasicJobSecrets implementation for JobSecrets. 2687func (js JobSecrets) AsJobSecrets() (*JobSecrets, bool) { 2688 return &js, true 2689} 2690 2691// AsBasicJobSecrets is the BasicJobSecrets implementation for JobSecrets. 2692func (js JobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 2693 return &js, true 2694} 2695 2696// JobSecretsType the secrets related to a DataBox job. 2697type JobSecretsType struct { 2698 // PodSecrets - Contains the list of secret objects for a job. 2699 PodSecrets *[]Secret `json:"podSecrets,omitempty"` 2700 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeDataBoxDisk', 'JobSecretsTypeDataBoxHeavy', 'JobSecretsTypeDataBox' 2701 JobSecretsType JobSecretsTypeEnum `json:"jobSecretsType,omitempty"` 2702} 2703 2704// MarshalJSON is the custom marshaler for JobSecretsType. 2705func (jst JobSecretsType) MarshalJSON() ([]byte, error) { 2706 jst.JobSecretsType = JobSecretsTypeDataBox 2707 objectMap := make(map[string]interface{}) 2708 if jst.PodSecrets != nil { 2709 objectMap["podSecrets"] = jst.PodSecrets 2710 } 2711 if jst.JobSecretsType != "" { 2712 objectMap["jobSecretsType"] = jst.JobSecretsType 2713 } 2714 return json.Marshal(objectMap) 2715} 2716 2717// AsDiskJobSecrets is the BasicJobSecrets implementation for JobSecretsType. 2718func (jst JobSecretsType) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 2719 return nil, false 2720} 2721 2722// AsHeavyJobSecrets is the BasicJobSecrets implementation for JobSecretsType. 2723func (jst JobSecretsType) AsHeavyJobSecrets() (*HeavyJobSecrets, bool) { 2724 return nil, false 2725} 2726 2727// AsJobSecretsType is the BasicJobSecrets implementation for JobSecretsType. 2728func (jst JobSecretsType) AsJobSecretsType() (*JobSecretsType, bool) { 2729 return &jst, true 2730} 2731 2732// AsJobSecrets is the BasicJobSecrets implementation for JobSecretsType. 2733func (jst JobSecretsType) AsJobSecrets() (*JobSecrets, bool) { 2734 return nil, false 2735} 2736 2737// AsBasicJobSecrets is the BasicJobSecrets implementation for JobSecretsType. 2738func (jst JobSecretsType) AsBasicJobSecrets() (BasicJobSecrets, bool) { 2739 return &jst, true 2740} 2741 2742// JobStages job stages. 2743type JobStages struct { 2744 // StageName - READ-ONLY; Name of the job stage. Possible values include: 'StageNameDeviceOrdered', 'StageNameDevicePrepared', 'StageNameDispatched', 'StageNameDelivered', 'StageNamePickedUp', 'StageNameAtAzureDC', 'StageNameDataCopy', 'StageNameCompleted', 'StageNameCompletedWithErrors', 'StageNameCancelled', 'StageNameFailedIssueReportedAtCustomer', 'StageNameFailedIssueDetectedAtAzureDC', 'StageNameAborted' 2745 StageName StageName `json:"stageName,omitempty"` 2746 // DisplayName - READ-ONLY; Display name of the job stage. 2747 DisplayName *string `json:"displayName,omitempty"` 2748 // StageStatus - READ-ONLY; Status of the job stage. Possible values include: 'StageStatusNone', 'StageStatusInProgress', 'StageStatusSucceeded', 'StageStatusFailed', 'StageStatusCancelled', 'StageStatusCancelling', 'StageStatusSucceededWithErrors' 2749 StageStatus StageStatus `json:"stageStatus,omitempty"` 2750 // StageTime - READ-ONLY; Time for the job stage in UTC ISO 8601 format. 2751 StageTime *date.Time `json:"stageTime,omitempty"` 2752 // JobStageDetails - READ-ONLY; Job Stage Details 2753 JobStageDetails interface{} `json:"jobStageDetails,omitempty"` 2754 // ErrorDetails - READ-ONLY; Error details for the stage. 2755 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 2756} 2757 2758// JobsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 2759type JobsUpdateFuture struct { 2760 azure.Future 2761} 2762 2763// Result returns the result of the asynchronous operation. 2764// If the operation has not completed it will return an error. 2765func (future *JobsUpdateFuture) Result(client JobsClient) (jr JobResource, err error) { 2766 var done bool 2767 done, err = future.DoneWithContext(context.Background(), client) 2768 if err != nil { 2769 err = autorest.NewErrorWithError(err, "databox.JobsUpdateFuture", "Result", future.Response(), "Polling failure") 2770 return 2771 } 2772 if !done { 2773 err = azure.NewAsyncOpIncompleteError("databox.JobsUpdateFuture") 2774 return 2775 } 2776 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 2777 if jr.Response.Response, err = future.GetResult(sender); err == nil && jr.Response.Response.StatusCode != http.StatusNoContent { 2778 jr, err = client.UpdateResponder(jr.Response.Response) 2779 if err != nil { 2780 err = autorest.NewErrorWithError(err, "databox.JobsUpdateFuture", "Result", jr.Response.Response, "Failure responding to request") 2781 } 2782 } 2783 return 2784} 2785 2786// NotificationPreference notification preference for a job stage. 2787type NotificationPreference struct { 2788 // StageName - Name of the stage. Possible values include: 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy' 2789 StageName NotificationStageName `json:"stageName,omitempty"` 2790 // SendNotification - Notification is required or not. 2791 SendNotification *bool `json:"sendNotification,omitempty"` 2792} 2793 2794// Operation operation entity. 2795type Operation struct { 2796 // Name - READ-ONLY; Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} 2797 Name *string `json:"name,omitempty"` 2798 // Display - READ-ONLY; Operation display values. 2799 Display *OperationDisplay `json:"display,omitempty"` 2800 // Properties - READ-ONLY; Operation properties. 2801 Properties interface{} `json:"properties,omitempty"` 2802 // Origin - READ-ONLY; Origin of the operation. Can be : user|system|user,system 2803 Origin *string `json:"origin,omitempty"` 2804} 2805 2806// OperationDisplay operation display 2807type OperationDisplay struct { 2808 // Provider - Provider name. 2809 Provider *string `json:"provider,omitempty"` 2810 // Resource - Resource name. 2811 Resource *string `json:"resource,omitempty"` 2812 // Operation - Localized name of the operation for display purpose. 2813 Operation *string `json:"operation,omitempty"` 2814 // Description - Localized description of the operation for display purpose. 2815 Description *string `json:"description,omitempty"` 2816} 2817 2818// OperationList operation Collection. 2819type OperationList struct { 2820 autorest.Response `json:"-"` 2821 // Value - READ-ONLY; List of operations. 2822 Value *[]Operation `json:"value,omitempty"` 2823 // NextLink - Link for the next set of operations. 2824 NextLink *string `json:"nextLink,omitempty"` 2825} 2826 2827// OperationListIterator provides access to a complete listing of Operation values. 2828type OperationListIterator struct { 2829 i int 2830 page OperationListPage 2831} 2832 2833// NextWithContext advances to the next value. If there was an error making 2834// the request the iterator does not advance and the error is returned. 2835func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { 2836 if tracing.IsEnabled() { 2837 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") 2838 defer func() { 2839 sc := -1 2840 if iter.Response().Response.Response != nil { 2841 sc = iter.Response().Response.Response.StatusCode 2842 } 2843 tracing.EndSpan(ctx, sc, err) 2844 }() 2845 } 2846 iter.i++ 2847 if iter.i < len(iter.page.Values()) { 2848 return nil 2849 } 2850 err = iter.page.NextWithContext(ctx) 2851 if err != nil { 2852 iter.i-- 2853 return err 2854 } 2855 iter.i = 0 2856 return nil 2857} 2858 2859// Next advances to the next value. If there was an error making 2860// the request the iterator does not advance and the error is returned. 2861// Deprecated: Use NextWithContext() instead. 2862func (iter *OperationListIterator) Next() error { 2863 return iter.NextWithContext(context.Background()) 2864} 2865 2866// NotDone returns true if the enumeration should be started or is not yet complete. 2867func (iter OperationListIterator) NotDone() bool { 2868 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 2869} 2870 2871// Response returns the raw server response from the last page request. 2872func (iter OperationListIterator) Response() OperationList { 2873 return iter.page.Response() 2874} 2875 2876// Value returns the current value or a zero-initialized value if the 2877// iterator has advanced beyond the end of the collection. 2878func (iter OperationListIterator) Value() Operation { 2879 if !iter.page.NotDone() { 2880 return Operation{} 2881 } 2882 return iter.page.Values()[iter.i] 2883} 2884 2885// Creates a new instance of the OperationListIterator type. 2886func NewOperationListIterator(page OperationListPage) OperationListIterator { 2887 return OperationListIterator{page: page} 2888} 2889 2890// IsEmpty returns true if the ListResult contains no values. 2891func (ol OperationList) IsEmpty() bool { 2892 return ol.Value == nil || len(*ol.Value) == 0 2893} 2894 2895// operationListPreparer prepares a request to retrieve the next set of results. 2896// It returns nil if no more results exist. 2897func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { 2898 if ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 { 2899 return nil, nil 2900 } 2901 return autorest.Prepare((&http.Request{}).WithContext(ctx), 2902 autorest.AsJSON(), 2903 autorest.AsGet(), 2904 autorest.WithBaseURL(to.String(ol.NextLink))) 2905} 2906 2907// OperationListPage contains a page of Operation values. 2908type OperationListPage struct { 2909 fn func(context.Context, OperationList) (OperationList, error) 2910 ol OperationList 2911} 2912 2913// NextWithContext advances to the next page of values. If there was an error making 2914// the request the page does not advance and the error is returned. 2915func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { 2916 if tracing.IsEnabled() { 2917 ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") 2918 defer func() { 2919 sc := -1 2920 if page.Response().Response.Response != nil { 2921 sc = page.Response().Response.Response.StatusCode 2922 } 2923 tracing.EndSpan(ctx, sc, err) 2924 }() 2925 } 2926 next, err := page.fn(ctx, page.ol) 2927 if err != nil { 2928 return err 2929 } 2930 page.ol = next 2931 return nil 2932} 2933 2934// Next advances to the next page of values. If there was an error making 2935// the request the page does not advance and the error is returned. 2936// Deprecated: Use NextWithContext() instead. 2937func (page *OperationListPage) Next() error { 2938 return page.NextWithContext(context.Background()) 2939} 2940 2941// NotDone returns true if the page enumeration should be started or is not yet complete. 2942func (page OperationListPage) NotDone() bool { 2943 return !page.ol.IsEmpty() 2944} 2945 2946// Response returns the raw server response from the last page request. 2947func (page OperationListPage) Response() OperationList { 2948 return page.ol 2949} 2950 2951// Values returns the slice of values for the current page or nil if there are no values. 2952func (page OperationListPage) Values() []Operation { 2953 if page.ol.IsEmpty() { 2954 return nil 2955 } 2956 return *page.ol.Value 2957} 2958 2959// Creates a new instance of the OperationListPage type. 2960func NewOperationListPage(getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { 2961 return OperationListPage{fn: getNextPage} 2962} 2963 2964// PackageShippingDetails shipping details. 2965type PackageShippingDetails struct { 2966 // CarrierName - READ-ONLY; Name of the carrier. 2967 CarrierName *string `json:"carrierName,omitempty"` 2968 // TrackingID - READ-ONLY; Tracking Id of shipment. 2969 TrackingID *string `json:"trackingId,omitempty"` 2970 // TrackingURL - READ-ONLY; Url where shipment can be tracked. 2971 TrackingURL *string `json:"trackingUrl,omitempty"` 2972} 2973 2974// Preferences preferences related to the order 2975type Preferences struct { 2976 PreferredDataCenterRegion *[]string `json:"preferredDataCenterRegion,omitempty"` 2977} 2978 2979// Resource model of the Resource. 2980type Resource struct { 2981 // Location - The location of the resource. This will be one of the supported and registered Azure Regions (e.g. West US, East US, Southeast Asia, etc.). The region of a resource cannot be changed once it is created, but if an identical region is specified on update the request will succeed. 2982 Location *string `json:"location,omitempty"` 2983 // Tags - The list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). 2984 Tags map[string]*string `json:"tags"` 2985 // Sku - The sku type. 2986 Sku *Sku `json:"sku,omitempty"` 2987} 2988 2989// MarshalJSON is the custom marshaler for Resource. 2990func (r Resource) MarshalJSON() ([]byte, error) { 2991 objectMap := make(map[string]interface{}) 2992 if r.Location != nil { 2993 objectMap["location"] = r.Location 2994 } 2995 if r.Tags != nil { 2996 objectMap["tags"] = r.Tags 2997 } 2998 if r.Sku != nil { 2999 objectMap["sku"] = r.Sku 3000 } 3001 return json.Marshal(objectMap) 3002} 3003 3004// Secret the secrets related to a DataBox. 3005type Secret struct { 3006 // DeviceSerialNumber - READ-ONLY; Serial number of the assigned device. 3007 DeviceSerialNumber *string `json:"deviceSerialNumber,omitempty"` 3008 // DevicePassword - READ-ONLY; Password for out of the box experience on device. 3009 DevicePassword *string `json:"devicePassword,omitempty"` 3010 // NetworkConfigurations - READ-ONLY; Network configuration of the appliance. 3011 NetworkConfigurations *[]ApplianceNetworkConfiguration `json:"networkConfigurations,omitempty"` 3012 // EncodedValidationCertPubKey - READ-ONLY; The base 64 encoded public key to authenticate with the device 3013 EncodedValidationCertPubKey *string `json:"encodedValidationCertPubKey,omitempty"` 3014 // AccountCredentialDetails - READ-ONLY; Per account level access credentials. 3015 AccountCredentialDetails *[]AccountCredentialDetails `json:"accountCredentialDetails,omitempty"` 3016} 3017 3018// ShareCredentialDetails credential details of the shares in account. 3019type ShareCredentialDetails struct { 3020 // ShareName - READ-ONLY; Name of the share. 3021 ShareName *string `json:"shareName,omitempty"` 3022 // ShareType - READ-ONLY; Type of the share. Possible values include: 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', 'AzureFile', 'ManagedDisk' 3023 ShareType ShareDestinationFormatType `json:"shareType,omitempty"` 3024 // UserName - READ-ONLY; User name for the share. 3025 UserName *string `json:"userName,omitempty"` 3026 // Password - READ-ONLY; Password for the share. 3027 Password *string `json:"password,omitempty"` 3028 // SupportedAccessProtocols - READ-ONLY; Access protocols supported on the device. 3029 SupportedAccessProtocols *[]AccessProtocol `json:"supportedAccessProtocols,omitempty"` 3030} 3031 3032// ShipmentPickUpRequest shipment pick up request details. 3033type ShipmentPickUpRequest struct { 3034 // StartTime - Minimum date after which the pick up should commence, this must be in local time of pick up area. 3035 StartTime *date.Time `json:"startTime,omitempty"` 3036 // EndTime - Maximum date before which the pick up should commence, this must be in local time of pick up area. 3037 EndTime *date.Time `json:"endTime,omitempty"` 3038 // ShipmentLocation - Shipment Location in the pickup place. Eg.front desk 3039 ShipmentLocation *string `json:"shipmentLocation,omitempty"` 3040} 3041 3042// ShipmentPickUpResponse shipment pick up response. 3043type ShipmentPickUpResponse struct { 3044 autorest.Response `json:"-"` 3045 // ConfirmationNumber - READ-ONLY; Confirmation number for the pick up request. 3046 ConfirmationNumber *string `json:"confirmationNumber,omitempty"` 3047 // ReadyByTime - READ-ONLY; Time by which shipment should be ready for pick up, this is in local time of pick up area. 3048 ReadyByTime *date.Time `json:"readyByTime,omitempty"` 3049} 3050 3051// ShippingAddress shipping address where customer wishes to receive the device. 3052type ShippingAddress struct { 3053 // StreetAddress1 - Street Address line 1. 3054 StreetAddress1 *string `json:"streetAddress1,omitempty"` 3055 // StreetAddress2 - Street Address line 2. 3056 StreetAddress2 *string `json:"streetAddress2,omitempty"` 3057 // StreetAddress3 - Street Address line 3. 3058 StreetAddress3 *string `json:"streetAddress3,omitempty"` 3059 // City - Name of the City. 3060 City *string `json:"city,omitempty"` 3061 // StateOrProvince - Name of the State or Province. 3062 StateOrProvince *string `json:"stateOrProvince,omitempty"` 3063 // Country - Name of the Country. 3064 Country *string `json:"country,omitempty"` 3065 // PostalCode - Postal code. 3066 PostalCode *string `json:"postalCode,omitempty"` 3067 // ZipExtendedCode - Extended Zip Code. 3068 ZipExtendedCode *string `json:"zipExtendedCode,omitempty"` 3069 // CompanyName - Name of the company. 3070 CompanyName *string `json:"companyName,omitempty"` 3071 // AddressType - Type of address. Possible values include: 'None', 'Residential', 'Commercial' 3072 AddressType AddressType `json:"addressType,omitempty"` 3073} 3074 3075// Sku the Sku. 3076type Sku struct { 3077 // Name - The sku name. Possible values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' 3078 Name SkuName `json:"name,omitempty"` 3079 // DisplayName - The display name of the sku. 3080 DisplayName *string `json:"displayName,omitempty"` 3081 // Family - The sku family. 3082 Family *string `json:"family,omitempty"` 3083} 3084 3085// SkuCapacity capacity of the sku. 3086type SkuCapacity struct { 3087 // Usable - READ-ONLY; Usable capacity in TB. 3088 Usable *string `json:"usable,omitempty"` 3089 // Maximum - READ-ONLY; Maximum capacity in TB. 3090 Maximum *string `json:"maximum,omitempty"` 3091} 3092 3093// SkuCost describes metadata for retrieving price info. 3094type SkuCost struct { 3095 // MeterID - READ-ONLY; Meter id of the Sku. 3096 MeterID *string `json:"meterId,omitempty"` 3097 // MeterType - READ-ONLY; The type of the meter. 3098 MeterType *string `json:"meterType,omitempty"` 3099} 3100 3101// SkuInformation information of the sku. 3102type SkuInformation struct { 3103 // Sku - READ-ONLY; The Sku. 3104 Sku *Sku `json:"sku,omitempty"` 3105 // Enabled - READ-ONLY; The sku is enabled or not. 3106 Enabled *bool `json:"enabled,omitempty"` 3107 // SkuProperties - READ-ONLY; Properties of the sku. 3108 *SkuProperties `json:"properties,omitempty"` 3109} 3110 3111// MarshalJSON is the custom marshaler for SkuInformation. 3112func (si SkuInformation) MarshalJSON() ([]byte, error) { 3113 objectMap := make(map[string]interface{}) 3114 return json.Marshal(objectMap) 3115} 3116 3117// UnmarshalJSON is the custom unmarshaler for SkuInformation struct. 3118func (si *SkuInformation) UnmarshalJSON(body []byte) error { 3119 var m map[string]*json.RawMessage 3120 err := json.Unmarshal(body, &m) 3121 if err != nil { 3122 return err 3123 } 3124 for k, v := range m { 3125 switch k { 3126 case "sku": 3127 if v != nil { 3128 var sku Sku 3129 err = json.Unmarshal(*v, &sku) 3130 if err != nil { 3131 return err 3132 } 3133 si.Sku = &sku 3134 } 3135 case "enabled": 3136 if v != nil { 3137 var enabled bool 3138 err = json.Unmarshal(*v, &enabled) 3139 if err != nil { 3140 return err 3141 } 3142 si.Enabled = &enabled 3143 } 3144 case "properties": 3145 if v != nil { 3146 var skuProperties SkuProperties 3147 err = json.Unmarshal(*v, &skuProperties) 3148 if err != nil { 3149 return err 3150 } 3151 si.SkuProperties = &skuProperties 3152 } 3153 } 3154 } 3155 3156 return nil 3157} 3158 3159// SkuProperties properties of the sku. 3160type SkuProperties struct { 3161 // DestinationToServiceLocationMap - READ-ONLY; The map of destination location to service location. 3162 DestinationToServiceLocationMap *[]DestinationToServiceLocationMap `json:"destinationToServiceLocationMap,omitempty"` 3163 // Capacity - READ-ONLY; Capacity of the Sku. 3164 Capacity *SkuCapacity `json:"capacity,omitempty"` 3165 // Costs - READ-ONLY; Cost of the Sku. 3166 Costs *[]SkuCost `json:"costs,omitempty"` 3167 // APIVersions - READ-ONLY; Api versions that support this Sku. 3168 APIVersions *[]string `json:"apiVersions,omitempty"` 3169 // DisabledReason - READ-ONLY; Reason why the Sku is disabled. Possible values include: 'SkuDisabledReasonNone', 'SkuDisabledReasonCountry', 'SkuDisabledReasonRegion', 'SkuDisabledReasonFeature', 'SkuDisabledReasonOfferType', 'SkuDisabledReasonNoSubscriptionInfo' 3170 DisabledReason SkuDisabledReason `json:"disabledReason,omitempty"` 3171 // DisabledReasonMessage - READ-ONLY; Message for why the Sku is disabled. 3172 DisabledReasonMessage *string `json:"disabledReasonMessage,omitempty"` 3173 // RequiredFeature - READ-ONLY; Required feature to access the sku. 3174 RequiredFeature *string `json:"requiredFeature,omitempty"` 3175} 3176 3177// UnencryptedCredentials unencrypted credentials for accessing device. 3178type UnencryptedCredentials struct { 3179 // JobName - READ-ONLY; Name of the job. 3180 JobName *string `json:"jobName,omitempty"` 3181 // JobSecrets - READ-ONLY; Secrets related to this job. 3182 JobSecrets BasicJobSecrets `json:"jobSecrets,omitempty"` 3183} 3184 3185// UnmarshalJSON is the custom unmarshaler for UnencryptedCredentials struct. 3186func (uc *UnencryptedCredentials) UnmarshalJSON(body []byte) error { 3187 var m map[string]*json.RawMessage 3188 err := json.Unmarshal(body, &m) 3189 if err != nil { 3190 return err 3191 } 3192 for k, v := range m { 3193 switch k { 3194 case "jobName": 3195 if v != nil { 3196 var jobName string 3197 err = json.Unmarshal(*v, &jobName) 3198 if err != nil { 3199 return err 3200 } 3201 uc.JobName = &jobName 3202 } 3203 case "jobSecrets": 3204 if v != nil { 3205 jobSecrets, err := unmarshalBasicJobSecrets(*v) 3206 if err != nil { 3207 return err 3208 } 3209 uc.JobSecrets = jobSecrets 3210 } 3211 } 3212 } 3213 3214 return nil 3215} 3216 3217// UnencryptedCredentialsList list of unencrypted credentials for accessing device. 3218type UnencryptedCredentialsList struct { 3219 autorest.Response `json:"-"` 3220 // Value - List of unencrypted credentials. 3221 Value *[]UnencryptedCredentials `json:"value,omitempty"` 3222 // NextLink - Link for the next set of unencrypted credentials. 3223 NextLink *string `json:"nextLink,omitempty"` 3224} 3225 3226// UpdateJobDetails job details for update. 3227type UpdateJobDetails struct { 3228 // ContactDetails - Contact details for notification and shipping. 3229 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 3230 // ShippingAddress - Shipping address of the customer. 3231 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 3232} 3233 3234// UpdateJobProperties job Properties for update 3235type UpdateJobProperties struct { 3236 // Details - Details of a job to be updated. 3237 Details *UpdateJobDetails `json:"details,omitempty"` 3238 // DestinationAccountDetails - Destination account details. 3239 DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` 3240} 3241 3242// UnmarshalJSON is the custom unmarshaler for UpdateJobProperties struct. 3243func (ujp *UpdateJobProperties) UnmarshalJSON(body []byte) error { 3244 var m map[string]*json.RawMessage 3245 err := json.Unmarshal(body, &m) 3246 if err != nil { 3247 return err 3248 } 3249 for k, v := range m { 3250 switch k { 3251 case "details": 3252 if v != nil { 3253 var details UpdateJobDetails 3254 err = json.Unmarshal(*v, &details) 3255 if err != nil { 3256 return err 3257 } 3258 ujp.Details = &details 3259 } 3260 case "destinationAccountDetails": 3261 if v != nil { 3262 destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) 3263 if err != nil { 3264 return err 3265 } 3266 ujp.DestinationAccountDetails = &destinationAccountDetails 3267 } 3268 } 3269 } 3270 3271 return nil 3272} 3273 3274// ValidateAddress the requirements to validate customer address where the device needs to be shipped. 3275type ValidateAddress struct { 3276 // ShippingAddress - Shipping address of the customer. 3277 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 3278 // DeviceType - Device type to be used for the job. Possible values include: 'DataBox', 'DataBoxDisk', 'DataBoxHeavy' 3279 DeviceType SkuName `json:"deviceType,omitempty"` 3280} 3281