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 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/autorest/date" 25 "github.com/Azure/go-autorest/autorest/to" 26 "net/http" 27) 28 29// AddressType enumerates the values for address type. 30type AddressType string 31 32const ( 33 // Commercial ... 34 Commercial AddressType = "Commercial" 35 // None ... 36 None AddressType = "None" 37 // Residential ... 38 Residential AddressType = "Residential" 39) 40 41// PossibleAddressTypeValues returns an array of possible values for the AddressType const type. 42func PossibleAddressTypeValues() []AddressType { 43 return []AddressType{Commercial, None, Residential} 44} 45 46// AddressValidationStatus enumerates the values for address validation status. 47type AddressValidationStatus string 48 49const ( 50 // Ambiguous ... 51 Ambiguous AddressValidationStatus = "Ambiguous" 52 // Invalid ... 53 Invalid AddressValidationStatus = "Invalid" 54 // Valid ... 55 Valid AddressValidationStatus = "Valid" 56) 57 58// PossibleAddressValidationStatusValues returns an array of possible values for the AddressValidationStatus const type. 59func PossibleAddressValidationStatusValues() []AddressValidationStatus { 60 return []AddressValidationStatus{Ambiguous, Invalid, Valid} 61} 62 63// CopyLogDetailsType enumerates the values for copy log details type. 64type CopyLogDetailsType string 65 66const ( 67 // CopyLogDetailsTypeCopyLogDetails ... 68 CopyLogDetailsTypeCopyLogDetails CopyLogDetailsType = "CopyLogDetails" 69 // CopyLogDetailsTypeDisk ... 70 CopyLogDetailsTypeDisk CopyLogDetailsType = "Disk" 71 // CopyLogDetailsTypePod ... 72 CopyLogDetailsTypePod CopyLogDetailsType = "Pod" 73) 74 75// PossibleCopyLogDetailsTypeValues returns an array of possible values for the CopyLogDetailsType const type. 76func PossibleCopyLogDetailsTypeValues() []CopyLogDetailsType { 77 return []CopyLogDetailsType{CopyLogDetailsTypeCopyLogDetails, CopyLogDetailsTypeDisk, CopyLogDetailsTypePod} 78} 79 80// CopyStatus enumerates the values for copy status. 81type CopyStatus string 82 83const ( 84 // Completed ... 85 Completed CopyStatus = "Completed" 86 // CompletedWithErrors ... 87 CompletedWithErrors CopyStatus = "CompletedWithErrors" 88 // Failed ... 89 Failed CopyStatus = "Failed" 90 // InProgress ... 91 InProgress CopyStatus = "InProgress" 92 // NotStarted ... 93 NotStarted CopyStatus = "NotStarted" 94) 95 96// PossibleCopyStatusValues returns an array of possible values for the CopyStatus const type. 97func PossibleCopyStatusValues() []CopyStatus { 98 return []CopyStatus{Completed, CompletedWithErrors, Failed, InProgress, NotStarted} 99} 100 101// DeviceIssueType enumerates the values for device issue type. 102type DeviceIssueType string 103 104const ( 105 // DeviceHealthCheckShowFailures ... 106 DeviceHealthCheckShowFailures DeviceIssueType = "DeviceHealthCheckShowFailures" 107 // DeviceNotBootingUp ... 108 DeviceNotBootingUp DeviceIssueType = "DeviceNotBootingUp" 109 // DeviceTampering ... 110 DeviceTampering DeviceIssueType = "DeviceTampering" 111 // Misc ... 112 Misc DeviceIssueType = "Misc" 113 // NICsAreNotWorking ... 114 NICsAreNotWorking DeviceIssueType = "NICsAreNotWorking" 115) 116 117// PossibleDeviceIssueTypeValues returns an array of possible values for the DeviceIssueType const type. 118func PossibleDeviceIssueTypeValues() []DeviceIssueType { 119 return []DeviceIssueType{DeviceHealthCheckShowFailures, DeviceNotBootingUp, DeviceTampering, Misc, NICsAreNotWorking} 120} 121 122// DeviceType enumerates the values for device type. 123type DeviceType string 124 125const ( 126 // Cabinet ... 127 Cabinet DeviceType = "Cabinet" 128 // Disk ... 129 Disk DeviceType = "Disk" 130 // Pod ... 131 Pod DeviceType = "Pod" 132) 133 134// PossibleDeviceTypeValues returns an array of possible values for the DeviceType const type. 135func PossibleDeviceTypeValues() []DeviceType { 136 return []DeviceType{Cabinet, Disk, Pod} 137} 138 139// IssueType enumerates the values for issue type. 140type IssueType string 141 142const ( 143 // CredentialNotWorking ... 144 CredentialNotWorking IssueType = "CredentialNotWorking" 145 // DeviceFailure ... 146 DeviceFailure IssueType = "DeviceFailure" 147 // DeviceMismatch ... 148 DeviceMismatch IssueType = "DeviceMismatch" 149 // ValidationStringMismatch ... 150 ValidationStringMismatch IssueType = "ValidationStringMismatch" 151) 152 153// PossibleIssueTypeValues returns an array of possible values for the IssueType const type. 154func PossibleIssueTypeValues() []IssueType { 155 return []IssueType{CredentialNotWorking, DeviceFailure, DeviceMismatch, ValidationStringMismatch} 156} 157 158// JobDetailsType enumerates the values for job details type. 159type JobDetailsType string 160 161const ( 162 // JobDetailsTypeDisk ... 163 JobDetailsTypeDisk JobDetailsType = "Disk" 164 // JobDetailsTypeJobDetails ... 165 JobDetailsTypeJobDetails JobDetailsType = "JobDetails" 166 // JobDetailsTypePod ... 167 JobDetailsTypePod JobDetailsType = "Pod" 168) 169 170// PossibleJobDetailsTypeValues returns an array of possible values for the JobDetailsType const type. 171func PossibleJobDetailsTypeValues() []JobDetailsType { 172 return []JobDetailsType{JobDetailsTypeDisk, JobDetailsTypeJobDetails, JobDetailsTypePod} 173} 174 175// JobSecretsType enumerates the values for job secrets type. 176type JobSecretsType string 177 178const ( 179 // JobSecretsTypeCabinet ... 180 JobSecretsTypeCabinet JobSecretsType = "Cabinet" 181 // JobSecretsTypeDisk ... 182 JobSecretsTypeDisk JobSecretsType = "Disk" 183 // JobSecretsTypeJobSecrets ... 184 JobSecretsTypeJobSecrets JobSecretsType = "JobSecrets" 185 // JobSecretsTypePod ... 186 JobSecretsTypePod JobSecretsType = "Pod" 187) 188 189// PossibleJobSecretsTypeValues returns an array of possible values for the JobSecretsType const type. 190func PossibleJobSecretsTypeValues() []JobSecretsType { 191 return []JobSecretsType{JobSecretsTypeCabinet, JobSecretsTypeDisk, JobSecretsTypeJobSecrets, JobSecretsTypePod} 192} 193 194// NotificationStageName enumerates the values for notification stage name. 195type NotificationStageName string 196 197const ( 198 // AtAzureDC ... 199 AtAzureDC NotificationStageName = "AtAzureDC" 200 // DataCopy ... 201 DataCopy NotificationStageName = "DataCopy" 202 // Delivered ... 203 Delivered NotificationStageName = "Delivered" 204 // DevicePrepared ... 205 DevicePrepared NotificationStageName = "DevicePrepared" 206 // Dispatched ... 207 Dispatched NotificationStageName = "Dispatched" 208 // PickedUp ... 209 PickedUp NotificationStageName = "PickedUp" 210) 211 212// PossibleNotificationStageNameValues returns an array of possible values for the NotificationStageName const type. 213func PossibleNotificationStageNameValues() []NotificationStageName { 214 return []NotificationStageName{AtAzureDC, DataCopy, Delivered, DevicePrepared, Dispatched, PickedUp} 215} 216 217// StageName enumerates the values for stage name. 218type StageName string 219 220const ( 221 // StageNameAborted ... 222 StageNameAborted StageName = "Aborted" 223 // StageNameAtAzureDC ... 224 StageNameAtAzureDC StageName = "AtAzureDC" 225 // StageNameCancelled ... 226 StageNameCancelled StageName = "Cancelled" 227 // StageNameCompleted ... 228 StageNameCompleted StageName = "Completed" 229 // StageNameCompletedWithErrors ... 230 StageNameCompletedWithErrors StageName = "CompletedWithErrors" 231 // StageNameDataCopy ... 232 StageNameDataCopy StageName = "DataCopy" 233 // StageNameDelivered ... 234 StageNameDelivered StageName = "Delivered" 235 // StageNameDeviceOrdered ... 236 StageNameDeviceOrdered StageName = "DeviceOrdered" 237 // StageNameDevicePrepared ... 238 StageNameDevicePrepared StageName = "DevicePrepared" 239 // StageNameDispatched ... 240 StageNameDispatched StageName = "Dispatched" 241 // StageNameFailedIssueDetectedAtAzureDC ... 242 StageNameFailedIssueDetectedAtAzureDC StageName = "Failed_IssueDetectedAtAzureDC" 243 // StageNameFailedIssueReportedAtCustomer ... 244 StageNameFailedIssueReportedAtCustomer StageName = "Failed_IssueReportedAtCustomer" 245 // StageNamePickedUp ... 246 StageNamePickedUp StageName = "PickedUp" 247) 248 249// PossibleStageNameValues returns an array of possible values for the StageName const type. 250func PossibleStageNameValues() []StageName { 251 return []StageName{StageNameAborted, StageNameAtAzureDC, StageNameCancelled, StageNameCompleted, StageNameCompletedWithErrors, StageNameDataCopy, StageNameDelivered, StageNameDeviceOrdered, StageNameDevicePrepared, StageNameDispatched, StageNameFailedIssueDetectedAtAzureDC, StageNameFailedIssueReportedAtCustomer, StageNamePickedUp} 252} 253 254// StageStatus enumerates the values for stage status. 255type StageStatus string 256 257const ( 258 // StageStatusCancelled ... 259 StageStatusCancelled StageStatus = "Cancelled" 260 // StageStatusCancelling ... 261 StageStatusCancelling StageStatus = "Cancelling" 262 // StageStatusFailed ... 263 StageStatusFailed StageStatus = "Failed" 264 // StageStatusInProgress ... 265 StageStatusInProgress StageStatus = "InProgress" 266 // StageStatusNone ... 267 StageStatusNone StageStatus = "None" 268 // StageStatusSucceeded ... 269 StageStatusSucceeded StageStatus = "Succeeded" 270 // StageStatusSucceededWithErrors ... 271 StageStatusSucceededWithErrors StageStatus = "SucceededWithErrors" 272) 273 274// PossibleStageStatusValues returns an array of possible values for the StageStatus const type. 275func PossibleStageStatusValues() []StageStatus { 276 return []StageStatus{StageStatusCancelled, StageStatusCancelling, StageStatusFailed, StageStatusInProgress, StageStatusNone, StageStatusSucceeded, StageStatusSucceededWithErrors} 277} 278 279// AccountCopyLogDetails copy log details for an storage account 280type AccountCopyLogDetails struct { 281 // AccountName - Destination account name. 282 AccountName *string `json:"accountName,omitempty"` 283 // CopyLogLink - Link for copy logs. 284 CopyLogLink *string `json:"copyLogLink,omitempty"` 285 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypePod', 'CopyLogDetailsTypeDisk' 286 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 287} 288 289// MarshalJSON is the custom marshaler for AccountCopyLogDetails. 290func (acld AccountCopyLogDetails) MarshalJSON() ([]byte, error) { 291 acld.CopyLogDetailsType = CopyLogDetailsTypePod 292 objectMap := make(map[string]interface{}) 293 if acld.AccountName != nil { 294 objectMap["accountName"] = acld.AccountName 295 } 296 if acld.CopyLogLink != nil { 297 objectMap["copyLogLink"] = acld.CopyLogLink 298 } 299 if acld.CopyLogDetailsType != "" { 300 objectMap["copyLogDetailsType"] = acld.CopyLogDetailsType 301 } 302 return json.Marshal(objectMap) 303} 304 305// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 306func (acld AccountCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 307 return &acld, true 308} 309 310// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 311func (acld AccountCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 312 return nil, false 313} 314 315// AsCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 316func (acld AccountCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 317 return nil, false 318} 319 320// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for AccountCopyLogDetails. 321func (acld AccountCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 322 return &acld, true 323} 324 325// AccountCredentialDetails credential details of the account. 326type AccountCredentialDetails struct { 327 // AccountName - Name of the account. 328 AccountName *string `json:"accountName,omitempty"` 329 // ShareCredentialDetails - Per share level unencrypted access credentials. 330 ShareCredentialDetails *[]ShareCredentialDetails `json:"shareCredentialDetails,omitempty"` 331} 332 333// AddressValidationOutput output of the address validation api. 334type AddressValidationOutput struct { 335 autorest.Response `json:"-"` 336 // AddressValidationProperties - The address validation properties. 337 *AddressValidationProperties `json:"properties,omitempty"` 338} 339 340// MarshalJSON is the custom marshaler for AddressValidationOutput. 341func (avo AddressValidationOutput) MarshalJSON() ([]byte, error) { 342 objectMap := make(map[string]interface{}) 343 if avo.AddressValidationProperties != nil { 344 objectMap["properties"] = avo.AddressValidationProperties 345 } 346 return json.Marshal(objectMap) 347} 348 349// UnmarshalJSON is the custom unmarshaler for AddressValidationOutput struct. 350func (avo *AddressValidationOutput) UnmarshalJSON(body []byte) error { 351 var m map[string]*json.RawMessage 352 err := json.Unmarshal(body, &m) 353 if err != nil { 354 return err 355 } 356 for k, v := range m { 357 switch k { 358 case "properties": 359 if v != nil { 360 var addressValidationProperties AddressValidationProperties 361 err = json.Unmarshal(*v, &addressValidationProperties) 362 if err != nil { 363 return err 364 } 365 avo.AddressValidationProperties = &addressValidationProperties 366 } 367 } 368 } 369 370 return nil 371} 372 373// AddressValidationProperties the address validation output. 374type AddressValidationProperties struct { 375 // ValidationStatus - The address validation status. Possible values include: 'Valid', 'Invalid', 'Ambiguous' 376 ValidationStatus AddressValidationStatus `json:"validationStatus,omitempty"` 377 // AlternateAddresses - List of alternate addresses. 378 AlternateAddresses *[]ShippingAddress `json:"alternateAddresses,omitempty"` 379} 380 381// ArmBaseObject base class for all objects under resource. 382type ArmBaseObject struct { 383 // Name - Name of the object. 384 Name *string `json:"name,omitempty"` 385 // ID - Id of the object. 386 ID *string `json:"id,omitempty"` 387 // Type - Type of the object. 388 Type *string `json:"type,omitempty"` 389} 390 391// AvailableSkuRequest the filters for showing the available skus. 392type AvailableSkuRequest struct { 393 // TransferType - Type of the transfer. 394 TransferType *string `json:"transferType,omitempty"` 395 // 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 396 Country *string `json:"country,omitempty"` 397 // Location - Location for data transfer. For locations check: https://management.azure.com/subscriptions/SUBSCRIPTIONID/locations?api-version=2018-01-01 398 Location *string `json:"location,omitempty"` 399} 400 401// AvailableSkusResult the available skus operation response. 402type AvailableSkusResult struct { 403 autorest.Response `json:"-"` 404 // Value - List of available skus. 405 Value *[]SkuInformation `json:"value,omitempty"` 406 // NextLink - Link for the next set of skus. 407 NextLink *string `json:"nextLink,omitempty"` 408} 409 410// AvailableSkusResultIterator provides access to a complete listing of SkuInformation values. 411type AvailableSkusResultIterator struct { 412 i int 413 page AvailableSkusResultPage 414} 415 416// Next advances to the next value. If there was an error making 417// the request the iterator does not advance and the error is returned. 418func (iter *AvailableSkusResultIterator) Next() error { 419 iter.i++ 420 if iter.i < len(iter.page.Values()) { 421 return nil 422 } 423 err := iter.page.Next() 424 if err != nil { 425 iter.i-- 426 return err 427 } 428 iter.i = 0 429 return nil 430} 431 432// NotDone returns true if the enumeration should be started or is not yet complete. 433func (iter AvailableSkusResultIterator) NotDone() bool { 434 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 435} 436 437// Response returns the raw server response from the last page request. 438func (iter AvailableSkusResultIterator) Response() AvailableSkusResult { 439 return iter.page.Response() 440} 441 442// Value returns the current value or a zero-initialized value if the 443// iterator has advanced beyond the end of the collection. 444func (iter AvailableSkusResultIterator) Value() SkuInformation { 445 if !iter.page.NotDone() { 446 return SkuInformation{} 447 } 448 return iter.page.Values()[iter.i] 449} 450 451// IsEmpty returns true if the ListResult contains no values. 452func (asr AvailableSkusResult) IsEmpty() bool { 453 return asr.Value == nil || len(*asr.Value) == 0 454} 455 456// availableSkusResultPreparer prepares a request to retrieve the next set of results. 457// It returns nil if no more results exist. 458func (asr AvailableSkusResult) availableSkusResultPreparer() (*http.Request, error) { 459 if asr.NextLink == nil || len(to.String(asr.NextLink)) < 1 { 460 return nil, nil 461 } 462 return autorest.Prepare(&http.Request{}, 463 autorest.AsJSON(), 464 autorest.AsGet(), 465 autorest.WithBaseURL(to.String(asr.NextLink))) 466} 467 468// AvailableSkusResultPage contains a page of SkuInformation values. 469type AvailableSkusResultPage struct { 470 fn func(AvailableSkusResult) (AvailableSkusResult, error) 471 asr AvailableSkusResult 472} 473 474// Next advances to the next page of values. If there was an error making 475// the request the page does not advance and the error is returned. 476func (page *AvailableSkusResultPage) Next() error { 477 next, err := page.fn(page.asr) 478 if err != nil { 479 return err 480 } 481 page.asr = next 482 return nil 483} 484 485// NotDone returns true if the page enumeration should be started or is not yet complete. 486func (page AvailableSkusResultPage) NotDone() bool { 487 return !page.asr.IsEmpty() 488} 489 490// Response returns the raw server response from the last page request. 491func (page AvailableSkusResultPage) Response() AvailableSkusResult { 492 return page.asr 493} 494 495// Values returns the slice of values for the current page or nil if there are no values. 496func (page AvailableSkusResultPage) Values() []SkuInformation { 497 if page.asr.IsEmpty() { 498 return nil 499 } 500 return *page.asr.Value 501} 502 503// CabinetJobSecrets the secrets related to a cabinet job. 504type CabinetJobSecrets struct { 505 // CabinetPodSecrets - Contains the list of secret objects for a cabinet job. 506 CabinetPodSecrets *[]CabinetPodSecret `json:"cabinetPodSecrets,omitempty"` 507 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeCabinet', 'JobSecretsTypeDisk', 'JobSecretsTypePod' 508 JobSecretsType JobSecretsType `json:"jobSecretsType,omitempty"` 509} 510 511// MarshalJSON is the custom marshaler for CabinetJobSecrets. 512func (cjs CabinetJobSecrets) MarshalJSON() ([]byte, error) { 513 cjs.JobSecretsType = JobSecretsTypeCabinet 514 objectMap := make(map[string]interface{}) 515 if cjs.CabinetPodSecrets != nil { 516 objectMap["cabinetPodSecrets"] = cjs.CabinetPodSecrets 517 } 518 if cjs.JobSecretsType != "" { 519 objectMap["jobSecretsType"] = cjs.JobSecretsType 520 } 521 return json.Marshal(objectMap) 522} 523 524// AsCabinetJobSecrets is the BasicJobSecrets implementation for CabinetJobSecrets. 525func (cjs CabinetJobSecrets) AsCabinetJobSecrets() (*CabinetJobSecrets, bool) { 526 return &cjs, true 527} 528 529// AsDiskJobSecrets is the BasicJobSecrets implementation for CabinetJobSecrets. 530func (cjs CabinetJobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 531 return nil, false 532} 533 534// AsPodJobSecrets is the BasicJobSecrets implementation for CabinetJobSecrets. 535func (cjs CabinetJobSecrets) AsPodJobSecrets() (*PodJobSecrets, bool) { 536 return nil, false 537} 538 539// AsJobSecrets is the BasicJobSecrets implementation for CabinetJobSecrets. 540func (cjs CabinetJobSecrets) AsJobSecrets() (*JobSecrets, bool) { 541 return nil, false 542} 543 544// AsBasicJobSecrets is the BasicJobSecrets implementation for CabinetJobSecrets. 545func (cjs CabinetJobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 546 return &cjs, true 547} 548 549// CabinetPodSecret the secrets related to a cabinet pod. 550type CabinetPodSecret struct { 551 // DeviceSerialNumber - Serial number of the assigned device. 552 DeviceSerialNumber *string `json:"deviceSerialNumber,omitempty"` 553 // DevicePassword - Password for out of the box experience on device. 554 DevicePassword *string `json:"devicePassword,omitempty"` 555 // AccountCredentialDetails - Per account level access credentials. 556 AccountCredentialDetails *[]AccountCredentialDetails `json:"accountCredentialDetails,omitempty"` 557} 558 559// CancellationReason reason for cancellation. 560type CancellationReason struct { 561 // Reason - Reason for cancellation. 562 Reason *string `json:"reason,omitempty"` 563} 564 565// ContactDetails contact Details. 566type ContactDetails struct { 567 // ContactName - Contact name of the person. 568 ContactName *string `json:"contactName,omitempty"` 569 // Phone - Phone number of the contact person. 570 Phone *string `json:"phone,omitempty"` 571 // PhoneExtension - Phone extension number of the contact person. 572 PhoneExtension *string `json:"phoneExtension,omitempty"` 573 // Mobile - Mobile number of the contact person. 574 Mobile *string `json:"mobile,omitempty"` 575 // EmailList - List of Email-ids to be notified about job progress. 576 EmailList *[]string `json:"emailList,omitempty"` 577 // NotificationPreference - Notification preference for a job stage. 578 NotificationPreference *[]NotificationPreference `json:"notificationPreference,omitempty"` 579} 580 581// BasicCopyLogDetails details for log generated during copy. 582type BasicCopyLogDetails interface { 583 AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) 584 AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) 585 AsCopyLogDetails() (*CopyLogDetails, bool) 586} 587 588// CopyLogDetails details for log generated during copy. 589type CopyLogDetails struct { 590 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypePod', 'CopyLogDetailsTypeDisk' 591 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 592} 593 594func unmarshalBasicCopyLogDetails(body []byte) (BasicCopyLogDetails, error) { 595 var m map[string]interface{} 596 err := json.Unmarshal(body, &m) 597 if err != nil { 598 return nil, err 599 } 600 601 switch m["copyLogDetailsType"] { 602 case string(CopyLogDetailsTypePod): 603 var acld AccountCopyLogDetails 604 err := json.Unmarshal(body, &acld) 605 return acld, err 606 case string(CopyLogDetailsTypeDisk): 607 var dcld DiskCopyLogDetails 608 err := json.Unmarshal(body, &dcld) 609 return dcld, err 610 default: 611 var cld CopyLogDetails 612 err := json.Unmarshal(body, &cld) 613 return cld, err 614 } 615} 616func unmarshalBasicCopyLogDetailsArray(body []byte) ([]BasicCopyLogDetails, error) { 617 var rawMessages []*json.RawMessage 618 err := json.Unmarshal(body, &rawMessages) 619 if err != nil { 620 return nil, err 621 } 622 623 cldArray := make([]BasicCopyLogDetails, len(rawMessages)) 624 625 for index, rawMessage := range rawMessages { 626 cld, err := unmarshalBasicCopyLogDetails(*rawMessage) 627 if err != nil { 628 return nil, err 629 } 630 cldArray[index] = cld 631 } 632 return cldArray, nil 633} 634 635// MarshalJSON is the custom marshaler for CopyLogDetails. 636func (cld CopyLogDetails) MarshalJSON() ([]byte, error) { 637 cld.CopyLogDetailsType = CopyLogDetailsTypeCopyLogDetails 638 objectMap := make(map[string]interface{}) 639 if cld.CopyLogDetailsType != "" { 640 objectMap["copyLogDetailsType"] = cld.CopyLogDetailsType 641 } 642 return json.Marshal(objectMap) 643} 644 645// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 646func (cld CopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 647 return nil, false 648} 649 650// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 651func (cld CopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 652 return nil, false 653} 654 655// AsCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 656func (cld CopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 657 return &cld, true 658} 659 660// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for CopyLogDetails. 661func (cld CopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 662 return &cld, true 663} 664 665// CopyProgress copy progress. 666type CopyProgress struct { 667 // StorageAccountName - Name of the storage account where the data needs to be uploaded. 668 StorageAccountName *string `json:"storageAccountName,omitempty"` 669 // BytesSentToCloud - Amount of data uploaded by the job as of now. 670 BytesSentToCloud *int64 `json:"bytesSentToCloud,omitempty"` 671 // TotalBytesToProcess - Total amount of data to be processed by the job. 672 TotalBytesToProcess *int64 `json:"totalBytesToProcess,omitempty"` 673} 674 675// DestinationAccountDetails details for the destination account. 676type DestinationAccountDetails struct { 677 // AccountID - Destination storage account id. 678 AccountID *string `json:"accountId,omitempty"` 679} 680 681// DestinationToServiceLocationMap map of destination location to service location 682type DestinationToServiceLocationMap struct { 683 // DestinationLocation - Location of the destination. 684 DestinationLocation *string `json:"destinationLocation,omitempty"` 685 // ServiceLocation - Location of the service. 686 ServiceLocation *string `json:"serviceLocation,omitempty"` 687} 688 689// DiskCopyLogDetails copy Log Details for a disk 690type DiskCopyLogDetails struct { 691 // DiskSerialNumber - Disk Serial Number. 692 DiskSerialNumber *string `json:"diskSerialNumber,omitempty"` 693 // ErrorLogLink - Link for copy error logs. 694 ErrorLogLink *string `json:"errorLogLink,omitempty"` 695 // VerboseLogLink - Link for copy verbose logs. 696 VerboseLogLink *string `json:"verboseLogLink,omitempty"` 697 // CopyLogDetailsType - Possible values include: 'CopyLogDetailsTypeCopyLogDetails', 'CopyLogDetailsTypePod', 'CopyLogDetailsTypeDisk' 698 CopyLogDetailsType CopyLogDetailsType `json:"copyLogDetailsType,omitempty"` 699} 700 701// MarshalJSON is the custom marshaler for DiskCopyLogDetails. 702func (dcld DiskCopyLogDetails) MarshalJSON() ([]byte, error) { 703 dcld.CopyLogDetailsType = CopyLogDetailsTypeDisk 704 objectMap := make(map[string]interface{}) 705 if dcld.DiskSerialNumber != nil { 706 objectMap["diskSerialNumber"] = dcld.DiskSerialNumber 707 } 708 if dcld.ErrorLogLink != nil { 709 objectMap["errorLogLink"] = dcld.ErrorLogLink 710 } 711 if dcld.VerboseLogLink != nil { 712 objectMap["verboseLogLink"] = dcld.VerboseLogLink 713 } 714 if dcld.CopyLogDetailsType != "" { 715 objectMap["copyLogDetailsType"] = dcld.CopyLogDetailsType 716 } 717 return json.Marshal(objectMap) 718} 719 720// AsAccountCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 721func (dcld DiskCopyLogDetails) AsAccountCopyLogDetails() (*AccountCopyLogDetails, bool) { 722 return nil, false 723} 724 725// AsDiskCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 726func (dcld DiskCopyLogDetails) AsDiskCopyLogDetails() (*DiskCopyLogDetails, bool) { 727 return &dcld, true 728} 729 730// AsCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 731func (dcld DiskCopyLogDetails) AsCopyLogDetails() (*CopyLogDetails, bool) { 732 return nil, false 733} 734 735// AsBasicCopyLogDetails is the BasicCopyLogDetails implementation for DiskCopyLogDetails. 736func (dcld DiskCopyLogDetails) AsBasicCopyLogDetails() (BasicCopyLogDetails, bool) { 737 return &dcld, true 738} 739 740// DiskCopyProgress disk Copy Progress 741type DiskCopyProgress struct { 742 // SerialNumber - The serial number of the disk 743 SerialNumber *string `json:"serialNumber,omitempty"` 744 // PercentComplete - Indicates the percentage completed for the copy of the disk. 745 PercentComplete *int32 `json:"percentComplete,omitempty"` 746 // Status - The Status of the copy. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed' 747 Status CopyStatus `json:"status,omitempty"` 748} 749 750// DiskJobDetails disk Job Details. 751type DiskJobDetails struct { 752 // 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. 753 PreferredDisks map[string]*int32 `json:"preferredDisks"` 754 // CopyProgress - Copy progress per disk. 755 CopyProgress *[]DiskCopyProgress `json:"copyProgress,omitempty"` 756 // DisksAndSizeDetails - 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. 757 DisksAndSizeDetails map[string]*int32 `json:"disksAndSizeDetails"` 758 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transfered in this job, in tera bytes. 759 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 760 // JobStages - List of stages that run in the job. 761 JobStages *[]JobStages `json:"jobStages,omitempty"` 762 // ContactDetails - Contact details for notification and shipping. 763 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 764 // ShippingAddress - Shipping address of the customer. 765 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 766 // ErrorDetails - Error details for failure. This is optional. 767 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 768 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDisk', 'JobDetailsTypePod' 769 JobDetailsType JobDetailsType `json:"jobDetailsType,omitempty"` 770} 771 772// MarshalJSON is the custom marshaler for DiskJobDetails. 773func (djd DiskJobDetails) MarshalJSON() ([]byte, error) { 774 djd.JobDetailsType = JobDetailsTypeDisk 775 objectMap := make(map[string]interface{}) 776 if djd.PreferredDisks != nil { 777 objectMap["preferredDisks"] = djd.PreferredDisks 778 } 779 if djd.CopyProgress != nil { 780 objectMap["copyProgress"] = djd.CopyProgress 781 } 782 if djd.DisksAndSizeDetails != nil { 783 objectMap["disksAndSizeDetails"] = djd.DisksAndSizeDetails 784 } 785 if djd.ExpectedDataSizeInTeraBytes != nil { 786 objectMap["expectedDataSizeInTeraBytes"] = djd.ExpectedDataSizeInTeraBytes 787 } 788 if djd.JobStages != nil { 789 objectMap["jobStages"] = djd.JobStages 790 } 791 if djd.ContactDetails != nil { 792 objectMap["contactDetails"] = djd.ContactDetails 793 } 794 if djd.ShippingAddress != nil { 795 objectMap["shippingAddress"] = djd.ShippingAddress 796 } 797 if djd.ErrorDetails != nil { 798 objectMap["errorDetails"] = djd.ErrorDetails 799 } 800 if djd.JobDetailsType != "" { 801 objectMap["jobDetailsType"] = djd.JobDetailsType 802 } 803 return json.Marshal(objectMap) 804} 805 806// AsDiskJobDetails is the BasicJobDetails implementation for DiskJobDetails. 807func (djd DiskJobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) { 808 return &djd, true 809} 810 811// AsPodJobDetails is the BasicJobDetails implementation for DiskJobDetails. 812func (djd DiskJobDetails) AsPodJobDetails() (*PodJobDetails, bool) { 813 return nil, false 814} 815 816// AsJobDetails is the BasicJobDetails implementation for DiskJobDetails. 817func (djd DiskJobDetails) AsJobDetails() (*JobDetails, bool) { 818 return nil, false 819} 820 821// AsBasicJobDetails is the BasicJobDetails implementation for DiskJobDetails. 822func (djd DiskJobDetails) AsBasicJobDetails() (BasicJobDetails, bool) { 823 return &djd, true 824} 825 826// DiskJobSecrets the secrets related to disk job. 827type DiskJobSecrets struct { 828 // DiskSecrets - Contains the list of secrets object for that device. 829 DiskSecrets *[]DiskSecret `json:"diskSecrets,omitempty"` 830 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeCabinet', 'JobSecretsTypeDisk', 'JobSecretsTypePod' 831 JobSecretsType JobSecretsType `json:"jobSecretsType,omitempty"` 832} 833 834// MarshalJSON is the custom marshaler for DiskJobSecrets. 835func (djs DiskJobSecrets) MarshalJSON() ([]byte, error) { 836 djs.JobSecretsType = JobSecretsTypeDisk 837 objectMap := make(map[string]interface{}) 838 if djs.DiskSecrets != nil { 839 objectMap["diskSecrets"] = djs.DiskSecrets 840 } 841 if djs.JobSecretsType != "" { 842 objectMap["jobSecretsType"] = djs.JobSecretsType 843 } 844 return json.Marshal(objectMap) 845} 846 847// AsCabinetJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 848func (djs DiskJobSecrets) AsCabinetJobSecrets() (*CabinetJobSecrets, bool) { 849 return nil, false 850} 851 852// AsDiskJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 853func (djs DiskJobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 854 return &djs, true 855} 856 857// AsPodJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 858func (djs DiskJobSecrets) AsPodJobSecrets() (*PodJobSecrets, bool) { 859 return nil, false 860} 861 862// AsJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 863func (djs DiskJobSecrets) AsJobSecrets() (*JobSecrets, bool) { 864 return nil, false 865} 866 867// AsBasicJobSecrets is the BasicJobSecrets implementation for DiskJobSecrets. 868func (djs DiskJobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 869 return &djs, true 870} 871 872// DiskSecret contains all the secrets of a Disk. 873type DiskSecret struct { 874 // DiskSerialNumber - Serial number of the assigned disk. 875 DiskSerialNumber *string `json:"diskSerialNumber,omitempty"` 876 // BitLockerKey - Bit Locker key of the disk which can be used to unlock the disk to copy data. 877 BitLockerKey *string `json:"bitLockerKey,omitempty"` 878} 879 880// Error top level error for the job. 881type Error struct { 882 // Code - Error code that can be used to programmatically identify the error. 883 Code *string `json:"code,omitempty"` 884 // Message - Describes the error in detail and provides debugging information. 885 Message *string `json:"message,omitempty"` 886} 887 888// GetCopyLogsURIOutput output for the GetCopyLogsUri. 889type GetCopyLogsURIOutput struct { 890 autorest.Response `json:"-"` 891 // LogType - Type/Level of the log. 892 LogType *string `json:"logType,omitempty"` 893 // CopyLogDetails - List of copy log details. 894 CopyLogDetails *[]BasicCopyLogDetails `json:"copyLogDetails,omitempty"` 895} 896 897// UnmarshalJSON is the custom unmarshaler for GetCopyLogsURIOutput struct. 898func (gcluo *GetCopyLogsURIOutput) UnmarshalJSON(body []byte) error { 899 var m map[string]*json.RawMessage 900 err := json.Unmarshal(body, &m) 901 if err != nil { 902 return err 903 } 904 for k, v := range m { 905 switch k { 906 case "logType": 907 if v != nil { 908 var logType string 909 err = json.Unmarshal(*v, &logType) 910 if err != nil { 911 return err 912 } 913 gcluo.LogType = &logType 914 } 915 case "copyLogDetails": 916 if v != nil { 917 copyLogDetails, err := unmarshalBasicCopyLogDetailsArray(*v) 918 if err != nil { 919 return err 920 } 921 gcluo.CopyLogDetails = ©LogDetails 922 } 923 } 924 } 925 926 return nil 927} 928 929// BasicJobDetails job details. 930type BasicJobDetails interface { 931 AsDiskJobDetails() (*DiskJobDetails, bool) 932 AsPodJobDetails() (*PodJobDetails, bool) 933 AsJobDetails() (*JobDetails, bool) 934} 935 936// JobDetails job details. 937type JobDetails struct { 938 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transfered in this job, in tera bytes. 939 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 940 // JobStages - List of stages that run in the job. 941 JobStages *[]JobStages `json:"jobStages,omitempty"` 942 // ContactDetails - Contact details for notification and shipping. 943 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 944 // ShippingAddress - Shipping address of the customer. 945 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 946 // ErrorDetails - Error details for failure. This is optional. 947 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 948 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDisk', 'JobDetailsTypePod' 949 JobDetailsType JobDetailsType `json:"jobDetailsType,omitempty"` 950} 951 952func unmarshalBasicJobDetails(body []byte) (BasicJobDetails, error) { 953 var m map[string]interface{} 954 err := json.Unmarshal(body, &m) 955 if err != nil { 956 return nil, err 957 } 958 959 switch m["jobDetailsType"] { 960 case string(JobDetailsTypeDisk): 961 var djd DiskJobDetails 962 err := json.Unmarshal(body, &djd) 963 return djd, err 964 case string(JobDetailsTypePod): 965 var pjd PodJobDetails 966 err := json.Unmarshal(body, &pjd) 967 return pjd, err 968 default: 969 var jd JobDetails 970 err := json.Unmarshal(body, &jd) 971 return jd, err 972 } 973} 974func unmarshalBasicJobDetailsArray(body []byte) ([]BasicJobDetails, error) { 975 var rawMessages []*json.RawMessage 976 err := json.Unmarshal(body, &rawMessages) 977 if err != nil { 978 return nil, err 979 } 980 981 jdArray := make([]BasicJobDetails, len(rawMessages)) 982 983 for index, rawMessage := range rawMessages { 984 jd, err := unmarshalBasicJobDetails(*rawMessage) 985 if err != nil { 986 return nil, err 987 } 988 jdArray[index] = jd 989 } 990 return jdArray, nil 991} 992 993// MarshalJSON is the custom marshaler for JobDetails. 994func (jd JobDetails) MarshalJSON() ([]byte, error) { 995 jd.JobDetailsType = JobDetailsTypeJobDetails 996 objectMap := make(map[string]interface{}) 997 if jd.ExpectedDataSizeInTeraBytes != nil { 998 objectMap["expectedDataSizeInTeraBytes"] = jd.ExpectedDataSizeInTeraBytes 999 } 1000 if jd.JobStages != nil { 1001 objectMap["jobStages"] = jd.JobStages 1002 } 1003 if jd.ContactDetails != nil { 1004 objectMap["contactDetails"] = jd.ContactDetails 1005 } 1006 if jd.ShippingAddress != nil { 1007 objectMap["shippingAddress"] = jd.ShippingAddress 1008 } 1009 if jd.ErrorDetails != nil { 1010 objectMap["errorDetails"] = jd.ErrorDetails 1011 } 1012 if jd.JobDetailsType != "" { 1013 objectMap["jobDetailsType"] = jd.JobDetailsType 1014 } 1015 return json.Marshal(objectMap) 1016} 1017 1018// AsDiskJobDetails is the BasicJobDetails implementation for JobDetails. 1019func (jd JobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) { 1020 return nil, false 1021} 1022 1023// AsPodJobDetails is the BasicJobDetails implementation for JobDetails. 1024func (jd JobDetails) AsPodJobDetails() (*PodJobDetails, bool) { 1025 return nil, false 1026} 1027 1028// AsJobDetails is the BasicJobDetails implementation for JobDetails. 1029func (jd JobDetails) AsJobDetails() (*JobDetails, bool) { 1030 return &jd, true 1031} 1032 1033// AsBasicJobDetails is the BasicJobDetails implementation for JobDetails. 1034func (jd JobDetails) AsBasicJobDetails() (BasicJobDetails, bool) { 1035 return &jd, true 1036} 1037 1038// JobErrorDetails job Error Details for providing the information and recommended action. 1039type JobErrorDetails struct { 1040 // ErrorMessage - Message for the error. 1041 ErrorMessage *string `json:"errorMessage,omitempty"` 1042 // ErrorCode - Code for the error. 1043 ErrorCode *int32 `json:"errorCode,omitempty"` 1044 // RecommendedAction - Recommended action for the error. 1045 RecommendedAction *string `json:"recommendedAction,omitempty"` 1046 // ExceptionMessage - Contains the non localized exception message 1047 ExceptionMessage *string `json:"exceptionMessage,omitempty"` 1048} 1049 1050// JobProperties job Properties 1051type JobProperties struct { 1052 // DeviceType - Type of the device to be used for the job. Possible values include: 'Pod', 'Disk', 'Cabinet' 1053 DeviceType DeviceType `json:"deviceType,omitempty"` 1054 // IsCancellable - Describes whether the job is cancellable or not. 1055 IsCancellable *bool `json:"isCancellable,omitempty"` 1056 // IsShippingAddressEditable - Describes whether the shipping address is editable or not. 1057 IsShippingAddressEditable *bool `json:"isShippingAddressEditable,omitempty"` 1058 // Status - Name of the stage which is in progress. Possible values include: 'StageNameDeviceOrdered', 'StageNameDevicePrepared', 'StageNameDispatched', 'StageNameDelivered', 'StageNamePickedUp', 'StageNameAtAzureDC', 'StageNameDataCopy', 'StageNameCompleted', 'StageNameCompletedWithErrors', 'StageNameCancelled', 'StageNameFailedIssueReportedAtCustomer', 'StageNameFailedIssueDetectedAtAzureDC', 'StageNameAborted' 1059 Status StageName `json:"status,omitempty"` 1060 // StartTime - Time at which the job was started in UTC ISO 8601 format. 1061 StartTime *date.Time `json:"startTime,omitempty"` 1062 // Error - Top level error for the job. 1063 Error *Error `json:"error,omitempty"` 1064 // DeliveryPackage - Delivery package shipping details. 1065 DeliveryPackage *PackageShippingDetails `json:"deliveryPackage,omitempty"` 1066 // ReturnPackage - Return package shipping details. 1067 ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` 1068 // DestinationAccountDetails - Destination account details. 1069 DestinationAccountDetails *[]DestinationAccountDetails `json:"destinationAccountDetails,omitempty"` 1070 // Details - Details of a job run. This field will only be sent for expand details filter. 1071 Details BasicJobDetails `json:"details,omitempty"` 1072 // CancellationReason - Reason for cancellation. 1073 CancellationReason *string `json:"cancellationReason,omitempty"` 1074} 1075 1076// UnmarshalJSON is the custom unmarshaler for JobProperties struct. 1077func (jp *JobProperties) UnmarshalJSON(body []byte) error { 1078 var m map[string]*json.RawMessage 1079 err := json.Unmarshal(body, &m) 1080 if err != nil { 1081 return err 1082 } 1083 for k, v := range m { 1084 switch k { 1085 case "deviceType": 1086 if v != nil { 1087 var deviceType DeviceType 1088 err = json.Unmarshal(*v, &deviceType) 1089 if err != nil { 1090 return err 1091 } 1092 jp.DeviceType = deviceType 1093 } 1094 case "isCancellable": 1095 if v != nil { 1096 var isCancellable bool 1097 err = json.Unmarshal(*v, &isCancellable) 1098 if err != nil { 1099 return err 1100 } 1101 jp.IsCancellable = &isCancellable 1102 } 1103 case "isShippingAddressEditable": 1104 if v != nil { 1105 var isShippingAddressEditable bool 1106 err = json.Unmarshal(*v, &isShippingAddressEditable) 1107 if err != nil { 1108 return err 1109 } 1110 jp.IsShippingAddressEditable = &isShippingAddressEditable 1111 } 1112 case "status": 1113 if v != nil { 1114 var status StageName 1115 err = json.Unmarshal(*v, &status) 1116 if err != nil { 1117 return err 1118 } 1119 jp.Status = status 1120 } 1121 case "startTime": 1122 if v != nil { 1123 var startTime date.Time 1124 err = json.Unmarshal(*v, &startTime) 1125 if err != nil { 1126 return err 1127 } 1128 jp.StartTime = &startTime 1129 } 1130 case "error": 1131 if v != nil { 1132 var errorVar Error 1133 err = json.Unmarshal(*v, &errorVar) 1134 if err != nil { 1135 return err 1136 } 1137 jp.Error = &errorVar 1138 } 1139 case "deliveryPackage": 1140 if v != nil { 1141 var deliveryPackage PackageShippingDetails 1142 err = json.Unmarshal(*v, &deliveryPackage) 1143 if err != nil { 1144 return err 1145 } 1146 jp.DeliveryPackage = &deliveryPackage 1147 } 1148 case "returnPackage": 1149 if v != nil { 1150 var returnPackage PackageShippingDetails 1151 err = json.Unmarshal(*v, &returnPackage) 1152 if err != nil { 1153 return err 1154 } 1155 jp.ReturnPackage = &returnPackage 1156 } 1157 case "destinationAccountDetails": 1158 if v != nil { 1159 var destinationAccountDetails []DestinationAccountDetails 1160 err = json.Unmarshal(*v, &destinationAccountDetails) 1161 if err != nil { 1162 return err 1163 } 1164 jp.DestinationAccountDetails = &destinationAccountDetails 1165 } 1166 case "details": 1167 if v != nil { 1168 details, err := unmarshalBasicJobDetails(*v) 1169 if err != nil { 1170 return err 1171 } 1172 jp.Details = details 1173 } 1174 case "cancellationReason": 1175 if v != nil { 1176 var cancellationReason string 1177 err = json.Unmarshal(*v, &cancellationReason) 1178 if err != nil { 1179 return err 1180 } 1181 jp.CancellationReason = &cancellationReason 1182 } 1183 } 1184 } 1185 1186 return nil 1187} 1188 1189// JobResource job Resource. 1190type JobResource struct { 1191 autorest.Response `json:"-"` 1192 // JobProperties - Properties of a job. 1193 *JobProperties `json:"properties,omitempty"` 1194 // Name - Name of the object. 1195 Name *string `json:"name,omitempty"` 1196 // ID - Id of the object. 1197 ID *string `json:"id,omitempty"` 1198 // Type - Type of the object. 1199 Type *string `json:"type,omitempty"` 1200 // 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. 1201 Location *string `json:"location,omitempty"` 1202 // 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). 1203 Tags map[string]*string `json:"tags"` 1204 // Sku - The sku type. 1205 Sku *Sku `json:"sku,omitempty"` 1206} 1207 1208// MarshalJSON is the custom marshaler for JobResource. 1209func (jr JobResource) MarshalJSON() ([]byte, error) { 1210 objectMap := make(map[string]interface{}) 1211 if jr.JobProperties != nil { 1212 objectMap["properties"] = jr.JobProperties 1213 } 1214 if jr.Name != nil { 1215 objectMap["name"] = jr.Name 1216 } 1217 if jr.ID != nil { 1218 objectMap["id"] = jr.ID 1219 } 1220 if jr.Type != nil { 1221 objectMap["type"] = jr.Type 1222 } 1223 if jr.Location != nil { 1224 objectMap["location"] = jr.Location 1225 } 1226 if jr.Tags != nil { 1227 objectMap["tags"] = jr.Tags 1228 } 1229 if jr.Sku != nil { 1230 objectMap["sku"] = jr.Sku 1231 } 1232 return json.Marshal(objectMap) 1233} 1234 1235// UnmarshalJSON is the custom unmarshaler for JobResource struct. 1236func (jr *JobResource) UnmarshalJSON(body []byte) error { 1237 var m map[string]*json.RawMessage 1238 err := json.Unmarshal(body, &m) 1239 if err != nil { 1240 return err 1241 } 1242 for k, v := range m { 1243 switch k { 1244 case "properties": 1245 if v != nil { 1246 var jobProperties JobProperties 1247 err = json.Unmarshal(*v, &jobProperties) 1248 if err != nil { 1249 return err 1250 } 1251 jr.JobProperties = &jobProperties 1252 } 1253 case "name": 1254 if v != nil { 1255 var name string 1256 err = json.Unmarshal(*v, &name) 1257 if err != nil { 1258 return err 1259 } 1260 jr.Name = &name 1261 } 1262 case "id": 1263 if v != nil { 1264 var ID string 1265 err = json.Unmarshal(*v, &ID) 1266 if err != nil { 1267 return err 1268 } 1269 jr.ID = &ID 1270 } 1271 case "type": 1272 if v != nil { 1273 var typeVar string 1274 err = json.Unmarshal(*v, &typeVar) 1275 if err != nil { 1276 return err 1277 } 1278 jr.Type = &typeVar 1279 } 1280 case "location": 1281 if v != nil { 1282 var location string 1283 err = json.Unmarshal(*v, &location) 1284 if err != nil { 1285 return err 1286 } 1287 jr.Location = &location 1288 } 1289 case "tags": 1290 if v != nil { 1291 var tags map[string]*string 1292 err = json.Unmarshal(*v, &tags) 1293 if err != nil { 1294 return err 1295 } 1296 jr.Tags = tags 1297 } 1298 case "sku": 1299 if v != nil { 1300 var sku Sku 1301 err = json.Unmarshal(*v, &sku) 1302 if err != nil { 1303 return err 1304 } 1305 jr.Sku = &sku 1306 } 1307 } 1308 } 1309 1310 return nil 1311} 1312 1313// JobResourceList job Resource Collection 1314type JobResourceList struct { 1315 autorest.Response `json:"-"` 1316 // Value - List of job resources. 1317 Value *[]JobResource `json:"value,omitempty"` 1318 // NextLink - Link for the next set of job resources. 1319 NextLink *string `json:"nextLink,omitempty"` 1320} 1321 1322// JobResourceListIterator provides access to a complete listing of JobResource values. 1323type JobResourceListIterator struct { 1324 i int 1325 page JobResourceListPage 1326} 1327 1328// Next advances to the next value. If there was an error making 1329// the request the iterator does not advance and the error is returned. 1330func (iter *JobResourceListIterator) Next() error { 1331 iter.i++ 1332 if iter.i < len(iter.page.Values()) { 1333 return nil 1334 } 1335 err := iter.page.Next() 1336 if err != nil { 1337 iter.i-- 1338 return err 1339 } 1340 iter.i = 0 1341 return nil 1342} 1343 1344// NotDone returns true if the enumeration should be started or is not yet complete. 1345func (iter JobResourceListIterator) NotDone() bool { 1346 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1347} 1348 1349// Response returns the raw server response from the last page request. 1350func (iter JobResourceListIterator) Response() JobResourceList { 1351 return iter.page.Response() 1352} 1353 1354// Value returns the current value or a zero-initialized value if the 1355// iterator has advanced beyond the end of the collection. 1356func (iter JobResourceListIterator) Value() JobResource { 1357 if !iter.page.NotDone() { 1358 return JobResource{} 1359 } 1360 return iter.page.Values()[iter.i] 1361} 1362 1363// IsEmpty returns true if the ListResult contains no values. 1364func (jrl JobResourceList) IsEmpty() bool { 1365 return jrl.Value == nil || len(*jrl.Value) == 0 1366} 1367 1368// jobResourceListPreparer prepares a request to retrieve the next set of results. 1369// It returns nil if no more results exist. 1370func (jrl JobResourceList) jobResourceListPreparer() (*http.Request, error) { 1371 if jrl.NextLink == nil || len(to.String(jrl.NextLink)) < 1 { 1372 return nil, nil 1373 } 1374 return autorest.Prepare(&http.Request{}, 1375 autorest.AsJSON(), 1376 autorest.AsGet(), 1377 autorest.WithBaseURL(to.String(jrl.NextLink))) 1378} 1379 1380// JobResourceListPage contains a page of JobResource values. 1381type JobResourceListPage struct { 1382 fn func(JobResourceList) (JobResourceList, error) 1383 jrl JobResourceList 1384} 1385 1386// Next advances to the next page of values. If there was an error making 1387// the request the page does not advance and the error is returned. 1388func (page *JobResourceListPage) Next() error { 1389 next, err := page.fn(page.jrl) 1390 if err != nil { 1391 return err 1392 } 1393 page.jrl = next 1394 return nil 1395} 1396 1397// NotDone returns true if the page enumeration should be started or is not yet complete. 1398func (page JobResourceListPage) NotDone() bool { 1399 return !page.jrl.IsEmpty() 1400} 1401 1402// Response returns the raw server response from the last page request. 1403func (page JobResourceListPage) Response() JobResourceList { 1404 return page.jrl 1405} 1406 1407// Values returns the slice of values for the current page or nil if there are no values. 1408func (page JobResourceListPage) Values() []JobResource { 1409 if page.jrl.IsEmpty() { 1410 return nil 1411 } 1412 return *page.jrl.Value 1413} 1414 1415// JobResourceUpdateParameter the JobResourceUpdateParameter. 1416type JobResourceUpdateParameter struct { 1417 // UpdateJobProperties - Properties of a job to be updated. 1418 *UpdateJobProperties `json:"properties,omitempty"` 1419 // 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). 1420 Tags map[string]*string `json:"tags"` 1421} 1422 1423// MarshalJSON is the custom marshaler for JobResourceUpdateParameter. 1424func (jrup JobResourceUpdateParameter) MarshalJSON() ([]byte, error) { 1425 objectMap := make(map[string]interface{}) 1426 if jrup.UpdateJobProperties != nil { 1427 objectMap["properties"] = jrup.UpdateJobProperties 1428 } 1429 if jrup.Tags != nil { 1430 objectMap["tags"] = jrup.Tags 1431 } 1432 return json.Marshal(objectMap) 1433} 1434 1435// UnmarshalJSON is the custom unmarshaler for JobResourceUpdateParameter struct. 1436func (jrup *JobResourceUpdateParameter) UnmarshalJSON(body []byte) error { 1437 var m map[string]*json.RawMessage 1438 err := json.Unmarshal(body, &m) 1439 if err != nil { 1440 return err 1441 } 1442 for k, v := range m { 1443 switch k { 1444 case "properties": 1445 if v != nil { 1446 var updateJobProperties UpdateJobProperties 1447 err = json.Unmarshal(*v, &updateJobProperties) 1448 if err != nil { 1449 return err 1450 } 1451 jrup.UpdateJobProperties = &updateJobProperties 1452 } 1453 case "tags": 1454 if v != nil { 1455 var tags map[string]*string 1456 err = json.Unmarshal(*v, &tags) 1457 if err != nil { 1458 return err 1459 } 1460 jrup.Tags = tags 1461 } 1462 } 1463 } 1464 1465 return nil 1466} 1467 1468// JobsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1469type JobsCreateFuture struct { 1470 azure.Future 1471 req *http.Request 1472} 1473 1474// Result returns the result of the asynchronous operation. 1475// If the operation has not completed it will return an error. 1476func (future JobsCreateFuture) Result(client JobsClient) (jr JobResource, err error) { 1477 var done bool 1478 done, err = future.Done(client) 1479 if err != nil { 1480 err = autorest.NewErrorWithError(err, "databox.JobsCreateFuture", "Result", future.Response(), "Polling failure") 1481 return 1482 } 1483 if !done { 1484 return jr, azure.NewAsyncOpIncompleteError("databox.JobsCreateFuture") 1485 } 1486 if future.PollingMethod() == azure.PollingLocation { 1487 jr, err = client.CreateResponder(future.Response()) 1488 if err != nil { 1489 err = autorest.NewErrorWithError(err, "databox.JobsCreateFuture", "Result", future.Response(), "Failure responding to request") 1490 } 1491 return 1492 } 1493 var req *http.Request 1494 var resp *http.Response 1495 if future.PollingURL() != "" { 1496 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1497 if err != nil { 1498 return 1499 } 1500 } else { 1501 req = autorest.ChangeToGet(future.req) 1502 } 1503 resp, err = autorest.SendWithSender(client, req, 1504 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1505 if err != nil { 1506 err = autorest.NewErrorWithError(err, "databox.JobsCreateFuture", "Result", resp, "Failure sending request") 1507 return 1508 } 1509 jr, err = client.CreateResponder(resp) 1510 if err != nil { 1511 err = autorest.NewErrorWithError(err, "databox.JobsCreateFuture", "Result", resp, "Failure responding to request") 1512 } 1513 return 1514} 1515 1516// BasicJobSecrets the base class for the secrets 1517type BasicJobSecrets interface { 1518 AsCabinetJobSecrets() (*CabinetJobSecrets, bool) 1519 AsDiskJobSecrets() (*DiskJobSecrets, bool) 1520 AsPodJobSecrets() (*PodJobSecrets, bool) 1521 AsJobSecrets() (*JobSecrets, bool) 1522} 1523 1524// JobSecrets the base class for the secrets 1525type JobSecrets struct { 1526 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeCabinet', 'JobSecretsTypeDisk', 'JobSecretsTypePod' 1527 JobSecretsType JobSecretsType `json:"jobSecretsType,omitempty"` 1528} 1529 1530func unmarshalBasicJobSecrets(body []byte) (BasicJobSecrets, error) { 1531 var m map[string]interface{} 1532 err := json.Unmarshal(body, &m) 1533 if err != nil { 1534 return nil, err 1535 } 1536 1537 switch m["jobSecretsType"] { 1538 case string(JobSecretsTypeCabinet): 1539 var cjs CabinetJobSecrets 1540 err := json.Unmarshal(body, &cjs) 1541 return cjs, err 1542 case string(JobSecretsTypeDisk): 1543 var djs DiskJobSecrets 1544 err := json.Unmarshal(body, &djs) 1545 return djs, err 1546 case string(JobSecretsTypePod): 1547 var pjs PodJobSecrets 1548 err := json.Unmarshal(body, &pjs) 1549 return pjs, err 1550 default: 1551 var js JobSecrets 1552 err := json.Unmarshal(body, &js) 1553 return js, err 1554 } 1555} 1556func unmarshalBasicJobSecretsArray(body []byte) ([]BasicJobSecrets, error) { 1557 var rawMessages []*json.RawMessage 1558 err := json.Unmarshal(body, &rawMessages) 1559 if err != nil { 1560 return nil, err 1561 } 1562 1563 jsArray := make([]BasicJobSecrets, len(rawMessages)) 1564 1565 for index, rawMessage := range rawMessages { 1566 js, err := unmarshalBasicJobSecrets(*rawMessage) 1567 if err != nil { 1568 return nil, err 1569 } 1570 jsArray[index] = js 1571 } 1572 return jsArray, nil 1573} 1574 1575// MarshalJSON is the custom marshaler for JobSecrets. 1576func (js JobSecrets) MarshalJSON() ([]byte, error) { 1577 js.JobSecretsType = JobSecretsTypeJobSecrets 1578 objectMap := make(map[string]interface{}) 1579 if js.JobSecretsType != "" { 1580 objectMap["jobSecretsType"] = js.JobSecretsType 1581 } 1582 return json.Marshal(objectMap) 1583} 1584 1585// AsCabinetJobSecrets is the BasicJobSecrets implementation for JobSecrets. 1586func (js JobSecrets) AsCabinetJobSecrets() (*CabinetJobSecrets, bool) { 1587 return nil, false 1588} 1589 1590// AsDiskJobSecrets is the BasicJobSecrets implementation for JobSecrets. 1591func (js JobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 1592 return nil, false 1593} 1594 1595// AsPodJobSecrets is the BasicJobSecrets implementation for JobSecrets. 1596func (js JobSecrets) AsPodJobSecrets() (*PodJobSecrets, bool) { 1597 return nil, false 1598} 1599 1600// AsJobSecrets is the BasicJobSecrets implementation for JobSecrets. 1601func (js JobSecrets) AsJobSecrets() (*JobSecrets, bool) { 1602 return &js, true 1603} 1604 1605// AsBasicJobSecrets is the BasicJobSecrets implementation for JobSecrets. 1606func (js JobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 1607 return &js, true 1608} 1609 1610// JobStages job stages. 1611type JobStages struct { 1612 // StageName - Name of the job stage. Possible values include: 'StageNameDeviceOrdered', 'StageNameDevicePrepared', 'StageNameDispatched', 'StageNameDelivered', 'StageNamePickedUp', 'StageNameAtAzureDC', 'StageNameDataCopy', 'StageNameCompleted', 'StageNameCompletedWithErrors', 'StageNameCancelled', 'StageNameFailedIssueReportedAtCustomer', 'StageNameFailedIssueDetectedAtAzureDC', 'StageNameAborted' 1613 StageName StageName `json:"stageName,omitempty"` 1614 // DisplayName - Display name of the job stage. 1615 DisplayName *string `json:"displayName,omitempty"` 1616 // StageStatus - Status of the job stage. Possible values include: 'StageStatusNone', 'StageStatusInProgress', 'StageStatusSucceeded', 'StageStatusFailed', 'StageStatusCancelled', 'StageStatusCancelling', 'StageStatusSucceededWithErrors' 1617 StageStatus StageStatus `json:"stageStatus,omitempty"` 1618 // StageTime - Time for the job stage in UTC ISO 8601 format. 1619 StageTime *date.Time `json:"stageTime,omitempty"` 1620 // JobStageDetails - Job Stage Details 1621 JobStageDetails interface{} `json:"jobStageDetails,omitempty"` 1622 // ErrorDetails - Error details for the stage. 1623 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 1624} 1625 1626// JobsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. 1627type JobsUpdateFuture struct { 1628 azure.Future 1629 req *http.Request 1630} 1631 1632// Result returns the result of the asynchronous operation. 1633// If the operation has not completed it will return an error. 1634func (future JobsUpdateFuture) Result(client JobsClient) (jr JobResource, err error) { 1635 var done bool 1636 done, err = future.Done(client) 1637 if err != nil { 1638 err = autorest.NewErrorWithError(err, "databox.JobsUpdateFuture", "Result", future.Response(), "Polling failure") 1639 return 1640 } 1641 if !done { 1642 return jr, azure.NewAsyncOpIncompleteError("databox.JobsUpdateFuture") 1643 } 1644 if future.PollingMethod() == azure.PollingLocation { 1645 jr, err = client.UpdateResponder(future.Response()) 1646 if err != nil { 1647 err = autorest.NewErrorWithError(err, "databox.JobsUpdateFuture", "Result", future.Response(), "Failure responding to request") 1648 } 1649 return 1650 } 1651 var req *http.Request 1652 var resp *http.Response 1653 if future.PollingURL() != "" { 1654 req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) 1655 if err != nil { 1656 return 1657 } 1658 } else { 1659 req = autorest.ChangeToGet(future.req) 1660 } 1661 resp, err = autorest.SendWithSender(client, req, 1662 autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 1663 if err != nil { 1664 err = autorest.NewErrorWithError(err, "databox.JobsUpdateFuture", "Result", resp, "Failure sending request") 1665 return 1666 } 1667 jr, err = client.UpdateResponder(resp) 1668 if err != nil { 1669 err = autorest.NewErrorWithError(err, "databox.JobsUpdateFuture", "Result", resp, "Failure responding to request") 1670 } 1671 return 1672} 1673 1674// NotificationPreference notification preference for a job stage. 1675type NotificationPreference struct { 1676 // StageName - Name of the stage. Possible values include: 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy' 1677 StageName NotificationStageName `json:"stageName,omitempty"` 1678 // SendNotification - Notification is required or not. 1679 SendNotification *bool `json:"sendNotification,omitempty"` 1680} 1681 1682// Operation operation entity. 1683type Operation struct { 1684 // Name - Name of the operation. Format: {resourceProviderNamespace}/{resourceType}/{read|write|delete|action} 1685 Name *string `json:"name,omitempty"` 1686 // Display - Operation display values. 1687 Display *OperationDisplay `json:"display,omitempty"` 1688 // Properties - Operation properties. 1689 Properties interface{} `json:"properties,omitempty"` 1690 // Origin - Origin of the operation. Can be : user|system|user,system 1691 Origin *string `json:"origin,omitempty"` 1692} 1693 1694// OperationDisplay operation display 1695type OperationDisplay struct { 1696 // Provider - Provider name. 1697 Provider *string `json:"provider,omitempty"` 1698 // Resource - Resource name. 1699 Resource *string `json:"resource,omitempty"` 1700 // Operation - Localized name of the operation for display purpose. 1701 Operation *string `json:"operation,omitempty"` 1702 // Description - Localized description of the operation for display purpose. 1703 Description *string `json:"description,omitempty"` 1704} 1705 1706// OperationList operation Collection. 1707type OperationList struct { 1708 autorest.Response `json:"-"` 1709 // Value - List of operations. 1710 Value *[]Operation `json:"value,omitempty"` 1711 // NextLink - Link for the next set of operations. 1712 NextLink *string `json:"nextLink,omitempty"` 1713} 1714 1715// OperationListIterator provides access to a complete listing of Operation values. 1716type OperationListIterator struct { 1717 i int 1718 page OperationListPage 1719} 1720 1721// Next advances to the next value. If there was an error making 1722// the request the iterator does not advance and the error is returned. 1723func (iter *OperationListIterator) Next() error { 1724 iter.i++ 1725 if iter.i < len(iter.page.Values()) { 1726 return nil 1727 } 1728 err := iter.page.Next() 1729 if err != nil { 1730 iter.i-- 1731 return err 1732 } 1733 iter.i = 0 1734 return nil 1735} 1736 1737// NotDone returns true if the enumeration should be started or is not yet complete. 1738func (iter OperationListIterator) NotDone() bool { 1739 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 1740} 1741 1742// Response returns the raw server response from the last page request. 1743func (iter OperationListIterator) Response() OperationList { 1744 return iter.page.Response() 1745} 1746 1747// Value returns the current value or a zero-initialized value if the 1748// iterator has advanced beyond the end of the collection. 1749func (iter OperationListIterator) Value() Operation { 1750 if !iter.page.NotDone() { 1751 return Operation{} 1752 } 1753 return iter.page.Values()[iter.i] 1754} 1755 1756// IsEmpty returns true if the ListResult contains no values. 1757func (ol OperationList) IsEmpty() bool { 1758 return ol.Value == nil || len(*ol.Value) == 0 1759} 1760 1761// operationListPreparer prepares a request to retrieve the next set of results. 1762// It returns nil if no more results exist. 1763func (ol OperationList) operationListPreparer() (*http.Request, error) { 1764 if ol.NextLink == nil || len(to.String(ol.NextLink)) < 1 { 1765 return nil, nil 1766 } 1767 return autorest.Prepare(&http.Request{}, 1768 autorest.AsJSON(), 1769 autorest.AsGet(), 1770 autorest.WithBaseURL(to.String(ol.NextLink))) 1771} 1772 1773// OperationListPage contains a page of Operation values. 1774type OperationListPage struct { 1775 fn func(OperationList) (OperationList, error) 1776 ol OperationList 1777} 1778 1779// Next advances to the next page of values. If there was an error making 1780// the request the page does not advance and the error is returned. 1781func (page *OperationListPage) Next() error { 1782 next, err := page.fn(page.ol) 1783 if err != nil { 1784 return err 1785 } 1786 page.ol = next 1787 return nil 1788} 1789 1790// NotDone returns true if the page enumeration should be started or is not yet complete. 1791func (page OperationListPage) NotDone() bool { 1792 return !page.ol.IsEmpty() 1793} 1794 1795// Response returns the raw server response from the last page request. 1796func (page OperationListPage) Response() OperationList { 1797 return page.ol 1798} 1799 1800// Values returns the slice of values for the current page or nil if there are no values. 1801func (page OperationListPage) Values() []Operation { 1802 if page.ol.IsEmpty() { 1803 return nil 1804 } 1805 return *page.ol.Value 1806} 1807 1808// PackageShippingDetails shipping details. 1809type PackageShippingDetails struct { 1810 // CarrierName - Name of the carrier. 1811 CarrierName *string `json:"carrierName,omitempty"` 1812 // TrackingID - Tracking Id of shipment. 1813 TrackingID *string `json:"trackingId,omitempty"` 1814 // TrackingURL - Url where shipment can be tracked. 1815 TrackingURL *string `json:"trackingUrl,omitempty"` 1816} 1817 1818// PodJobDetails pod Job Details 1819type PodJobDetails struct { 1820 // CopyProgress - Copy progress per account. 1821 CopyProgress *[]CopyProgress `json:"copyProgress,omitempty"` 1822 // ExpectedDataSizeInTeraBytes - The expected size of the data, which needs to be transfered in this job, in tera bytes. 1823 ExpectedDataSizeInTeraBytes *int32 `json:"expectedDataSizeInTeraBytes,omitempty"` 1824 // JobStages - List of stages that run in the job. 1825 JobStages *[]JobStages `json:"jobStages,omitempty"` 1826 // ContactDetails - Contact details for notification and shipping. 1827 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 1828 // ShippingAddress - Shipping address of the customer. 1829 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 1830 // ErrorDetails - Error details for failure. This is optional. 1831 ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` 1832 // JobDetailsType - Possible values include: 'JobDetailsTypeJobDetails', 'JobDetailsTypeDisk', 'JobDetailsTypePod' 1833 JobDetailsType JobDetailsType `json:"jobDetailsType,omitempty"` 1834} 1835 1836// MarshalJSON is the custom marshaler for PodJobDetails. 1837func (pjd PodJobDetails) MarshalJSON() ([]byte, error) { 1838 pjd.JobDetailsType = JobDetailsTypePod 1839 objectMap := make(map[string]interface{}) 1840 if pjd.CopyProgress != nil { 1841 objectMap["copyProgress"] = pjd.CopyProgress 1842 } 1843 if pjd.ExpectedDataSizeInTeraBytes != nil { 1844 objectMap["expectedDataSizeInTeraBytes"] = pjd.ExpectedDataSizeInTeraBytes 1845 } 1846 if pjd.JobStages != nil { 1847 objectMap["jobStages"] = pjd.JobStages 1848 } 1849 if pjd.ContactDetails != nil { 1850 objectMap["contactDetails"] = pjd.ContactDetails 1851 } 1852 if pjd.ShippingAddress != nil { 1853 objectMap["shippingAddress"] = pjd.ShippingAddress 1854 } 1855 if pjd.ErrorDetails != nil { 1856 objectMap["errorDetails"] = pjd.ErrorDetails 1857 } 1858 if pjd.JobDetailsType != "" { 1859 objectMap["jobDetailsType"] = pjd.JobDetailsType 1860 } 1861 return json.Marshal(objectMap) 1862} 1863 1864// AsDiskJobDetails is the BasicJobDetails implementation for PodJobDetails. 1865func (pjd PodJobDetails) AsDiskJobDetails() (*DiskJobDetails, bool) { 1866 return nil, false 1867} 1868 1869// AsPodJobDetails is the BasicJobDetails implementation for PodJobDetails. 1870func (pjd PodJobDetails) AsPodJobDetails() (*PodJobDetails, bool) { 1871 return &pjd, true 1872} 1873 1874// AsJobDetails is the BasicJobDetails implementation for PodJobDetails. 1875func (pjd PodJobDetails) AsJobDetails() (*JobDetails, bool) { 1876 return nil, false 1877} 1878 1879// AsBasicJobDetails is the BasicJobDetails implementation for PodJobDetails. 1880func (pjd PodJobDetails) AsBasicJobDetails() (BasicJobDetails, bool) { 1881 return &pjd, true 1882} 1883 1884// PodJobSecrets the secrets related to a pod job. 1885type PodJobSecrets struct { 1886 // PodSecrets - Contains the list of secret objects for a job. 1887 PodSecrets *[]PodSecret `json:"podSecrets,omitempty"` 1888 // JobSecretsType - Possible values include: 'JobSecretsTypeJobSecrets', 'JobSecretsTypeCabinet', 'JobSecretsTypeDisk', 'JobSecretsTypePod' 1889 JobSecretsType JobSecretsType `json:"jobSecretsType,omitempty"` 1890} 1891 1892// MarshalJSON is the custom marshaler for PodJobSecrets. 1893func (pjs PodJobSecrets) MarshalJSON() ([]byte, error) { 1894 pjs.JobSecretsType = JobSecretsTypePod 1895 objectMap := make(map[string]interface{}) 1896 if pjs.PodSecrets != nil { 1897 objectMap["podSecrets"] = pjs.PodSecrets 1898 } 1899 if pjs.JobSecretsType != "" { 1900 objectMap["jobSecretsType"] = pjs.JobSecretsType 1901 } 1902 return json.Marshal(objectMap) 1903} 1904 1905// AsCabinetJobSecrets is the BasicJobSecrets implementation for PodJobSecrets. 1906func (pjs PodJobSecrets) AsCabinetJobSecrets() (*CabinetJobSecrets, bool) { 1907 return nil, false 1908} 1909 1910// AsDiskJobSecrets is the BasicJobSecrets implementation for PodJobSecrets. 1911func (pjs PodJobSecrets) AsDiskJobSecrets() (*DiskJobSecrets, bool) { 1912 return nil, false 1913} 1914 1915// AsPodJobSecrets is the BasicJobSecrets implementation for PodJobSecrets. 1916func (pjs PodJobSecrets) AsPodJobSecrets() (*PodJobSecrets, bool) { 1917 return &pjs, true 1918} 1919 1920// AsJobSecrets is the BasicJobSecrets implementation for PodJobSecrets. 1921func (pjs PodJobSecrets) AsJobSecrets() (*JobSecrets, bool) { 1922 return nil, false 1923} 1924 1925// AsBasicJobSecrets is the BasicJobSecrets implementation for PodJobSecrets. 1926func (pjs PodJobSecrets) AsBasicJobSecrets() (BasicJobSecrets, bool) { 1927 return &pjs, true 1928} 1929 1930// PodSecret the secrets related to a Pod. 1931type PodSecret struct { 1932 // DeviceSerialNumber - Serial number of the assigned device. 1933 DeviceSerialNumber *string `json:"deviceSerialNumber,omitempty"` 1934 // DevicePassword - Password for out of the box experience on device. 1935 DevicePassword *string `json:"devicePassword,omitempty"` 1936 // AccountCredentialDetails - Per account level access credentials. 1937 AccountCredentialDetails *[]AccountCredentialDetails `json:"accountCredentialDetails,omitempty"` 1938} 1939 1940// ReportIssueDetails details of the reported issue. 1941type ReportIssueDetails struct { 1942 // IssueType - Issue Type. Possible values include: 'DeviceMismatch', 'ValidationStringMismatch', 'CredentialNotWorking', 'DeviceFailure' 1943 IssueType IssueType `json:"issueType,omitempty"` 1944 // DeviceIssueType - Device Issue Type. Only used for Device failure issue. Possible values include: 'DeviceTampering', 'DeviceNotBootingUp', 'DeviceHealthCheckShowFailures', 'NICsAreNotWorking', 'Misc' 1945 DeviceIssueType DeviceIssueType `json:"deviceIssueType,omitempty"` 1946} 1947 1948// Resource model of the Resource. 1949type Resource struct { 1950 // 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. 1951 Location *string `json:"location,omitempty"` 1952 // 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). 1953 Tags map[string]*string `json:"tags"` 1954 // Sku - The sku type. 1955 Sku *Sku `json:"sku,omitempty"` 1956} 1957 1958// MarshalJSON is the custom marshaler for Resource. 1959func (r Resource) MarshalJSON() ([]byte, error) { 1960 objectMap := make(map[string]interface{}) 1961 if r.Location != nil { 1962 objectMap["location"] = r.Location 1963 } 1964 if r.Tags != nil { 1965 objectMap["tags"] = r.Tags 1966 } 1967 if r.Sku != nil { 1968 objectMap["sku"] = r.Sku 1969 } 1970 return json.Marshal(objectMap) 1971} 1972 1973// ShareCredentialDetails credential details of the shares in account. 1974type ShareCredentialDetails struct { 1975 // ShareName - Name of the share. 1976 ShareName *string `json:"shareName,omitempty"` 1977 // UserName - User name for the share. 1978 UserName *string `json:"userName,omitempty"` 1979 // Password - Password for the share. 1980 Password *string `json:"password,omitempty"` 1981} 1982 1983// ShipmentPickUpRequest shipment pick up request details. 1984type ShipmentPickUpRequest struct { 1985 // StartTime - Minimum date after which the pick up should commence, this must be in local time of pick up area. 1986 StartTime *date.Time `json:"startTime,omitempty"` 1987 // EndTime - Maximum date before which the pick up should commence, this must be in local time of pick up area. 1988 EndTime *date.Time `json:"endTime,omitempty"` 1989 // ShipmentLocation - Shipment Location in the pickup place. Eg.front desk 1990 ShipmentLocation *string `json:"shipmentLocation,omitempty"` 1991} 1992 1993// ShipmentPickUpResponse shipment pick up response. 1994type ShipmentPickUpResponse struct { 1995 autorest.Response `json:"-"` 1996 // ConfirmationNumber - Confirmation number for the pick up request. 1997 ConfirmationNumber *string `json:"confirmationNumber,omitempty"` 1998 // ReadyByTime - Time by which shipment should be ready for pick up, this is in local time of pick up area. 1999 ReadyByTime *date.Time `json:"readyByTime,omitempty"` 2000} 2001 2002// ShippingAddress shipping address where customer wishes to receive the device. 2003type ShippingAddress struct { 2004 // StreetAddress1 - Street Address line 1. 2005 StreetAddress1 *string `json:"streetAddress1,omitempty"` 2006 // StreetAddress2 - Street Address line 2. 2007 StreetAddress2 *string `json:"streetAddress2,omitempty"` 2008 // StreetAddress3 - Street Address line 3. 2009 StreetAddress3 *string `json:"streetAddress3,omitempty"` 2010 // City - Name of the City. 2011 City *string `json:"city,omitempty"` 2012 // StateOrProvince - Name of the State or Province. 2013 StateOrProvince *string `json:"stateOrProvince,omitempty"` 2014 // Country - Name of the Country. 2015 Country *string `json:"country,omitempty"` 2016 // PostalCode - Postal code. 2017 PostalCode *string `json:"postalCode,omitempty"` 2018 // ZipExtendedCode - Extended Zip Code. 2019 ZipExtendedCode *string `json:"zipExtendedCode,omitempty"` 2020 // CompanyName - Name of the company. 2021 CompanyName *string `json:"companyName,omitempty"` 2022 // AddressType - Type of address. Possible values include: 'None', 'Residential', 'Commercial' 2023 AddressType AddressType `json:"addressType,omitempty"` 2024} 2025 2026// ShippingLabelDetails details for the shipping label. 2027type ShippingLabelDetails struct { 2028 autorest.Response `json:"-"` 2029 // ShippingLabelSasURI - Sas uri for accessing the shipping label. 2030 ShippingLabelSasURI *string `json:"shippingLabelSasUri,omitempty"` 2031} 2032 2033// Sku the Sku. 2034type Sku struct { 2035 // Name - The sku name. 2036 Name *string `json:"name,omitempty"` 2037 // DisplayName - The display name of the sku. 2038 DisplayName *string `json:"displayName,omitempty"` 2039 // Family - The sku family. 2040 Family *string `json:"family,omitempty"` 2041} 2042 2043// SkuCapacity capacity of the sku. 2044type SkuCapacity struct { 2045 // Usable - Usable capacity in TB. 2046 Usable *string `json:"usable,omitempty"` 2047 // Maximum - Maximum capacity in TB. 2048 Maximum *string `json:"maximum,omitempty"` 2049} 2050 2051// SkuCost describes metadata for retrieving price info. 2052type SkuCost struct { 2053 // MeterID - Meter id of the Sku. 2054 MeterID *string `json:"meterId,omitempty"` 2055 // MeterType - The type of the meter. 2056 MeterType *string `json:"meterType,omitempty"` 2057} 2058 2059// SkuInformation information of the sku. 2060type SkuInformation struct { 2061 // Sku - The Sku. 2062 Sku *Sku `json:"sku,omitempty"` 2063 // Enabled - The sku is enabled or not. 2064 Enabled *bool `json:"enabled,omitempty"` 2065 // SkuProperties - Properties of the sku. 2066 *SkuProperties `json:"properties,omitempty"` 2067} 2068 2069// MarshalJSON is the custom marshaler for SkuInformation. 2070func (si SkuInformation) MarshalJSON() ([]byte, error) { 2071 objectMap := make(map[string]interface{}) 2072 if si.Sku != nil { 2073 objectMap["sku"] = si.Sku 2074 } 2075 if si.Enabled != nil { 2076 objectMap["enabled"] = si.Enabled 2077 } 2078 if si.SkuProperties != nil { 2079 objectMap["properties"] = si.SkuProperties 2080 } 2081 return json.Marshal(objectMap) 2082} 2083 2084// UnmarshalJSON is the custom unmarshaler for SkuInformation struct. 2085func (si *SkuInformation) UnmarshalJSON(body []byte) error { 2086 var m map[string]*json.RawMessage 2087 err := json.Unmarshal(body, &m) 2088 if err != nil { 2089 return err 2090 } 2091 for k, v := range m { 2092 switch k { 2093 case "sku": 2094 if v != nil { 2095 var sku Sku 2096 err = json.Unmarshal(*v, &sku) 2097 if err != nil { 2098 return err 2099 } 2100 si.Sku = &sku 2101 } 2102 case "enabled": 2103 if v != nil { 2104 var enabled bool 2105 err = json.Unmarshal(*v, &enabled) 2106 if err != nil { 2107 return err 2108 } 2109 si.Enabled = &enabled 2110 } 2111 case "properties": 2112 if v != nil { 2113 var skuProperties SkuProperties 2114 err = json.Unmarshal(*v, &skuProperties) 2115 if err != nil { 2116 return err 2117 } 2118 si.SkuProperties = &skuProperties 2119 } 2120 } 2121 } 2122 2123 return nil 2124} 2125 2126// SkuProperties properties of the sku. 2127type SkuProperties struct { 2128 // DestinationToServiceLocationMap - The map of destination location to service location. 2129 DestinationToServiceLocationMap *[]DestinationToServiceLocationMap `json:"destinationToServiceLocationMap,omitempty"` 2130 // Capacity - Capacity of the Sku. 2131 Capacity *SkuCapacity `json:"capacity,omitempty"` 2132 // Costs - Cost of the Sku. 2133 Costs *[]SkuCost `json:"costs,omitempty"` 2134 // APIVersions - Api versions that support this Sku. 2135 APIVersions *[]string `json:"apiVersions,omitempty"` 2136 // DisabledReason - Reason why the Sku is disabled. 2137 DisabledReason *string `json:"disabledReason,omitempty"` 2138} 2139 2140// UnencryptedSecrets unencrypted secrets for accessing device. 2141type UnencryptedSecrets struct { 2142 autorest.Response `json:"-"` 2143 // JobName - Name of the job. 2144 JobName *string `json:"jobName,omitempty"` 2145 // DeviceType - The Device Type used in the job. Possible values include: 'Pod', 'Disk', 'Cabinet' 2146 DeviceType DeviceType `json:"deviceType,omitempty"` 2147 // JobSecrets - Secrets related to this job. 2148 JobSecrets BasicJobSecrets `json:"jobSecrets,omitempty"` 2149} 2150 2151// UnmarshalJSON is the custom unmarshaler for UnencryptedSecrets struct. 2152func (us *UnencryptedSecrets) UnmarshalJSON(body []byte) error { 2153 var m map[string]*json.RawMessage 2154 err := json.Unmarshal(body, &m) 2155 if err != nil { 2156 return err 2157 } 2158 for k, v := range m { 2159 switch k { 2160 case "jobName": 2161 if v != nil { 2162 var jobName string 2163 err = json.Unmarshal(*v, &jobName) 2164 if err != nil { 2165 return err 2166 } 2167 us.JobName = &jobName 2168 } 2169 case "deviceType": 2170 if v != nil { 2171 var deviceType DeviceType 2172 err = json.Unmarshal(*v, &deviceType) 2173 if err != nil { 2174 return err 2175 } 2176 us.DeviceType = deviceType 2177 } 2178 case "jobSecrets": 2179 if v != nil { 2180 jobSecrets, err := unmarshalBasicJobSecrets(*v) 2181 if err != nil { 2182 return err 2183 } 2184 us.JobSecrets = jobSecrets 2185 } 2186 } 2187 } 2188 2189 return nil 2190} 2191 2192// UpdateJobDetails job details for update. 2193type UpdateJobDetails struct { 2194 // ContactDetails - Contact details for notification and shipping. 2195 ContactDetails *ContactDetails `json:"contactDetails,omitempty"` 2196 // ShippingAddress - Shipping address of the customer. 2197 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 2198} 2199 2200// UpdateJobProperties job Properties for update 2201type UpdateJobProperties struct { 2202 // Details - Details of a job to be updated. 2203 Details *UpdateJobDetails `json:"details,omitempty"` 2204} 2205 2206// ValidateAddress the requirements to validate customer address where the device needs to be shipped. 2207type ValidateAddress struct { 2208 // ShippingAddress - Shipping address of the customer. 2209 ShippingAddress *ShippingAddress `json:"shippingAddress,omitempty"` 2210 // DeviceType - Device type to be used for the job. Possible values include: 'Pod', 'Disk', 'Cabinet' 2211 DeviceType DeviceType `json:"deviceType,omitempty"` 2212} 2213