1package storageimportexport 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/to" 14 "github.com/Azure/go-autorest/tracing" 15 "net/http" 16) 17 18// The package's fully qualified name. 19const fqdn = "github.com/Azure/azure-sdk-for-go/services/storageimportexport/mgmt/2020-08-01/storageimportexport" 20 21// DeliveryPackageInformation contains information about the delivery package being shipped by the customer 22// to the Microsoft data center. 23type DeliveryPackageInformation struct { 24 // CarrierName - The name of the carrier that is used to ship the import or export drives. 25 CarrierName *string `json:"carrierName,omitempty"` 26 // TrackingNumber - The tracking number of the package. 27 TrackingNumber *string `json:"trackingNumber,omitempty"` 28 // DriveCount - The number of drives included in the package. 29 DriveCount *int64 `json:"driveCount,omitempty"` 30 // ShipDate - The date when the package is shipped. 31 ShipDate *string `json:"shipDate,omitempty"` 32} 33 34// DriveBitLockerKey bitLocker recovery key or password to the specified drive 35type DriveBitLockerKey struct { 36 // BitLockerKey - BitLocker recovery key or password 37 BitLockerKey *string `json:"bitLockerKey,omitempty"` 38 // DriveID - Drive ID 39 DriveID *string `json:"driveId,omitempty"` 40} 41 42// DriveStatus provides information about the drive's status 43type DriveStatus struct { 44 // DriveID - The drive's hardware serial number, without spaces. 45 DriveID *string `json:"driveId,omitempty"` 46 // BitLockerKey - The BitLocker key used to encrypt the drive. 47 BitLockerKey *string `json:"bitLockerKey,omitempty"` 48 // ManifestFile - The relative path of the manifest file on the drive. 49 ManifestFile *string `json:"manifestFile,omitempty"` 50 // ManifestHash - The Base16-encoded MD5 hash of the manifest file on the drive. 51 ManifestHash *string `json:"manifestHash,omitempty"` 52 // DriveHeaderHash - The drive header hash value. 53 DriveHeaderHash *string `json:"driveHeaderHash,omitempty"` 54 // State - The drive's current state. Possible values include: 'Specified', 'Received', 'NeverReceived', 'Transferring', 'Completed', 'CompletedMoreInfo', 'ShippedBack' 55 State DriveState `json:"state,omitempty"` 56 // CopyStatus - Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. 57 CopyStatus *string `json:"copyStatus,omitempty"` 58 // PercentComplete - Percentage completed for the drive. 59 PercentComplete *int32 `json:"percentComplete,omitempty"` 60 // VerboseLogURI - A URI that points to the blob containing the verbose log for the data transfer operation. 61 VerboseLogURI *string `json:"verboseLogUri,omitempty"` 62 // ErrorLogURI - A URI that points to the blob containing the error log for the data transfer operation. 63 ErrorLogURI *string `json:"errorLogUri,omitempty"` 64 // ManifestURI - A URI that points to the blob containing the drive manifest file. 65 ManifestURI *string `json:"manifestUri,omitempty"` 66 // BytesSucceeded - Bytes successfully transferred for the drive. 67 BytesSucceeded *int64 `json:"bytesSucceeded,omitempty"` 68} 69 70// EncryptionKeyDetails specifies the encryption key properties 71type EncryptionKeyDetails struct { 72 // KekType - The type of kek encryption key. Possible values include: 'MicrosoftManaged', 'CustomerManaged' 73 KekType KekType `json:"kekType,omitempty"` 74 // KekURL - Specifies the url for kek encryption key. 75 KekURL *string `json:"kekUrl,omitempty"` 76 // KekVaultResourceID - Specifies the keyvault resource id for kek encryption key. 77 KekVaultResourceID *string `json:"kekVaultResourceID,omitempty"` 78} 79 80// ErrorResponse response when errors occurred 81type ErrorResponse struct { 82 // ErrorResponseError - Describes the error information. 83 *ErrorResponseError `json:"error,omitempty"` 84} 85 86// MarshalJSON is the custom marshaler for ErrorResponse. 87func (er ErrorResponse) MarshalJSON() ([]byte, error) { 88 objectMap := make(map[string]interface{}) 89 if er.ErrorResponseError != nil { 90 objectMap["error"] = er.ErrorResponseError 91 } 92 return json.Marshal(objectMap) 93} 94 95// UnmarshalJSON is the custom unmarshaler for ErrorResponse struct. 96func (er *ErrorResponse) UnmarshalJSON(body []byte) error { 97 var m map[string]*json.RawMessage 98 err := json.Unmarshal(body, &m) 99 if err != nil { 100 return err 101 } 102 for k, v := range m { 103 switch k { 104 case "error": 105 if v != nil { 106 var errorResponseError ErrorResponseError 107 err = json.Unmarshal(*v, &errorResponseError) 108 if err != nil { 109 return err 110 } 111 er.ErrorResponseError = &errorResponseError 112 } 113 } 114 } 115 116 return nil 117} 118 119// ErrorResponseError describes the error information. 120type ErrorResponseError struct { 121 // Code - Provides information about the error code. 122 Code *string `json:"code,omitempty"` 123 // Message - Provides information about the error message. 124 Message *string `json:"message,omitempty"` 125 // Target - Provides information about the error target. 126 Target *string `json:"target,omitempty"` 127 // Details - Describes the error details if present. 128 Details *[]ErrorResponseErrorDetailsItem `json:"details,omitempty"` 129 // Innererror - Inner error object if present. 130 Innererror interface{} `json:"innererror,omitempty"` 131} 132 133// ErrorResponseErrorDetailsItem ... 134type ErrorResponseErrorDetailsItem struct { 135 // Code - Provides information about the error code. 136 Code *string `json:"code,omitempty"` 137 // Target - Provides information about the error target. 138 Target *string `json:"target,omitempty"` 139 // Message - Provides information about the error message. 140 Message *string `json:"message,omitempty"` 141} 142 143// Export a property containing information about the blobs to be exported for an export job. This property 144// is required for export jobs, but must not be specified for import jobs. 145type Export struct { 146 // ExportBlobList - A list of the blobs to be exported. 147 *ExportBlobList `json:"blobList,omitempty"` 148 // BlobListBlobPath - The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. 149 BlobListBlobPath *string `json:"blobListBlobPath,omitempty"` 150} 151 152// MarshalJSON is the custom marshaler for Export. 153func (e Export) MarshalJSON() ([]byte, error) { 154 objectMap := make(map[string]interface{}) 155 if e.ExportBlobList != nil { 156 objectMap["blobList"] = e.ExportBlobList 157 } 158 if e.BlobListBlobPath != nil { 159 objectMap["blobListBlobPath"] = e.BlobListBlobPath 160 } 161 return json.Marshal(objectMap) 162} 163 164// UnmarshalJSON is the custom unmarshaler for Export struct. 165func (e *Export) UnmarshalJSON(body []byte) error { 166 var m map[string]*json.RawMessage 167 err := json.Unmarshal(body, &m) 168 if err != nil { 169 return err 170 } 171 for k, v := range m { 172 switch k { 173 case "blobList": 174 if v != nil { 175 var exportBlobList ExportBlobList 176 err = json.Unmarshal(*v, &exportBlobList) 177 if err != nil { 178 return err 179 } 180 e.ExportBlobList = &exportBlobList 181 } 182 case "blobListBlobPath": 183 if v != nil { 184 var blobListBlobPath string 185 err = json.Unmarshal(*v, &blobListBlobPath) 186 if err != nil { 187 return err 188 } 189 e.BlobListBlobPath = &blobListBlobPath 190 } 191 } 192 } 193 194 return nil 195} 196 197// ExportBlobList a list of the blobs to be exported. 198type ExportBlobList struct { 199 // BlobPath - A collection of blob-path strings. 200 BlobPath *[]string `json:"blobPath,omitempty"` 201 // BlobPathPrefix - A collection of blob-prefix strings. 202 BlobPathPrefix *[]string `json:"blobPathPrefix,omitempty"` 203} 204 205// GetBitLockerKeysResponse getBitLockerKeys response 206type GetBitLockerKeysResponse struct { 207 autorest.Response `json:"-"` 208 // Value - drive status 209 Value *[]DriveBitLockerKey `json:"value,omitempty"` 210} 211 212// IdentityDetails specifies the identity properties. 213type IdentityDetails struct { 214 // Type - The type of identity. Possible values include: 'None', 'SystemAssigned', 'UserAssigned' 215 Type Type `json:"type,omitempty"` 216 // PrincipalID - READ-ONLY; Specifies the principal id for the identity for the job. 217 PrincipalID *string `json:"principalId,omitempty"` 218 // TenantID - READ-ONLY; Specifies the tenant id for the identity for the job. 219 TenantID *string `json:"tenantId,omitempty"` 220} 221 222// MarshalJSON is the custom marshaler for IdentityDetails. 223func (ID IdentityDetails) MarshalJSON() ([]byte, error) { 224 objectMap := make(map[string]interface{}) 225 if ID.Type != "" { 226 objectMap["type"] = ID.Type 227 } 228 return json.Marshal(objectMap) 229} 230 231// JobDetails specifies the job properties 232type JobDetails struct { 233 // StorageAccountID - The resource identifier of the storage account where data will be imported to or exported from. 234 StorageAccountID *string `json:"storageAccountId,omitempty"` 235 // JobType - The type of job 236 JobType *string `json:"jobType,omitempty"` 237 // ReturnAddress - Specifies the return address information for the job. 238 ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"` 239 // ReturnShipping - Specifies the return carrier and customer's account with the carrier. 240 ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"` 241 // ShippingInformation - Contains information about the Microsoft datacenter to which the drives should be shipped. 242 ShippingInformation *ShippingInformation `json:"shippingInformation,omitempty"` 243 // DeliveryPackage - Contains information about the package being shipped by the customer to the Microsoft data center. 244 DeliveryPackage *DeliveryPackageInformation `json:"deliveryPackage,omitempty"` 245 // ReturnPackage - Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet been returned. 246 ReturnPackage *PackageInformation `json:"returnPackage,omitempty"` 247 // DiagnosticsPath - The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. 248 DiagnosticsPath *string `json:"diagnosticsPath,omitempty"` 249 // LogLevel - Default value is Error. Indicates whether error logging or verbose logging will be enabled. 250 LogLevel *string `json:"logLevel,omitempty"` 251 // BackupDriveManifest - Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. 252 BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"` 253 // State - Current state of the job. 254 State *string `json:"state,omitempty"` 255 // CancelRequested - Indicates whether a request has been submitted to cancel the job. 256 CancelRequested *bool `json:"cancelRequested,omitempty"` 257 // PercentComplete - Overall percentage completed for the job. 258 PercentComplete *int32 `json:"percentComplete,omitempty"` 259 // IncompleteBlobListURI - A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response. 260 IncompleteBlobListURI *string `json:"incompleteBlobListUri,omitempty"` 261 // DriveList - List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs. 262 DriveList *[]DriveStatus `json:"driveList,omitempty"` 263 // Export - A property containing information about the blobs to be exported for an export job. This property is included for export jobs only. 264 Export *Export `json:"export,omitempty"` 265 // ProvisioningState - Specifies the provisioning state of the job. 266 ProvisioningState *string `json:"provisioningState,omitempty"` 267 // EncryptionKey - Contains information about the encryption key. 268 EncryptionKey *EncryptionKeyDetails `json:"encryptionKey,omitempty"` 269} 270 271// JobResponse contains the job information. 272type JobResponse struct { 273 autorest.Response `json:"-"` 274 // ID - READ-ONLY; Specifies the resource identifier of the job. 275 ID *string `json:"id,omitempty"` 276 // Name - READ-ONLY; Specifies the name of the job. 277 Name *string `json:"name,omitempty"` 278 // Type - READ-ONLY; Specifies the type of the job resource. 279 Type *string `json:"type,omitempty"` 280 // Location - Specifies the Azure location where the job is created. 281 Location *string `json:"location,omitempty"` 282 // Tags - Specifies the tags that are assigned to the job. 283 Tags interface{} `json:"tags,omitempty"` 284 // Properties - Specifies the job properties 285 Properties *JobDetails `json:"properties,omitempty"` 286 // Identity - Specifies the job identity details 287 Identity *IdentityDetails `json:"identity,omitempty"` 288} 289 290// MarshalJSON is the custom marshaler for JobResponse. 291func (jr JobResponse) MarshalJSON() ([]byte, error) { 292 objectMap := make(map[string]interface{}) 293 if jr.Location != nil { 294 objectMap["location"] = jr.Location 295 } 296 if jr.Tags != nil { 297 objectMap["tags"] = jr.Tags 298 } 299 if jr.Properties != nil { 300 objectMap["properties"] = jr.Properties 301 } 302 if jr.Identity != nil { 303 objectMap["identity"] = jr.Identity 304 } 305 return json.Marshal(objectMap) 306} 307 308// ListJobsResponse list jobs response 309type ListJobsResponse struct { 310 autorest.Response `json:"-"` 311 // NextLink - link to next batch of jobs 312 NextLink *string `json:"nextLink,omitempty"` 313 // Value - Job list 314 Value *[]JobResponse `json:"value,omitempty"` 315} 316 317// ListJobsResponseIterator provides access to a complete listing of JobResponse values. 318type ListJobsResponseIterator struct { 319 i int 320 page ListJobsResponsePage 321} 322 323// NextWithContext advances to the next value. If there was an error making 324// the request the iterator does not advance and the error is returned. 325func (iter *ListJobsResponseIterator) NextWithContext(ctx context.Context) (err error) { 326 if tracing.IsEnabled() { 327 ctx = tracing.StartSpan(ctx, fqdn+"/ListJobsResponseIterator.NextWithContext") 328 defer func() { 329 sc := -1 330 if iter.Response().Response.Response != nil { 331 sc = iter.Response().Response.Response.StatusCode 332 } 333 tracing.EndSpan(ctx, sc, err) 334 }() 335 } 336 iter.i++ 337 if iter.i < len(iter.page.Values()) { 338 return nil 339 } 340 err = iter.page.NextWithContext(ctx) 341 if err != nil { 342 iter.i-- 343 return err 344 } 345 iter.i = 0 346 return nil 347} 348 349// Next advances to the next value. If there was an error making 350// the request the iterator does not advance and the error is returned. 351// Deprecated: Use NextWithContext() instead. 352func (iter *ListJobsResponseIterator) Next() error { 353 return iter.NextWithContext(context.Background()) 354} 355 356// NotDone returns true if the enumeration should be started or is not yet complete. 357func (iter ListJobsResponseIterator) NotDone() bool { 358 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 359} 360 361// Response returns the raw server response from the last page request. 362func (iter ListJobsResponseIterator) Response() ListJobsResponse { 363 return iter.page.Response() 364} 365 366// Value returns the current value or a zero-initialized value if the 367// iterator has advanced beyond the end of the collection. 368func (iter ListJobsResponseIterator) Value() JobResponse { 369 if !iter.page.NotDone() { 370 return JobResponse{} 371 } 372 return iter.page.Values()[iter.i] 373} 374 375// Creates a new instance of the ListJobsResponseIterator type. 376func NewListJobsResponseIterator(page ListJobsResponsePage) ListJobsResponseIterator { 377 return ListJobsResponseIterator{page: page} 378} 379 380// IsEmpty returns true if the ListResult contains no values. 381func (ljr ListJobsResponse) IsEmpty() bool { 382 return ljr.Value == nil || len(*ljr.Value) == 0 383} 384 385// hasNextLink returns true if the NextLink is not empty. 386func (ljr ListJobsResponse) hasNextLink() bool { 387 return ljr.NextLink != nil && len(*ljr.NextLink) != 0 388} 389 390// listJobsResponsePreparer prepares a request to retrieve the next set of results. 391// It returns nil if no more results exist. 392func (ljr ListJobsResponse) listJobsResponsePreparer(ctx context.Context) (*http.Request, error) { 393 if !ljr.hasNextLink() { 394 return nil, nil 395 } 396 return autorest.Prepare((&http.Request{}).WithContext(ctx), 397 autorest.AsJSON(), 398 autorest.AsGet(), 399 autorest.WithBaseURL(to.String(ljr.NextLink))) 400} 401 402// ListJobsResponsePage contains a page of JobResponse values. 403type ListJobsResponsePage struct { 404 fn func(context.Context, ListJobsResponse) (ListJobsResponse, error) 405 ljr ListJobsResponse 406} 407 408// NextWithContext advances to the next page of values. If there was an error making 409// the request the page does not advance and the error is returned. 410func (page *ListJobsResponsePage) NextWithContext(ctx context.Context) (err error) { 411 if tracing.IsEnabled() { 412 ctx = tracing.StartSpan(ctx, fqdn+"/ListJobsResponsePage.NextWithContext") 413 defer func() { 414 sc := -1 415 if page.Response().Response.Response != nil { 416 sc = page.Response().Response.Response.StatusCode 417 } 418 tracing.EndSpan(ctx, sc, err) 419 }() 420 } 421 for { 422 next, err := page.fn(ctx, page.ljr) 423 if err != nil { 424 return err 425 } 426 page.ljr = next 427 if !next.hasNextLink() || !next.IsEmpty() { 428 break 429 } 430 } 431 return nil 432} 433 434// Next advances to the next page of values. If there was an error making 435// the request the page does not advance and the error is returned. 436// Deprecated: Use NextWithContext() instead. 437func (page *ListJobsResponsePage) Next() error { 438 return page.NextWithContext(context.Background()) 439} 440 441// NotDone returns true if the page enumeration should be started or is not yet complete. 442func (page ListJobsResponsePage) NotDone() bool { 443 return !page.ljr.IsEmpty() 444} 445 446// Response returns the raw server response from the last page request. 447func (page ListJobsResponsePage) Response() ListJobsResponse { 448 return page.ljr 449} 450 451// Values returns the slice of values for the current page or nil if there are no values. 452func (page ListJobsResponsePage) Values() []JobResponse { 453 if page.ljr.IsEmpty() { 454 return nil 455 } 456 return *page.ljr.Value 457} 458 459// Creates a new instance of the ListJobsResponsePage type. 460func NewListJobsResponsePage(cur ListJobsResponse, getNextPage func(context.Context, ListJobsResponse) (ListJobsResponse, error)) ListJobsResponsePage { 461 return ListJobsResponsePage{ 462 fn: getNextPage, 463 ljr: cur, 464 } 465} 466 467// ListOperationsResponse list operations response 468type ListOperationsResponse struct { 469 autorest.Response `json:"-"` 470 // Value - operations 471 Value *[]Operation `json:"value,omitempty"` 472} 473 474// Location provides information about an Azure data center location. 475type Location struct { 476 autorest.Response `json:"-"` 477 // ID - Specifies the resource identifier of the location. 478 ID *string `json:"id,omitempty"` 479 // Name - Specifies the name of the location. Use List Locations to get all supported locations. 480 Name *string `json:"name,omitempty"` 481 // Type - Specifies the type of the location. 482 Type *string `json:"type,omitempty"` 483 // LocationProperties - location properties 484 *LocationProperties `json:"properties,omitempty"` 485} 486 487// MarshalJSON is the custom marshaler for Location. 488func (l Location) MarshalJSON() ([]byte, error) { 489 objectMap := make(map[string]interface{}) 490 if l.ID != nil { 491 objectMap["id"] = l.ID 492 } 493 if l.Name != nil { 494 objectMap["name"] = l.Name 495 } 496 if l.Type != nil { 497 objectMap["type"] = l.Type 498 } 499 if l.LocationProperties != nil { 500 objectMap["properties"] = l.LocationProperties 501 } 502 return json.Marshal(objectMap) 503} 504 505// UnmarshalJSON is the custom unmarshaler for Location struct. 506func (l *Location) UnmarshalJSON(body []byte) error { 507 var m map[string]*json.RawMessage 508 err := json.Unmarshal(body, &m) 509 if err != nil { 510 return err 511 } 512 for k, v := range m { 513 switch k { 514 case "id": 515 if v != nil { 516 var ID string 517 err = json.Unmarshal(*v, &ID) 518 if err != nil { 519 return err 520 } 521 l.ID = &ID 522 } 523 case "name": 524 if v != nil { 525 var name string 526 err = json.Unmarshal(*v, &name) 527 if err != nil { 528 return err 529 } 530 l.Name = &name 531 } 532 case "type": 533 if v != nil { 534 var typeVar string 535 err = json.Unmarshal(*v, &typeVar) 536 if err != nil { 537 return err 538 } 539 l.Type = &typeVar 540 } 541 case "properties": 542 if v != nil { 543 var locationProperties LocationProperties 544 err = json.Unmarshal(*v, &locationProperties) 545 if err != nil { 546 return err 547 } 548 l.LocationProperties = &locationProperties 549 } 550 } 551 } 552 553 return nil 554} 555 556// LocationProperties location properties 557type LocationProperties struct { 558 // RecipientName - The recipient name to use when shipping the drives to the Azure data center. 559 RecipientName *string `json:"recipientName,omitempty"` 560 // StreetAddress1 - The first line of the street address to use when shipping the drives to the Azure data center. 561 StreetAddress1 *string `json:"streetAddress1,omitempty"` 562 // StreetAddress2 - The second line of the street address to use when shipping the drives to the Azure data center. 563 StreetAddress2 *string `json:"streetAddress2,omitempty"` 564 // City - The city name to use when shipping the drives to the Azure data center. 565 City *string `json:"city,omitempty"` 566 // StateOrProvince - The state or province to use when shipping the drives to the Azure data center. 567 StateOrProvince *string `json:"stateOrProvince,omitempty"` 568 // PostalCode - The postal code to use when shipping the drives to the Azure data center. 569 PostalCode *string `json:"postalCode,omitempty"` 570 // CountryOrRegion - The country or region to use when shipping the drives to the Azure data center. 571 CountryOrRegion *string `json:"countryOrRegion,omitempty"` 572 // Phone - The phone number for the Azure data center. 573 Phone *string `json:"phone,omitempty"` 574 // SupportedCarriers - A list of carriers that are supported at this location. 575 SupportedCarriers *[]string `json:"supportedCarriers,omitempty"` 576 // AlternateLocations - A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list may contain other locations. 577 AlternateLocations *[]string `json:"alternateLocations,omitempty"` 578} 579 580// LocationsResponse locations response 581type LocationsResponse struct { 582 autorest.Response `json:"-"` 583 // Value - locations 584 Value *[]Location `json:"value,omitempty"` 585} 586 587// Operation describes a supported operation by the Storage Import/Export job API. 588type Operation struct { 589 // Name - Name of the operation. 590 Name *string `json:"name,omitempty"` 591 // OperationDisplay - operation display properties 592 *OperationDisplay `json:"display,omitempty"` 593} 594 595// MarshalJSON is the custom marshaler for Operation. 596func (o Operation) MarshalJSON() ([]byte, error) { 597 objectMap := make(map[string]interface{}) 598 if o.Name != nil { 599 objectMap["name"] = o.Name 600 } 601 if o.OperationDisplay != nil { 602 objectMap["display"] = o.OperationDisplay 603 } 604 return json.Marshal(objectMap) 605} 606 607// UnmarshalJSON is the custom unmarshaler for Operation struct. 608func (o *Operation) UnmarshalJSON(body []byte) error { 609 var m map[string]*json.RawMessage 610 err := json.Unmarshal(body, &m) 611 if err != nil { 612 return err 613 } 614 for k, v := range m { 615 switch k { 616 case "name": 617 if v != nil { 618 var name string 619 err = json.Unmarshal(*v, &name) 620 if err != nil { 621 return err 622 } 623 o.Name = &name 624 } 625 case "display": 626 if v != nil { 627 var operationDisplay OperationDisplay 628 err = json.Unmarshal(*v, &operationDisplay) 629 if err != nil { 630 return err 631 } 632 o.OperationDisplay = &operationDisplay 633 } 634 } 635 } 636 637 return nil 638} 639 640// OperationDisplay operation display properties 641type OperationDisplay struct { 642 // Provider - The resource provider name to which the operation belongs. 643 Provider *string `json:"provider,omitempty"` 644 // Resource - The name of the resource to which the operation belongs. 645 Resource *string `json:"resource,omitempty"` 646 // Operation - The display name of the operation. 647 Operation *string `json:"operation,omitempty"` 648 // Description - Short description of the operation. 649 Description *string `json:"description,omitempty"` 650} 651 652// PackageInformation contains information about the package being shipped by the customer to the Microsoft 653// data center. 654type PackageInformation struct { 655 // CarrierName - The name of the carrier that is used to ship the import or export drives. 656 CarrierName *string `json:"carrierName,omitempty"` 657 // TrackingNumber - The tracking number of the package. 658 TrackingNumber *string `json:"trackingNumber,omitempty"` 659 // DriveCount - The number of drives included in the package. 660 DriveCount *int64 `json:"driveCount,omitempty"` 661 // ShipDate - The date when the package is shipped. 662 ShipDate *string `json:"shipDate,omitempty"` 663} 664 665// PutJobParameters put Job parameters 666type PutJobParameters struct { 667 // Location - Specifies the supported Azure location where the job should be created 668 Location *string `json:"location,omitempty"` 669 // Tags - Specifies the tags that will be assigned to the job. 670 Tags interface{} `json:"tags,omitempty"` 671 // Properties - Specifies the job properties 672 Properties *JobDetails `json:"properties,omitempty"` 673} 674 675// ReturnAddress specifies the return address information for the job. 676type ReturnAddress struct { 677 // RecipientName - The name of the recipient who will receive the hard drives when they are returned. 678 RecipientName *string `json:"recipientName,omitempty"` 679 // StreetAddress1 - The first line of the street address to use when returning the drives. 680 StreetAddress1 *string `json:"streetAddress1,omitempty"` 681 // StreetAddress2 - The second line of the street address to use when returning the drives. 682 StreetAddress2 *string `json:"streetAddress2,omitempty"` 683 // City - The city name to use when returning the drives. 684 City *string `json:"city,omitempty"` 685 // StateOrProvince - The state or province to use when returning the drives. 686 StateOrProvince *string `json:"stateOrProvince,omitempty"` 687 // PostalCode - The postal code to use when returning the drives. 688 PostalCode *string `json:"postalCode,omitempty"` 689 // CountryOrRegion - The country or region to use when returning the drives. 690 CountryOrRegion *string `json:"countryOrRegion,omitempty"` 691 // Phone - Phone number of the recipient of the returned drives. 692 Phone *string `json:"phone,omitempty"` 693 // Email - Email address of the recipient of the returned drives. 694 Email *string `json:"email,omitempty"` 695} 696 697// ReturnShipping specifies the return carrier and customer's account with the carrier. 698type ReturnShipping struct { 699 // CarrierName - The carrier's name. 700 CarrierName *string `json:"carrierName,omitempty"` 701 // CarrierAccountNumber - The customer's account number with the carrier. 702 CarrierAccountNumber *string `json:"carrierAccountNumber,omitempty"` 703} 704 705// ShippingInformation contains information about the Microsoft datacenter to which the drives should be 706// shipped. 707type ShippingInformation struct { 708 // RecipientName - The name of the recipient who will receive the hard drives when they are returned. 709 RecipientName *string `json:"recipientName,omitempty"` 710 // StreetAddress1 - The first line of the street address to use when returning the drives. 711 StreetAddress1 *string `json:"streetAddress1,omitempty"` 712 // StreetAddress2 - The second line of the street address to use when returning the drives. 713 StreetAddress2 *string `json:"streetAddress2,omitempty"` 714 // City - The city name to use when returning the drives. 715 City *string `json:"city,omitempty"` 716 // StateOrProvince - The state or province to use when returning the drives. 717 StateOrProvince *string `json:"stateOrProvince,omitempty"` 718 // PostalCode - The postal code to use when returning the drives. 719 PostalCode *string `json:"postalCode,omitempty"` 720 // CountryOrRegion - The country or region to use when returning the drives. 721 CountryOrRegion *string `json:"countryOrRegion,omitempty"` 722 // Phone - Phone number of the recipient of the returned drives. 723 Phone *string `json:"phone,omitempty"` 724 // AdditionalInformation - READ-ONLY; Additional shipping information for customer, specific to datacenter to which customer should send their disks. 725 AdditionalInformation *string `json:"additionalInformation,omitempty"` 726} 727 728// MarshalJSON is the custom marshaler for ShippingInformation. 729func (si ShippingInformation) MarshalJSON() ([]byte, error) { 730 objectMap := make(map[string]interface{}) 731 if si.RecipientName != nil { 732 objectMap["recipientName"] = si.RecipientName 733 } 734 if si.StreetAddress1 != nil { 735 objectMap["streetAddress1"] = si.StreetAddress1 736 } 737 if si.StreetAddress2 != nil { 738 objectMap["streetAddress2"] = si.StreetAddress2 739 } 740 if si.City != nil { 741 objectMap["city"] = si.City 742 } 743 if si.StateOrProvince != nil { 744 objectMap["stateOrProvince"] = si.StateOrProvince 745 } 746 if si.PostalCode != nil { 747 objectMap["postalCode"] = si.PostalCode 748 } 749 if si.CountryOrRegion != nil { 750 objectMap["countryOrRegion"] = si.CountryOrRegion 751 } 752 if si.Phone != nil { 753 objectMap["phone"] = si.Phone 754 } 755 return json.Marshal(objectMap) 756} 757 758// UpdateJobParameters update Job parameters 759type UpdateJobParameters struct { 760 // Tags - Specifies the tags that will be assigned to the job 761 Tags interface{} `json:"tags,omitempty"` 762 // UpdateJobParametersProperties - Specifies the properties of a UpdateJob. 763 *UpdateJobParametersProperties `json:"properties,omitempty"` 764} 765 766// MarshalJSON is the custom marshaler for UpdateJobParameters. 767func (ujp UpdateJobParameters) MarshalJSON() ([]byte, error) { 768 objectMap := make(map[string]interface{}) 769 if ujp.Tags != nil { 770 objectMap["tags"] = ujp.Tags 771 } 772 if ujp.UpdateJobParametersProperties != nil { 773 objectMap["properties"] = ujp.UpdateJobParametersProperties 774 } 775 return json.Marshal(objectMap) 776} 777 778// UnmarshalJSON is the custom unmarshaler for UpdateJobParameters struct. 779func (ujp *UpdateJobParameters) UnmarshalJSON(body []byte) error { 780 var m map[string]*json.RawMessage 781 err := json.Unmarshal(body, &m) 782 if err != nil { 783 return err 784 } 785 for k, v := range m { 786 switch k { 787 case "tags": 788 if v != nil { 789 var tags interface{} 790 err = json.Unmarshal(*v, &tags) 791 if err != nil { 792 return err 793 } 794 ujp.Tags = tags 795 } 796 case "properties": 797 if v != nil { 798 var updateJobParametersProperties UpdateJobParametersProperties 799 err = json.Unmarshal(*v, &updateJobParametersProperties) 800 if err != nil { 801 return err 802 } 803 ujp.UpdateJobParametersProperties = &updateJobParametersProperties 804 } 805 } 806 } 807 808 return nil 809} 810 811// UpdateJobParametersProperties specifies the properties of a UpdateJob. 812type UpdateJobParametersProperties struct { 813 // CancelRequested - If specified, the value must be true. The service will attempt to cancel the job. 814 CancelRequested *bool `json:"cancelRequested,omitempty"` 815 // State - If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. 816 State *string `json:"state,omitempty"` 817 // ReturnAddress - Specifies the return address information for the job. 818 ReturnAddress *ReturnAddress `json:"returnAddress,omitempty"` 819 // ReturnShipping - Specifies the return carrier and customer's account with the carrier. 820 ReturnShipping *ReturnShipping `json:"returnShipping,omitempty"` 821 // DeliveryPackage - Contains information about the package being shipped by the customer to the Microsoft data center. 822 DeliveryPackage *DeliveryPackageInformation `json:"deliveryPackage,omitempty"` 823 // LogLevel - Indicates whether error logging or verbose logging is enabled. 824 LogLevel *string `json:"logLevel,omitempty"` 825 // BackupDriveManifest - Indicates whether the manifest files on the drives should be copied to block blobs. 826 BackupDriveManifest *bool `json:"backupDriveManifest,omitempty"` 827 // DriveList - List of drives that comprise the job. 828 DriveList *[]DriveStatus `json:"driveList,omitempty"` 829} 830