From d8119b619acf168366650ca27cea8a7867ef67e4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 20 Nov 2018 17:48:36 -0800 Subject: [PATCH] Generated from d826472e6671211be5edc357a139a3f9f1857ac6 (#3364) Merge branch 'master' of https://github.com/AzureDataBox/azure-rest-api-specs --- .../preview/databox/mgmt/databox/models.go | 26 +- .../databox/mgmt/2018-01-01/databox/models.go | 274 ++++++++++++++++-- 2 files changed, 275 insertions(+), 25 deletions(-) diff --git a/profiles/preview/databox/mgmt/databox/models.go b/profiles/preview/databox/mgmt/databox/models.go index ed74fb087a98..dd93ba9cf508 100644 --- a/profiles/preview/databox/mgmt/databox/models.go +++ b/profiles/preview/databox/mgmt/databox/models.go @@ -74,6 +74,14 @@ const ( NotStarted CopyStatus = original.NotStarted ) +type DataDestinationType = original.DataDestinationType + +const ( + DataDestinationTypeDestinationAccountDetails DataDestinationType = original.DataDestinationTypeDestinationAccountDetails + DataDestinationTypeManagedDisk DataDestinationType = original.DataDestinationTypeManagedDisk + DataDestinationTypeStorageAccount DataDestinationType = original.DataDestinationTypeStorageAccount +) + type JobDetailsTypeEnum = original.JobDetailsTypeEnum const ( @@ -109,6 +117,7 @@ const ( AzureFile ShareDestinationFormatType = original.AzureFile BlockBlob ShareDestinationFormatType = original.BlockBlob HCS ShareDestinationFormatType = original.HCS + ManagedDisk ShareDestinationFormatType = original.ManagedDisk PageBlob ShareDestinationFormatType = original.PageBlob UnknownType ShareDestinationFormatType = original.UnknownType ) @@ -116,11 +125,12 @@ const ( type SkuDisabledReason = original.SkuDisabledReason const ( - SkuDisabledReasonCountry SkuDisabledReason = original.SkuDisabledReasonCountry - SkuDisabledReasonFeature SkuDisabledReason = original.SkuDisabledReasonFeature - SkuDisabledReasonNone SkuDisabledReason = original.SkuDisabledReasonNone - SkuDisabledReasonOfferType SkuDisabledReason = original.SkuDisabledReasonOfferType - SkuDisabledReasonRegion SkuDisabledReason = original.SkuDisabledReasonRegion + SkuDisabledReasonCountry SkuDisabledReason = original.SkuDisabledReasonCountry + SkuDisabledReasonFeature SkuDisabledReason = original.SkuDisabledReasonFeature + SkuDisabledReasonNone SkuDisabledReason = original.SkuDisabledReasonNone + SkuDisabledReasonNoSubscriptionInfo SkuDisabledReason = original.SkuDisabledReasonNoSubscriptionInfo + SkuDisabledReasonOfferType SkuDisabledReason = original.SkuDisabledReasonOfferType + SkuDisabledReasonRegion SkuDisabledReason = original.SkuDisabledReasonRegion ) type SkuName = original.SkuName @@ -176,7 +186,10 @@ type ContactDetails = original.ContactDetails type BasicCopyLogDetails = original.BasicCopyLogDetails type CopyLogDetails = original.CopyLogDetails type CopyProgress = original.CopyProgress +type BasicDestinationAccountDetails = original.BasicDestinationAccountDetails type DestinationAccountDetails = original.DestinationAccountDetails +type DestinationManagedDiskDetails = original.DestinationManagedDiskDetails +type DestinationStorageAccountDetails = original.DestinationStorageAccountDetails type DestinationToServiceLocationMap = original.DestinationToServiceLocationMap type DiskCopyLogDetails = original.DiskCopyLogDetails type DiskCopyProgress = original.DiskCopyProgress @@ -259,6 +272,9 @@ func PossibleCopyLogDetailsTypeValues() []CopyLogDetailsType { func PossibleCopyStatusValues() []CopyStatus { return original.PossibleCopyStatusValues() } +func PossibleDataDestinationTypeValues() []DataDestinationType { + return original.PossibleDataDestinationTypeValues() +} func PossibleJobDetailsTypeEnumValues() []JobDetailsTypeEnum { return original.PossibleJobDetailsTypeEnumValues() } diff --git a/services/databox/mgmt/2018-01-01/databox/models.go b/services/databox/mgmt/2018-01-01/databox/models.go index 63058eac2916..3361b94441bd 100644 --- a/services/databox/mgmt/2018-01-01/databox/models.go +++ b/services/databox/mgmt/2018-01-01/databox/models.go @@ -122,6 +122,23 @@ func PossibleCopyStatusValues() []CopyStatus { return []CopyStatus{Completed, CompletedWithErrors, Failed, InProgress, NotReturned, NotStarted} } +// DataDestinationType enumerates the values for data destination type. +type DataDestinationType string + +const ( + // DataDestinationTypeDestinationAccountDetails ... + DataDestinationTypeDestinationAccountDetails DataDestinationType = "DestinationAccountDetails" + // DataDestinationTypeManagedDisk ... + DataDestinationTypeManagedDisk DataDestinationType = "ManagedDisk" + // DataDestinationTypeStorageAccount ... + DataDestinationTypeStorageAccount DataDestinationType = "StorageAccount" +) + +// PossibleDataDestinationTypeValues returns an array of possible values for the DataDestinationType const type. +func PossibleDataDestinationTypeValues() []DataDestinationType { + return []DataDestinationType{DataDestinationTypeDestinationAccountDetails, DataDestinationTypeManagedDisk, DataDestinationTypeStorageAccount} +} + // JobDetailsTypeEnum enumerates the values for job details type enum. type JobDetailsTypeEnum string @@ -193,6 +210,8 @@ const ( BlockBlob ShareDestinationFormatType = "BlockBlob" // HCS Storsimple data format. HCS ShareDestinationFormatType = "HCS" + // ManagedDisk Azure Compute Disk. + ManagedDisk ShareDestinationFormatType = "ManagedDisk" // PageBlob Azure storage page blob format. PageBlob ShareDestinationFormatType = "PageBlob" // UnknownType Unknown format. @@ -201,7 +220,7 @@ const ( // PossibleShareDestinationFormatTypeValues returns an array of possible values for the ShareDestinationFormatType const type. func PossibleShareDestinationFormatTypeValues() []ShareDestinationFormatType { - return []ShareDestinationFormatType{AzureFile, BlockBlob, HCS, PageBlob, UnknownType} + return []ShareDestinationFormatType{AzureFile, BlockBlob, HCS, ManagedDisk, PageBlob, UnknownType} } // SkuDisabledReason enumerates the values for sku disabled reason. @@ -214,15 +233,18 @@ const ( SkuDisabledReasonFeature SkuDisabledReason = "Feature" // SkuDisabledReasonNone SKU is not disabled. SkuDisabledReasonNone SkuDisabledReason = "None" + // SkuDisabledReasonNoSubscriptionInfo Subscription has not registered to Microsoft.DataBox and Service + // does not have the subscription notification. + SkuDisabledReasonNoSubscriptionInfo SkuDisabledReason = "NoSubscriptionInfo" // SkuDisabledReasonOfferType Subscription does not have required offer types for the SKU. SkuDisabledReasonOfferType SkuDisabledReason = "OfferType" - // SkuDisabledReasonRegion SKU is not available to push data to the requested storage account region. + // SkuDisabledReasonRegion SKU is not available to push data to the requested Azure region. SkuDisabledReasonRegion SkuDisabledReason = "Region" ) // PossibleSkuDisabledReasonValues returns an array of possible values for the SkuDisabledReason const type. func PossibleSkuDisabledReasonValues() []SkuDisabledReason { - return []SkuDisabledReason{SkuDisabledReasonCountry, SkuDisabledReasonFeature, SkuDisabledReasonNone, SkuDisabledReasonOfferType, SkuDisabledReasonRegion} + return []SkuDisabledReason{SkuDisabledReasonCountry, SkuDisabledReasonFeature, SkuDisabledReasonNone, SkuDisabledReasonNoSubscriptionInfo, SkuDisabledReasonOfferType, SkuDisabledReasonRegion} } // SkuName enumerates the values for sku name. @@ -715,12 +737,196 @@ type CopyProgress struct { BytesSentToCloud *int64 `json:"bytesSentToCloud,omitempty"` // TotalBytesToProcess - Total amount of data to be processed by the job. TotalBytesToProcess *int64 `json:"totalBytesToProcess,omitempty"` + // FilesProcessed - Number of files processed by the job as of now. + FilesProcessed *int64 `json:"filesProcessed,omitempty"` + // TotalFilesToProcess - Total number of files to be processed by the job. + TotalFilesToProcess *int64 `json:"totalFilesToProcess,omitempty"` +} + +// BasicDestinationAccountDetails details of the destination of the data +type BasicDestinationAccountDetails interface { + AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) + AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) + AsDestinationAccountDetails() (*DestinationAccountDetails, bool) } -// DestinationAccountDetails details for the destination account. +// DestinationAccountDetails details of the destination of the data type DestinationAccountDetails struct { - // AccountID - Destination storage account id. + // AccountID - Arm Id of the destination where the data has to be moved. AccountID *string `json:"accountId,omitempty"` + // DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount' + DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"` +} + +func unmarshalBasicDestinationAccountDetails(body []byte) (BasicDestinationAccountDetails, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["dataDestinationType"] { + case string(DataDestinationTypeManagedDisk): + var dmdd DestinationManagedDiskDetails + err := json.Unmarshal(body, &dmdd) + return dmdd, err + case string(DataDestinationTypeStorageAccount): + var dsad DestinationStorageAccountDetails + err := json.Unmarshal(body, &dsad) + return dsad, err + default: + var dad DestinationAccountDetails + err := json.Unmarshal(body, &dad) + return dad, err + } +} +func unmarshalBasicDestinationAccountDetailsArray(body []byte) ([]BasicDestinationAccountDetails, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dadArray := make([]BasicDestinationAccountDetails, len(rawMessages)) + + for index, rawMessage := range rawMessages { + dad, err := unmarshalBasicDestinationAccountDetails(*rawMessage) + if err != nil { + return nil, err + } + dadArray[index] = dad + } + return dadArray, nil +} + +// MarshalJSON is the custom marshaler for DestinationAccountDetails. +func (dad DestinationAccountDetails) MarshalJSON() ([]byte, error) { + dad.DataDestinationType = DataDestinationTypeDestinationAccountDetails + objectMap := make(map[string]interface{}) + if dad.AccountID != nil { + objectMap["accountId"] = dad.AccountID + } + if dad.DataDestinationType != "" { + objectMap["dataDestinationType"] = dad.DataDestinationType + } + return json.Marshal(objectMap) +} + +// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. +func (dad DestinationAccountDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) { + return nil, false +} + +// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. +func (dad DestinationAccountDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) { + return nil, false +} + +// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. +func (dad DestinationAccountDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) { + return &dad, true +} + +// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationAccountDetails. +func (dad DestinationAccountDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) { + return &dad, true +} + +// DestinationManagedDiskDetails details for the destination compute disks. +type DestinationManagedDiskDetails struct { + // ResourceGroupID - Destination Resource Group Id where the Compute disks should be created. + ResourceGroupID *string `json:"resourceGroupId,omitempty"` + // StagingStorageAccountID - Arm Id of the storage account that can be used to copy the vhd for staging. + StagingStorageAccountID *string `json:"stagingStorageAccountId,omitempty"` + // AccountID - Arm Id of the destination where the data has to be moved. + AccountID *string `json:"accountId,omitempty"` + // DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount' + DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DestinationManagedDiskDetails. +func (dmdd DestinationManagedDiskDetails) MarshalJSON() ([]byte, error) { + dmdd.DataDestinationType = DataDestinationTypeManagedDisk + objectMap := make(map[string]interface{}) + if dmdd.ResourceGroupID != nil { + objectMap["resourceGroupId"] = dmdd.ResourceGroupID + } + if dmdd.StagingStorageAccountID != nil { + objectMap["stagingStorageAccountId"] = dmdd.StagingStorageAccountID + } + if dmdd.AccountID != nil { + objectMap["accountId"] = dmdd.AccountID + } + if dmdd.DataDestinationType != "" { + objectMap["dataDestinationType"] = dmdd.DataDestinationType + } + return json.Marshal(objectMap) +} + +// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. +func (dmdd DestinationManagedDiskDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) { + return &dmdd, true +} + +// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. +func (dmdd DestinationManagedDiskDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) { + return nil, false +} + +// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. +func (dmdd DestinationManagedDiskDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) { + return nil, false +} + +// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationManagedDiskDetails. +func (dmdd DestinationManagedDiskDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) { + return &dmdd, true +} + +// DestinationStorageAccountDetails details for the destination storage account. +type DestinationStorageAccountDetails struct { + // StorageAccountID - Destination Storage Account Arm Id. + StorageAccountID *string `json:"storageAccountId,omitempty"` + // AccountID - Arm Id of the destination where the data has to be moved. + AccountID *string `json:"accountId,omitempty"` + // DataDestinationType - Possible values include: 'DataDestinationTypeDestinationAccountDetails', 'DataDestinationTypeManagedDisk', 'DataDestinationTypeStorageAccount' + DataDestinationType DataDestinationType `json:"dataDestinationType,omitempty"` +} + +// MarshalJSON is the custom marshaler for DestinationStorageAccountDetails. +func (dsad DestinationStorageAccountDetails) MarshalJSON() ([]byte, error) { + dsad.DataDestinationType = DataDestinationTypeStorageAccount + objectMap := make(map[string]interface{}) + if dsad.StorageAccountID != nil { + objectMap["storageAccountId"] = dsad.StorageAccountID + } + if dsad.AccountID != nil { + objectMap["accountId"] = dsad.AccountID + } + if dsad.DataDestinationType != "" { + objectMap["dataDestinationType"] = dsad.DataDestinationType + } + return json.Marshal(objectMap) +} + +// AsDestinationManagedDiskDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. +func (dsad DestinationStorageAccountDetails) AsDestinationManagedDiskDetails() (*DestinationManagedDiskDetails, bool) { + return nil, false +} + +// AsDestinationStorageAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. +func (dsad DestinationStorageAccountDetails) AsDestinationStorageAccountDetails() (*DestinationStorageAccountDetails, bool) { + return &dsad, true +} + +// AsDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. +func (dsad DestinationStorageAccountDetails) AsDestinationAccountDetails() (*DestinationAccountDetails, bool) { + return nil, false +} + +// AsBasicDestinationAccountDetails is the BasicDestinationAccountDetails implementation for DestinationStorageAccountDetails. +func (dsad DestinationStorageAccountDetails) AsBasicDestinationAccountDetails() (BasicDestinationAccountDetails, bool) { + return &dsad, true } // DestinationToServiceLocationMap map of destination location to service location @@ -822,7 +1028,7 @@ type DiskJobDetails struct { // ReturnPackage - Return package shipping details. ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` // DestinationAccountDetails - Destination account details. - DestinationAccountDetails *[]DestinationAccountDetails `json:"destinationAccountDetails,omitempty"` + DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` // ErrorDetails - Error details for failure. This is optional. ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` // Preferences - Preferences for the order. @@ -1021,8 +1227,7 @@ func (djd *DiskJobDetails) UnmarshalJSON(body []byte) error { } case "destinationAccountDetails": if v != nil { - var destinationAccountDetails []DestinationAccountDetails - err = json.Unmarshal(*v, &destinationAccountDetails) + destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) if err != nil { return err } @@ -1227,7 +1432,7 @@ type HeavyJobDetails struct { // ReturnPackage - Return package shipping details. ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` // DestinationAccountDetails - Destination account details. - DestinationAccountDetails *[]DestinationAccountDetails `json:"destinationAccountDetails,omitempty"` + DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` // ErrorDetails - Error details for failure. This is optional. ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` // Preferences - Preferences for the order. @@ -1390,8 +1595,7 @@ func (hjd *HeavyJobDetails) UnmarshalJSON(body []byte) error { } case "destinationAccountDetails": if v != nil { - var destinationAccountDetails []DestinationAccountDetails - err = json.Unmarshal(*v, &destinationAccountDetails) + destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) if err != nil { return err } @@ -1539,7 +1743,7 @@ type JobDetails struct { // ReturnPackage - Return package shipping details. ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` // DestinationAccountDetails - Destination account details. - DestinationAccountDetails *[]DestinationAccountDetails `json:"destinationAccountDetails,omitempty"` + DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` // ErrorDetails - Error details for failure. This is optional. ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` // Preferences - Preferences for the order. @@ -1735,8 +1939,7 @@ func (jd *JobDetails) UnmarshalJSON(body []byte) error { } case "destinationAccountDetails": if v != nil { - var destinationAccountDetails []DestinationAccountDetails - err = json.Unmarshal(*v, &destinationAccountDetails) + destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) if err != nil { return err } @@ -1818,7 +2021,7 @@ type JobDetailsType struct { // ReturnPackage - Return package shipping details. ReturnPackage *PackageShippingDetails `json:"returnPackage,omitempty"` // DestinationAccountDetails - Destination account details. - DestinationAccountDetails *[]DestinationAccountDetails `json:"destinationAccountDetails,omitempty"` + DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` // ErrorDetails - Error details for failure. This is optional. ErrorDetails *[]JobErrorDetails `json:"errorDetails,omitempty"` // Preferences - Preferences for the order. @@ -1981,8 +2184,7 @@ func (jdt *JobDetailsType) UnmarshalJSON(body []byte) error { } case "destinationAccountDetails": if v != nil { - var destinationAccountDetails []DestinationAccountDetails - err = json.Unmarshal(*v, &destinationAccountDetails) + destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) if err != nil { return err } @@ -2958,7 +3160,7 @@ type Secret struct { type ShareCredentialDetails struct { // ShareName - Name of the share. ShareName *string `json:"shareName,omitempty"` - // ShareType - Type of the share. Possible values include: 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', 'AzureFile' + // ShareType - Type of the share. Possible values include: 'UnknownType', 'HCS', 'BlockBlob', 'PageBlob', 'AzureFile', 'ManagedDisk' ShareType ShareDestinationFormatType `json:"shareType,omitempty"` // UserName - User name for the share. UserName *string `json:"userName,omitempty"` @@ -3114,7 +3316,7 @@ type SkuProperties struct { Costs *[]SkuCost `json:"costs,omitempty"` // APIVersions - Api versions that support this Sku. APIVersions *[]string `json:"apiVersions,omitempty"` - // DisabledReason - Reason why the Sku is disabled. Possible values include: 'SkuDisabledReasonNone', 'SkuDisabledReasonCountry', 'SkuDisabledReasonRegion', 'SkuDisabledReasonFeature', 'SkuDisabledReasonOfferType' + // DisabledReason - Reason why the Sku is disabled. Possible values include: 'SkuDisabledReasonNone', 'SkuDisabledReasonCountry', 'SkuDisabledReasonRegion', 'SkuDisabledReasonFeature', 'SkuDisabledReasonOfferType', 'SkuDisabledReasonNoSubscriptionInfo' DisabledReason SkuDisabledReason `json:"disabledReason,omitempty"` // DisabledReasonMessage - Message for why the Sku is disabled. DisabledReasonMessage *string `json:"disabledReasonMessage,omitempty"` @@ -3184,7 +3386,39 @@ type UpdateJobProperties struct { // Details - Details of a job to be updated. Details *UpdateJobDetails `json:"details,omitempty"` // DestinationAccountDetails - Destination account details. - DestinationAccountDetails *[]DestinationAccountDetails `json:"destinationAccountDetails,omitempty"` + DestinationAccountDetails *[]BasicDestinationAccountDetails `json:"destinationAccountDetails,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for UpdateJobProperties struct. +func (ujp *UpdateJobProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "details": + if v != nil { + var details UpdateJobDetails + err = json.Unmarshal(*v, &details) + if err != nil { + return err + } + ujp.Details = &details + } + case "destinationAccountDetails": + if v != nil { + destinationAccountDetails, err := unmarshalBasicDestinationAccountDetailsArray(*v) + if err != nil { + return err + } + ujp.DestinationAccountDetails = &destinationAccountDetails + } + } + } + + return nil } // ValidateAddress the requirements to validate customer address where the device needs to be shipped.