From 5f2e742ecafad1e5cc28394e70b3b3accc5a4b14 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 29 Mar 2018 16:00:16 -0700 Subject: [PATCH] Generated from 1e4fb9a5273de19ddead4aa2089e5c7f2481abfe (#1473) (#1474) Add tag for Go SDK build --- .../datamigration/client.go | 51 + .../datamigration/models.go | 5565 +++++++++++++++++ .../datamigration/operations.go | 126 + .../datamigration/projects.go | 416 ++ .../datamigration/resourceskus.go | 130 + .../datamigration/services.go | 957 +++ .../2018-03-31-preview/datamigration/tasks.go | 501 ++ .../datamigration/usages.go | 133 + .../datamigration/version.go | 30 + 9 files changed, 7909 insertions(+) create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/client.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/models.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/operations.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/projects.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/resourceskus.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/services.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/tasks.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/usages.go create mode 100644 services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/version.go diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/client.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/client.go new file mode 100644 index 000000000000..e82d442622fc --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/client.go @@ -0,0 +1,51 @@ +// Package datamigration implements the Azure ARM Datamigration service API version 2018-03-31-preview. +// +// Data Migration Client +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Datamigration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Datamigration. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/models.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/models.go new file mode 100644 index 000000000000..f3c0ee276abd --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/models.go @@ -0,0 +1,5565 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "net/http" +) + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // ActiveDirectoryIntegrated ... + ActiveDirectoryIntegrated AuthenticationType = "ActiveDirectoryIntegrated" + // ActiveDirectoryPassword ... + ActiveDirectoryPassword AuthenticationType = "ActiveDirectoryPassword" + // None ... + None AuthenticationType = "None" + // SQLAuthentication ... + SQLAuthentication AuthenticationType = "SqlAuthentication" + // WindowsAuthentication ... + WindowsAuthentication AuthenticationType = "WindowsAuthentication" +) + +// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{ActiveDirectoryIntegrated, ActiveDirectoryPassword, None, SQLAuthentication, WindowsAuthentication} +} + +// DatabaseCompatLevel enumerates the values for database compat level. +type DatabaseCompatLevel string + +const ( + // CompatLevel100 ... + CompatLevel100 DatabaseCompatLevel = "CompatLevel100" + // CompatLevel110 ... + CompatLevel110 DatabaseCompatLevel = "CompatLevel110" + // CompatLevel120 ... + CompatLevel120 DatabaseCompatLevel = "CompatLevel120" + // CompatLevel130 ... + CompatLevel130 DatabaseCompatLevel = "CompatLevel130" + // CompatLevel140 ... + CompatLevel140 DatabaseCompatLevel = "CompatLevel140" + // CompatLevel80 ... + CompatLevel80 DatabaseCompatLevel = "CompatLevel80" + // CompatLevel90 ... + CompatLevel90 DatabaseCompatLevel = "CompatLevel90" +) + +// PossibleDatabaseCompatLevelValues returns an array of possible values for the DatabaseCompatLevel const type. +func PossibleDatabaseCompatLevelValues() []DatabaseCompatLevel { + return []DatabaseCompatLevel{CompatLevel100, CompatLevel110, CompatLevel120, CompatLevel130, CompatLevel140, CompatLevel80, CompatLevel90} +} + +// DatabaseFileType enumerates the values for database file type. +type DatabaseFileType string + +const ( + // Filestream ... + Filestream DatabaseFileType = "Filestream" + // Fulltext ... + Fulltext DatabaseFileType = "Fulltext" + // Log ... + Log DatabaseFileType = "Log" + // NotSupported ... + NotSupported DatabaseFileType = "NotSupported" + // Rows ... + Rows DatabaseFileType = "Rows" +) + +// PossibleDatabaseFileTypeValues returns an array of possible values for the DatabaseFileType const type. +func PossibleDatabaseFileTypeValues() []DatabaseFileType { + return []DatabaseFileType{Filestream, Fulltext, Log, NotSupported, Rows} +} + +// DatabaseMigrationStage enumerates the values for database migration stage. +type DatabaseMigrationStage string + +const ( + // DatabaseMigrationStageBackup ... + DatabaseMigrationStageBackup DatabaseMigrationStage = "Backup" + // DatabaseMigrationStageCompleted ... + DatabaseMigrationStageCompleted DatabaseMigrationStage = "Completed" + // DatabaseMigrationStageFileCopy ... + DatabaseMigrationStageFileCopy DatabaseMigrationStage = "FileCopy" + // DatabaseMigrationStageInitialize ... + DatabaseMigrationStageInitialize DatabaseMigrationStage = "Initialize" + // DatabaseMigrationStageNone ... + DatabaseMigrationStageNone DatabaseMigrationStage = "None" + // DatabaseMigrationStageRestore ... + DatabaseMigrationStageRestore DatabaseMigrationStage = "Restore" +) + +// PossibleDatabaseMigrationStageValues returns an array of possible values for the DatabaseMigrationStage const type. +func PossibleDatabaseMigrationStageValues() []DatabaseMigrationStage { + return []DatabaseMigrationStage{DatabaseMigrationStageBackup, DatabaseMigrationStageCompleted, DatabaseMigrationStageFileCopy, DatabaseMigrationStageInitialize, DatabaseMigrationStageNone, DatabaseMigrationStageRestore} +} + +// DatabaseState enumerates the values for database state. +type DatabaseState string + +const ( + // Copying ... + Copying DatabaseState = "Copying" + // Emergency ... + Emergency DatabaseState = "Emergency" + // Offline ... + Offline DatabaseState = "Offline" + // OfflineSecondary ... + OfflineSecondary DatabaseState = "OfflineSecondary" + // Online ... + Online DatabaseState = "Online" + // Recovering ... + Recovering DatabaseState = "Recovering" + // RecoveryPending ... + RecoveryPending DatabaseState = "RecoveryPending" + // Restoring ... + Restoring DatabaseState = "Restoring" + // Suspect ... + Suspect DatabaseState = "Suspect" +) + +// PossibleDatabaseStateValues returns an array of possible values for the DatabaseState const type. +func PossibleDatabaseStateValues() []DatabaseState { + return []DatabaseState{Copying, Emergency, Offline, OfflineSecondary, Online, Recovering, RecoveryPending, Restoring, Suspect} +} + +// ErrorType enumerates the values for error type. +type ErrorType string + +const ( + // ErrorTypeDefault ... + ErrorTypeDefault ErrorType = "Default" + // ErrorTypeError ... + ErrorTypeError ErrorType = "Error" + // ErrorTypeWarning ... + ErrorTypeWarning ErrorType = "Warning" +) + +// PossibleErrorTypeValues returns an array of possible values for the ErrorType const type. +func PossibleErrorTypeValues() []ErrorType { + return []ErrorType{ErrorTypeDefault, ErrorTypeError, ErrorTypeWarning} +} + +// LoginMigrationStage enumerates the values for login migration stage. +type LoginMigrationStage string + +const ( + // LoginMigrationStageAssignRoleMembership ... + LoginMigrationStageAssignRoleMembership LoginMigrationStage = "AssignRoleMembership" + // LoginMigrationStageAssignRoleOwnership ... + LoginMigrationStageAssignRoleOwnership LoginMigrationStage = "AssignRoleOwnership" + // LoginMigrationStageCompleted ... + LoginMigrationStageCompleted LoginMigrationStage = "Completed" + // LoginMigrationStageEstablishObjectPermissions ... + LoginMigrationStageEstablishObjectPermissions LoginMigrationStage = "EstablishObjectPermissions" + // LoginMigrationStageEstablishServerPermissions ... + LoginMigrationStageEstablishServerPermissions LoginMigrationStage = "EstablishServerPermissions" + // LoginMigrationStageEstablishUserMapping ... + LoginMigrationStageEstablishUserMapping LoginMigrationStage = "EstablishUserMapping" + // LoginMigrationStageInitialize ... + LoginMigrationStageInitialize LoginMigrationStage = "Initialize" + // LoginMigrationStageLoginMigration ... + LoginMigrationStageLoginMigration LoginMigrationStage = "LoginMigration" + // LoginMigrationStageNone ... + LoginMigrationStageNone LoginMigrationStage = "None" +) + +// PossibleLoginMigrationStageValues returns an array of possible values for the LoginMigrationStage const type. +func PossibleLoginMigrationStageValues() []LoginMigrationStage { + return []LoginMigrationStage{LoginMigrationStageAssignRoleMembership, LoginMigrationStageAssignRoleOwnership, LoginMigrationStageCompleted, LoginMigrationStageEstablishObjectPermissions, LoginMigrationStageEstablishServerPermissions, LoginMigrationStageEstablishUserMapping, LoginMigrationStageInitialize, LoginMigrationStageLoginMigration, LoginMigrationStageNone} +} + +// LoginType enumerates the values for login type. +type LoginType string + +const ( + // AsymmetricKey ... + AsymmetricKey LoginType = "AsymmetricKey" + // Certificate ... + Certificate LoginType = "Certificate" + // ExternalGroup ... + ExternalGroup LoginType = "ExternalGroup" + // ExternalUser ... + ExternalUser LoginType = "ExternalUser" + // SQLLogin ... + SQLLogin LoginType = "SqlLogin" + // WindowsGroup ... + WindowsGroup LoginType = "WindowsGroup" + // WindowsUser ... + WindowsUser LoginType = "WindowsUser" +) + +// PossibleLoginTypeValues returns an array of possible values for the LoginType const type. +func PossibleLoginTypeValues() []LoginType { + return []LoginType{AsymmetricKey, Certificate, ExternalGroup, ExternalUser, SQLLogin, WindowsGroup, WindowsUser} +} + +// MigrationState enumerates the values for migration state. +type MigrationState string + +const ( + // MigrationStateCompleted ... + MigrationStateCompleted MigrationState = "Completed" + // MigrationStateFailed ... + MigrationStateFailed MigrationState = "Failed" + // MigrationStateInProgress ... + MigrationStateInProgress MigrationState = "InProgress" + // MigrationStateNone ... + MigrationStateNone MigrationState = "None" + // MigrationStateSkipped ... + MigrationStateSkipped MigrationState = "Skipped" + // MigrationStateStopped ... + MigrationStateStopped MigrationState = "Stopped" + // MigrationStateWarning ... + MigrationStateWarning MigrationState = "Warning" +) + +// PossibleMigrationStateValues returns an array of possible values for the MigrationState const type. +func PossibleMigrationStateValues() []MigrationState { + return []MigrationState{MigrationStateCompleted, MigrationStateFailed, MigrationStateInProgress, MigrationStateNone, MigrationStateSkipped, MigrationStateStopped, MigrationStateWarning} +} + +// MigrationStatus enumerates the values for migration status. +type MigrationStatus string + +const ( + // MigrationStatusCompleted ... + MigrationStatusCompleted MigrationStatus = "Completed" + // MigrationStatusCompletedWithWarnings ... + MigrationStatusCompletedWithWarnings MigrationStatus = "CompletedWithWarnings" + // MigrationStatusConfigured ... + MigrationStatusConfigured MigrationStatus = "Configured" + // MigrationStatusConnecting ... + MigrationStatusConnecting MigrationStatus = "Connecting" + // MigrationStatusDefault ... + MigrationStatusDefault MigrationStatus = "Default" + // MigrationStatusError ... + MigrationStatusError MigrationStatus = "Error" + // MigrationStatusRunning ... + MigrationStatusRunning MigrationStatus = "Running" + // MigrationStatusSelectLogins ... + MigrationStatusSelectLogins MigrationStatus = "SelectLogins" + // MigrationStatusSourceAndTargetSelected ... + MigrationStatusSourceAndTargetSelected MigrationStatus = "SourceAndTargetSelected" + // MigrationStatusStopped ... + MigrationStatusStopped MigrationStatus = "Stopped" +) + +// PossibleMigrationStatusValues returns an array of possible values for the MigrationStatus const type. +func PossibleMigrationStatusValues() []MigrationStatus { + return []MigrationStatus{MigrationStatusCompleted, MigrationStatusCompletedWithWarnings, MigrationStatusConfigured, MigrationStatusConnecting, MigrationStatusDefault, MigrationStatusError, MigrationStatusRunning, MigrationStatusSelectLogins, MigrationStatusSourceAndTargetSelected, MigrationStatusStopped} +} + +// NameCheckFailureReason enumerates the values for name check failure reason. +type NameCheckFailureReason string + +const ( + // AlreadyExists ... + AlreadyExists NameCheckFailureReason = "AlreadyExists" + // Invalid ... + Invalid NameCheckFailureReason = "Invalid" +) + +// PossibleNameCheckFailureReasonValues returns an array of possible values for the NameCheckFailureReason const type. +func PossibleNameCheckFailureReasonValues() []NameCheckFailureReason { + return []NameCheckFailureReason{AlreadyExists, Invalid} +} + +// ObjectType enumerates the values for object type. +type ObjectType string + +const ( + // Function ... + Function ObjectType = "Function" + // StoredProcedures ... + StoredProcedures ObjectType = "StoredProcedures" + // Table ... + Table ObjectType = "Table" + // User ... + User ObjectType = "User" + // View ... + View ObjectType = "View" +) + +// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type. +func PossibleObjectTypeValues() []ObjectType { + return []ObjectType{Function, StoredProcedures, Table, User, View} +} + +// ProjectProvisioningState enumerates the values for project provisioning state. +type ProjectProvisioningState string + +const ( + // Deleting ... + Deleting ProjectProvisioningState = "Deleting" + // Succeeded ... + Succeeded ProjectProvisioningState = "Succeeded" +) + +// PossibleProjectProvisioningStateValues returns an array of possible values for the ProjectProvisioningState const type. +func PossibleProjectProvisioningStateValues() []ProjectProvisioningState { + return []ProjectProvisioningState{Deleting, Succeeded} +} + +// ProjectSourcePlatform enumerates the values for project source platform. +type ProjectSourcePlatform string + +const ( + // SQL ... + SQL ProjectSourcePlatform = "SQL" + // Unknown ... + Unknown ProjectSourcePlatform = "Unknown" +) + +// PossibleProjectSourcePlatformValues returns an array of possible values for the ProjectSourcePlatform const type. +func PossibleProjectSourcePlatformValues() []ProjectSourcePlatform { + return []ProjectSourcePlatform{SQL, Unknown} +} + +// ProjectTargetPlatform enumerates the values for project target platform. +type ProjectTargetPlatform string + +const ( + // ProjectTargetPlatformSQLDB ... + ProjectTargetPlatformSQLDB ProjectTargetPlatform = "SQLDB" + // ProjectTargetPlatformSQLMI ... + ProjectTargetPlatformSQLMI ProjectTargetPlatform = "SQLMI" + // ProjectTargetPlatformUnknown ... + ProjectTargetPlatformUnknown ProjectTargetPlatform = "Unknown" +) + +// PossibleProjectTargetPlatformValues returns an array of possible values for the ProjectTargetPlatform const type. +func PossibleProjectTargetPlatformValues() []ProjectTargetPlatform { + return []ProjectTargetPlatform{ProjectTargetPlatformSQLDB, ProjectTargetPlatformSQLMI, ProjectTargetPlatformUnknown} +} + +// ResourceSkuCapacityScaleType enumerates the values for resource sku capacity scale type. +type ResourceSkuCapacityScaleType string + +const ( + // ResourceSkuCapacityScaleTypeAutomatic ... + ResourceSkuCapacityScaleTypeAutomatic ResourceSkuCapacityScaleType = "Automatic" + // ResourceSkuCapacityScaleTypeManual ... + ResourceSkuCapacityScaleTypeManual ResourceSkuCapacityScaleType = "Manual" + // ResourceSkuCapacityScaleTypeNone ... + ResourceSkuCapacityScaleTypeNone ResourceSkuCapacityScaleType = "None" +) + +// PossibleResourceSkuCapacityScaleTypeValues returns an array of possible values for the ResourceSkuCapacityScaleType const type. +func PossibleResourceSkuCapacityScaleTypeValues() []ResourceSkuCapacityScaleType { + return []ResourceSkuCapacityScaleType{ResourceSkuCapacityScaleTypeAutomatic, ResourceSkuCapacityScaleTypeManual, ResourceSkuCapacityScaleTypeNone} +} + +// ResourceSkuRestrictionsReasonCode enumerates the values for resource sku restrictions reason code. +type ResourceSkuRestrictionsReasonCode string + +const ( + // NotAvailableForSubscription ... + NotAvailableForSubscription ResourceSkuRestrictionsReasonCode = "NotAvailableForSubscription" + // QuotaID ... + QuotaID ResourceSkuRestrictionsReasonCode = "QuotaId" +) + +// PossibleResourceSkuRestrictionsReasonCodeValues returns an array of possible values for the ResourceSkuRestrictionsReasonCode const type. +func PossibleResourceSkuRestrictionsReasonCodeValues() []ResourceSkuRestrictionsReasonCode { + return []ResourceSkuRestrictionsReasonCode{NotAvailableForSubscription, QuotaID} +} + +// ResourceSkuRestrictionsType enumerates the values for resource sku restrictions type. +type ResourceSkuRestrictionsType string + +const ( + // Location ... + Location ResourceSkuRestrictionsType = "location" +) + +// PossibleResourceSkuRestrictionsTypeValues returns an array of possible values for the ResourceSkuRestrictionsType const type. +func PossibleResourceSkuRestrictionsTypeValues() []ResourceSkuRestrictionsType { + return []ResourceSkuRestrictionsType{Location} +} + +// ResultType enumerates the values for result type. +type ResultType string + +const ( + // ResultTypeDatabaseLevelOutput ... + ResultTypeDatabaseLevelOutput ResultType = "DatabaseLevelOutput" + // ResultTypeErrorOutput ... + ResultTypeErrorOutput ResultType = "ErrorOutput" + // ResultTypeMigrateSQLServerSQLDbTaskOutput ... + ResultTypeMigrateSQLServerSQLDbTaskOutput ResultType = "MigrateSqlServerSqlDbTaskOutput" + // ResultTypeMigrationLevelOutput ... + ResultTypeMigrationLevelOutput ResultType = "MigrationLevelOutput" + // ResultTypeTableLevelOutput ... + ResultTypeTableLevelOutput ResultType = "TableLevelOutput" +) + +// PossibleResultTypeValues returns an array of possible values for the ResultType const type. +func PossibleResultTypeValues() []ResultType { + return []ResultType{ResultTypeDatabaseLevelOutput, ResultTypeErrorOutput, ResultTypeMigrateSQLServerSQLDbTaskOutput, ResultTypeMigrationLevelOutput, ResultTypeTableLevelOutput} +} + +// ResultTypeBasicConnectToSourceSQLServerTaskOutput enumerates the values for result type basic connect to +// source sql server task output. +type ResultTypeBasicConnectToSourceSQLServerTaskOutput string + +const ( + // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput ... + ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "AgentJobLevelOutput" + // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput ... + ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "ConnectToSourceSqlServerTaskOutput" + // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput ... + ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "DatabaseLevelOutput" + // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput ... + ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "LoginLevelOutput" + // ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput ... + ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput ResultTypeBasicConnectToSourceSQLServerTaskOutput = "TaskLevelOutput" +) + +// PossibleResultTypeBasicConnectToSourceSQLServerTaskOutputValues returns an array of possible values for the ResultTypeBasicConnectToSourceSQLServerTaskOutput const type. +func PossibleResultTypeBasicConnectToSourceSQLServerTaskOutputValues() []ResultTypeBasicConnectToSourceSQLServerTaskOutput { + return []ResultTypeBasicConnectToSourceSQLServerTaskOutput{ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput, ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput} +} + +// ResultTypeBasicMigrateSQLServerSQLMITaskOutput enumerates the values for result type basic migrate sql +// server sqlmi task output. +type ResultTypeBasicMigrateSQLServerSQLMITaskOutput string + +const ( + // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput ... + ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "AgentJobLevelOutput" + // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput ... + ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "DatabaseLevelOutput" + // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput ... + ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "ErrorOutput" + // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput ... + ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "LoginLevelOutput" + // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput ... + ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "MigrateSqlServerSqlMITaskOutput" + // ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput ... + ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput ResultTypeBasicMigrateSQLServerSQLMITaskOutput = "MigrationLevelOutput" +) + +// PossibleResultTypeBasicMigrateSQLServerSQLMITaskOutputValues returns an array of possible values for the ResultTypeBasicMigrateSQLServerSQLMITaskOutput const type. +func PossibleResultTypeBasicMigrateSQLServerSQLMITaskOutputValues() []ResultTypeBasicMigrateSQLServerSQLMITaskOutput { + return []ResultTypeBasicMigrateSQLServerSQLMITaskOutput{ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput, ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput} +} + +// ServerLevelPermissionsGroup enumerates the values for server level permissions group. +type ServerLevelPermissionsGroup string + +const ( + // Default ... + Default ServerLevelPermissionsGroup = "Default" + // MigrationFromSQLServerToAzureDB ... + MigrationFromSQLServerToAzureDB ServerLevelPermissionsGroup = "MigrationFromSqlServerToAzureDB" +) + +// PossibleServerLevelPermissionsGroupValues returns an array of possible values for the ServerLevelPermissionsGroup const type. +func PossibleServerLevelPermissionsGroupValues() []ServerLevelPermissionsGroup { + return []ServerLevelPermissionsGroup{Default, MigrationFromSQLServerToAzureDB} +} + +// ServiceProvisioningState enumerates the values for service provisioning state. +type ServiceProvisioningState string + +const ( + // ServiceProvisioningStateAccepted ... + ServiceProvisioningStateAccepted ServiceProvisioningState = "Accepted" + // ServiceProvisioningStateDeleting ... + ServiceProvisioningStateDeleting ServiceProvisioningState = "Deleting" + // ServiceProvisioningStateDeploying ... + ServiceProvisioningStateDeploying ServiceProvisioningState = "Deploying" + // ServiceProvisioningStateFailed ... + ServiceProvisioningStateFailed ServiceProvisioningState = "Failed" + // ServiceProvisioningStateFailedToStart ... + ServiceProvisioningStateFailedToStart ServiceProvisioningState = "FailedToStart" + // ServiceProvisioningStateFailedToStop ... + ServiceProvisioningStateFailedToStop ServiceProvisioningState = "FailedToStop" + // ServiceProvisioningStateStarting ... + ServiceProvisioningStateStarting ServiceProvisioningState = "Starting" + // ServiceProvisioningStateStopped ... + ServiceProvisioningStateStopped ServiceProvisioningState = "Stopped" + // ServiceProvisioningStateStopping ... + ServiceProvisioningStateStopping ServiceProvisioningState = "Stopping" + // ServiceProvisioningStateSucceeded ... + ServiceProvisioningStateSucceeded ServiceProvisioningState = "Succeeded" +) + +// PossibleServiceProvisioningStateValues returns an array of possible values for the ServiceProvisioningState const type. +func PossibleServiceProvisioningStateValues() []ServiceProvisioningState { + return []ServiceProvisioningState{ServiceProvisioningStateAccepted, ServiceProvisioningStateDeleting, ServiceProvisioningStateDeploying, ServiceProvisioningStateFailed, ServiceProvisioningStateFailedToStart, ServiceProvisioningStateFailedToStop, ServiceProvisioningStateStarting, ServiceProvisioningStateStopped, ServiceProvisioningStateStopping, ServiceProvisioningStateSucceeded} +} + +// ServiceScalability enumerates the values for service scalability. +type ServiceScalability string + +const ( + // ServiceScalabilityAutomatic ... + ServiceScalabilityAutomatic ServiceScalability = "automatic" + // ServiceScalabilityManual ... + ServiceScalabilityManual ServiceScalability = "manual" + // ServiceScalabilityNone ... + ServiceScalabilityNone ServiceScalability = "none" +) + +// PossibleServiceScalabilityValues returns an array of possible values for the ServiceScalability const type. +func PossibleServiceScalabilityValues() []ServiceScalability { + return []ServiceScalability{ServiceScalabilityAutomatic, ServiceScalabilityManual, ServiceScalabilityNone} +} + +// Severity enumerates the values for severity. +type Severity string + +const ( + // SeverityError ... + SeverityError Severity = "Error" + // SeverityMessage ... + SeverityMessage Severity = "Message" + // SeverityWarning ... + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns an array of possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{SeverityError, SeverityMessage, SeverityWarning} +} + +// TaskState enumerates the values for task state. +type TaskState string + +const ( + // TaskStateCanceled ... + TaskStateCanceled TaskState = "Canceled" + // TaskStateFailed ... + TaskStateFailed TaskState = "Failed" + // TaskStateFailedInputValidation ... + TaskStateFailedInputValidation TaskState = "FailedInputValidation" + // TaskStateFaulted ... + TaskStateFaulted TaskState = "Faulted" + // TaskStateQueued ... + TaskStateQueued TaskState = "Queued" + // TaskStateRunning ... + TaskStateRunning TaskState = "Running" + // TaskStateSucceeded ... + TaskStateSucceeded TaskState = "Succeeded" + // TaskStateUnknown ... + TaskStateUnknown TaskState = "Unknown" +) + +// PossibleTaskStateValues returns an array of possible values for the TaskState const type. +func PossibleTaskStateValues() []TaskState { + return []TaskState{TaskStateCanceled, TaskStateFailed, TaskStateFailedInputValidation, TaskStateFaulted, TaskStateQueued, TaskStateRunning, TaskStateSucceeded, TaskStateUnknown} +} + +// TaskType enumerates the values for task type. +type TaskType string + +const ( + // TaskTypeConnectToSourceSQLServer ... + TaskTypeConnectToSourceSQLServer TaskType = "ConnectToSource.SqlServer" + // TaskTypeConnectToTargetAzureSQLDbMI ... + TaskTypeConnectToTargetAzureSQLDbMI TaskType = "ConnectToTarget.AzureSqlDbMI" + // TaskTypeConnectToTargetSQLDb ... + TaskTypeConnectToTargetSQLDb TaskType = "ConnectToTarget.SqlDb" + // TaskTypeGetUserTablesSQL ... + TaskTypeGetUserTablesSQL TaskType = "GetUserTables.Sql" + // TaskTypeMigrateSQLServerAzureSQLDbMI ... + TaskTypeMigrateSQLServerAzureSQLDbMI TaskType = "Migrate.SqlServer.AzureSqlDbMI" + // TaskTypeMigrateSQLServerSQLDb ... + TaskTypeMigrateSQLServerSQLDb TaskType = "Migrate.SqlServer.SqlDb" + // TaskTypeUnknown ... + TaskTypeUnknown TaskType = "Unknown" + // TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI ... + TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI TaskType = "ValidateMigrationInput.SqlServer.AzureSqlDbMI" +) + +// PossibleTaskTypeValues returns an array of possible values for the TaskType const type. +func PossibleTaskTypeValues() []TaskType { + return []TaskType{TaskTypeConnectToSourceSQLServer, TaskTypeConnectToTargetAzureSQLDbMI, TaskTypeConnectToTargetSQLDb, TaskTypeGetUserTablesSQL, TaskTypeMigrateSQLServerAzureSQLDbMI, TaskTypeMigrateSQLServerSQLDb, TaskTypeUnknown, TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI} +} + +// Type enumerates the values for type. +type Type string + +const ( + // TypeSQLConnectionInfo ... + TypeSQLConnectionInfo Type = "SqlConnectionInfo" + // TypeUnknown ... + TypeUnknown Type = "Unknown" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{TypeSQLConnectionInfo, TypeUnknown} +} + +// UpdateActionType enumerates the values for update action type. +type UpdateActionType string + +const ( + // AddedOnTarget ... + AddedOnTarget UpdateActionType = "AddedOnTarget" + // ChangedOnTarget ... + ChangedOnTarget UpdateActionType = "ChangedOnTarget" + // DeletedOnTarget ... + DeletedOnTarget UpdateActionType = "DeletedOnTarget" +) + +// PossibleUpdateActionTypeValues returns an array of possible values for the UpdateActionType const type. +func PossibleUpdateActionTypeValues() []UpdateActionType { + return []UpdateActionType{AddedOnTarget, ChangedOnTarget, DeletedOnTarget} +} + +// ValidationStatus enumerates the values for validation status. +type ValidationStatus string + +const ( + // ValidationStatusCompleted ... + ValidationStatusCompleted ValidationStatus = "Completed" + // ValidationStatusCompletedWithIssues ... + ValidationStatusCompletedWithIssues ValidationStatus = "CompletedWithIssues" + // ValidationStatusDefault ... + ValidationStatusDefault ValidationStatus = "Default" + // ValidationStatusFailed ... + ValidationStatusFailed ValidationStatus = "Failed" + // ValidationStatusInitialized ... + ValidationStatusInitialized ValidationStatus = "Initialized" + // ValidationStatusInProgress ... + ValidationStatusInProgress ValidationStatus = "InProgress" + // ValidationStatusNotStarted ... + ValidationStatusNotStarted ValidationStatus = "NotStarted" + // ValidationStatusStopped ... + ValidationStatusStopped ValidationStatus = "Stopped" +) + +// PossibleValidationStatusValues returns an array of possible values for the ValidationStatus const type. +func PossibleValidationStatusValues() []ValidationStatus { + return []ValidationStatus{ValidationStatusCompleted, ValidationStatusCompletedWithIssues, ValidationStatusDefault, ValidationStatusFailed, ValidationStatusInitialized, ValidationStatusInProgress, ValidationStatusNotStarted, ValidationStatusStopped} +} + +// APIError error information. +type APIError struct { + // Error - Error information in OData format + Error *ODataError `json:"error,omitempty"` +} + +// AvailableServiceSku describes the available service SKU. +type AvailableServiceSku struct { + // ResourceType - The resource type, including the provider namespace + ResourceType *string `json:"resourceType,omitempty"` + // Sku - SKU name, tier, etc. + Sku *AvailableServiceSkuSku `json:"sku,omitempty"` + // Capacity - A description of the scaling capacities of the SKU + Capacity *AvailableServiceSkuCapacity `json:"capacity,omitempty"` +} + +// AvailableServiceSkuCapacity a description of the scaling capacities of the SKU +type AvailableServiceSkuCapacity struct { + // Minimum - The minimum capacity, usually 0 or 1. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - The maximum capacity + Maximum *int32 `json:"maximum,omitempty"` + // Default - The default capacity + Default *int32 `json:"default,omitempty"` + // ScaleType - The scalability approach. Possible values include: 'ServiceScalabilityNone', 'ServiceScalabilityManual', 'ServiceScalabilityAutomatic' + ScaleType ServiceScalability `json:"scaleType,omitempty"` +} + +// AvailableServiceSkuSku SKU name, tier, etc. +type AvailableServiceSkuSku struct { + // Name - The name of the SKU + Name *string `json:"name,omitempty"` + // Family - SKU family + Family *string `json:"family,omitempty"` + // Size - SKU size + Size *string `json:"size,omitempty"` + // Tier - The tier of the SKU, such as "Free", "Basic", "Standard", or "Premium" + Tier *string `json:"tier,omitempty"` +} + +// BlobShare blob container storage information. +type BlobShare struct { + // SasURI - SAS URI of Azure Storage Account Container. + SasURI *string `json:"sasUri,omitempty"` +} + +// BasicConnectionInfo defines the connection properties of a server +type BasicConnectionInfo interface { + AsSQLConnectionInfo() (*SQLConnectionInfo, bool) + AsConnectionInfo() (*ConnectionInfo, bool) +} + +// ConnectionInfo defines the connection properties of a server +type ConnectionInfo struct { + // UserName - User name + UserName *string `json:"userName,omitempty"` + // Password - Password credential. + Password *string `json:"password,omitempty"` + // Type - Possible values include: 'TypeUnknown', 'TypeSQLConnectionInfo' + Type Type `json:"type,omitempty"` +} + +func unmarshalBasicConnectionInfo(body []byte) (BasicConnectionInfo, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeSQLConnectionInfo): + var sci SQLConnectionInfo + err := json.Unmarshal(body, &sci) + return sci, err + default: + var ci ConnectionInfo + err := json.Unmarshal(body, &ci) + return ci, err + } +} +func unmarshalBasicConnectionInfoArray(body []byte) ([]BasicConnectionInfo, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ciArray := make([]BasicConnectionInfo, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ci, err := unmarshalBasicConnectionInfo(*rawMessage) + if err != nil { + return nil, err + } + ciArray[index] = ci + } + return ciArray, nil +} + +// MarshalJSON is the custom marshaler for ConnectionInfo. +func (ci ConnectionInfo) MarshalJSON() ([]byte, error) { + ci.Type = TypeUnknown + objectMap := make(map[string]interface{}) + if ci.UserName != nil { + objectMap["userName"] = ci.UserName + } + if ci.Password != nil { + objectMap["password"] = ci.Password + } + if ci.Type != "" { + objectMap["type"] = ci.Type + } + return json.Marshal(objectMap) +} + +// AsSQLConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. +func (ci ConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { + return nil, false +} + +// AsConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. +func (ci ConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { + return &ci, true +} + +// AsBasicConnectionInfo is the BasicConnectionInfo implementation for ConnectionInfo. +func (ci ConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { + return &ci, true +} + +// ConnectToSourceSQLServerTaskInput input for the task that validates connection to SQL Server and also validates +// source server requirements +type ConnectToSourceSQLServerTaskInput struct { + // SourceConnectionInfo - Connection information for Source SQL Server + SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` + // CheckPermissionsGroup - Permission group for validations. Possible values include: 'Default', 'MigrationFromSQLServerToAzureDB' + CheckPermissionsGroup ServerLevelPermissionsGroup `json:"checkPermissionsGroup,omitempty"` + // CollectLogins - Flag for whether to collect logins from source server. + CollectLogins *bool `json:"CollectLogins,omitempty"` + // CollectAgentJobs - Flag for whether to collect agent jobs from source server. + CollectAgentJobs *bool `json:"CollectAgentJobs,omitempty"` +} + +// BasicConnectToSourceSQLServerTaskOutput output for the task that validates connection to SQL Server and also +// validates source server requirements +type BasicConnectToSourceSQLServerTaskOutput interface { + AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) + AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) + AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) + AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) + AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) +} + +// ConnectToSourceSQLServerTaskOutput output for the task that validates connection to SQL Server and also +// validates source server requirements +type ConnectToSourceSQLServerTaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' + ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` +} + +func unmarshalBasicConnectToSourceSQLServerTaskOutput(body []byte) (BasicConnectToSourceSQLServerTaskOutput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["resultType"] { + case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput): + var ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel + err := json.Unmarshal(body, &ctssstoajl) + return ctssstoajl, err + case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput): + var ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel + err := json.Unmarshal(body, &ctssstoll) + return ctssstoll, err + case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput): + var ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel + err := json.Unmarshal(body, &ctssstodl) + return ctssstodl, err + case string(ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput): + var ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel + err := json.Unmarshal(body, &ctssstotl) + return ctssstotl, err + default: + var ctsssto ConnectToSourceSQLServerTaskOutput + err := json.Unmarshal(body, &ctsssto) + return ctsssto, err + } +} +func unmarshalBasicConnectToSourceSQLServerTaskOutputArray(body []byte) ([]BasicConnectToSourceSQLServerTaskOutput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ctssstoArray := make([]BasicConnectToSourceSQLServerTaskOutput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ctsssto, err := unmarshalBasicConnectToSourceSQLServerTaskOutput(*rawMessage) + if err != nil { + return nil, err + } + ctssstoArray[index] = ctsssto + } + return ctssstoArray, nil +} + +// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) MarshalJSON() ([]byte, error) { + ctsssto.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput + objectMap := make(map[string]interface{}) + if ctsssto.ID != nil { + objectMap["id"] = ctsssto.ID + } + if ctsssto.ResultType != "" { + objectMap["resultType"] = ctsssto.ResultType + } + return json.Marshal(objectMap) +} + +// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { + return &ctsssto, true +} + +// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutput. +func (ctsssto ConnectToSourceSQLServerTaskOutput) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { + return &ctsssto, true +} + +// ConnectToSourceSQLServerTaskOutputAgentJobLevel agentJob level output for the task that validates connection to +// SQL Server and also validates source server requirements +type ConnectToSourceSQLServerTaskOutputAgentJobLevel struct { + // Name - AgentJob name + Name *string `json:"name,omitempty"` + // JobCategory - The type of AgentJob. + JobCategory *string `json:"jobCategory,omitempty"` + // IsEnabled - The state of the original AgentJob. + IsEnabled *bool `json:"isEnabled,omitempty"` + // JobOwner - The owner of the AgentJob + JobOwner *string `json:"jobOwner,omitempty"` + // LastExecutedOn - UTC Date and time when the AgentJob was last executed. + LastExecutedOn *date.Time `json:"lastExecutedOn,omitempty"` + // MigrationEligibility - Information about eligiblity of agent job for migration. + MigrationEligibility *MigrationEligibilityInfo `json:"migrationEligibility,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' + ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) MarshalJSON() ([]byte, error) { + ctssstoajl.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput + objectMap := make(map[string]interface{}) + if ctssstoajl.Name != nil { + objectMap["name"] = ctssstoajl.Name + } + if ctssstoajl.JobCategory != nil { + objectMap["jobCategory"] = ctssstoajl.JobCategory + } + if ctssstoajl.IsEnabled != nil { + objectMap["isEnabled"] = ctssstoajl.IsEnabled + } + if ctssstoajl.JobOwner != nil { + objectMap["jobOwner"] = ctssstoajl.JobOwner + } + if ctssstoajl.LastExecutedOn != nil { + objectMap["lastExecutedOn"] = ctssstoajl.LastExecutedOn + } + if ctssstoajl.MigrationEligibility != nil { + objectMap["migrationEligibility"] = ctssstoajl.MigrationEligibility + } + if ctssstoajl.ID != nil { + objectMap["id"] = ctssstoajl.ID + } + if ctssstoajl.ResultType != "" { + objectMap["resultType"] = ctssstoajl.ResultType + } + return json.Marshal(objectMap) +} + +// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { + return &ctssstoajl, true +} + +// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { + return nil, false +} + +// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputAgentJobLevel. +func (ctssstoajl ConnectToSourceSQLServerTaskOutputAgentJobLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { + return &ctssstoajl, true +} + +// ConnectToSourceSQLServerTaskOutputDatabaseLevel database level output for the task that validates connection to +// SQL Server and also validates source server requirements +type ConnectToSourceSQLServerTaskOutputDatabaseLevel struct { + // Name - Database name + Name *string `json:"name,omitempty"` + // SizeMB - Size of the file in megabytes + SizeMB *float64 `json:"sizeMB,omitempty"` + // DatabaseFiles - The list of database files + DatabaseFiles *[]DatabaseFileInfo `json:"databaseFiles,omitempty"` + // CompatibilityLevel - SQL Server compatibility level of database. Possible values include: 'CompatLevel80', 'CompatLevel90', 'CompatLevel100', 'CompatLevel110', 'CompatLevel120', 'CompatLevel130', 'CompatLevel140' + CompatibilityLevel DatabaseCompatLevel `json:"compatibilityLevel,omitempty"` + // DatabaseState - State of the database. Possible values include: 'Online', 'Restoring', 'Recovering', 'RecoveryPending', 'Suspect', 'Emergency', 'Offline', 'Copying', 'OfflineSecondary' + DatabaseState DatabaseState `json:"databaseState,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' + ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { + ctssstodl.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput + objectMap := make(map[string]interface{}) + if ctssstodl.Name != nil { + objectMap["name"] = ctssstodl.Name + } + if ctssstodl.SizeMB != nil { + objectMap["sizeMB"] = ctssstodl.SizeMB + } + if ctssstodl.DatabaseFiles != nil { + objectMap["databaseFiles"] = ctssstodl.DatabaseFiles + } + if ctssstodl.CompatibilityLevel != "" { + objectMap["compatibilityLevel"] = ctssstodl.CompatibilityLevel + } + if ctssstodl.DatabaseState != "" { + objectMap["databaseState"] = ctssstodl.DatabaseState + } + if ctssstodl.ID != nil { + objectMap["id"] = ctssstodl.ID + } + if ctssstodl.ResultType != "" { + objectMap["resultType"] = ctssstodl.ResultType + } + return json.Marshal(objectMap) +} + +// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { + return &ctssstodl, true +} + +// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { + return nil, false +} + +// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputDatabaseLevel. +func (ctssstodl ConnectToSourceSQLServerTaskOutputDatabaseLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { + return &ctssstodl, true +} + +// ConnectToSourceSQLServerTaskOutputLoginLevel login level output for the task that validates connection to SQL +// Server and also validates source server requirements +type ConnectToSourceSQLServerTaskOutputLoginLevel struct { + // Name - Login name. + Name *string `json:"name,omitempty"` + // LoginType - The type of login. Possible values include: 'WindowsUser', 'WindowsGroup', 'SQLLogin', 'Certificate', 'AsymmetricKey', 'ExternalUser', 'ExternalGroup' + LoginType LoginType `json:"loginType,omitempty"` + // DefaultDatabase - The default database for the login. + DefaultDatabase *string `json:"defaultDatabase,omitempty"` + // IsEnabled - The state of the login. + IsEnabled *bool `json:"isEnabled,omitempty"` + // MigrationEligibility - Information about eligiblity of login for migration. + MigrationEligibility *MigrationEligibilityInfo `json:"migrationEligibility,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' + ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) MarshalJSON() ([]byte, error) { + ctssstoll.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput + objectMap := make(map[string]interface{}) + if ctssstoll.Name != nil { + objectMap["name"] = ctssstoll.Name + } + if ctssstoll.LoginType != "" { + objectMap["loginType"] = ctssstoll.LoginType + } + if ctssstoll.DefaultDatabase != nil { + objectMap["defaultDatabase"] = ctssstoll.DefaultDatabase + } + if ctssstoll.IsEnabled != nil { + objectMap["isEnabled"] = ctssstoll.IsEnabled + } + if ctssstoll.MigrationEligibility != nil { + objectMap["migrationEligibility"] = ctssstoll.MigrationEligibility + } + if ctssstoll.ID != nil { + objectMap["id"] = ctssstoll.ID + } + if ctssstoll.ResultType != "" { + objectMap["resultType"] = ctssstoll.ResultType + } + return json.Marshal(objectMap) +} + +// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { + return &ctssstoll, true +} + +// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { + return nil, false +} + +// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputLoginLevel. +func (ctssstoll ConnectToSourceSQLServerTaskOutputLoginLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { + return &ctssstoll, true +} + +// ConnectToSourceSQLServerTaskOutputTaskLevel task level output for the task that validates connection to SQL +// Server and also validates source server requirements +type ConnectToSourceSQLServerTaskOutputTaskLevel struct { + // Databases - Source databases as a map from database name to database id + Databases map[string]*string `json:"databases"` + // Logins - Source logins as a map from login name to login id. + Logins map[string]*string `json:"Logins"` + // AgentJobs - Source agent jobs as a map from agent job name to id. + AgentJobs map[string]*string `json:"AgentJobs"` + // SourceServerVersion - Source server version + SourceServerVersion *string `json:"sourceServerVersion,omitempty"` + // SourceServerBrandVersion - Source server brand version + SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` + // ValidationErrors - Validation errors + ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeConnectToSourceSQLServerTaskOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput' + ResultType ResultTypeBasicConnectToSourceSQLServerTaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) MarshalJSON() ([]byte, error) { + ctssstotl.ResultType = ResultTypeBasicConnectToSourceSQLServerTaskOutputResultTypeTaskLevelOutput + objectMap := make(map[string]interface{}) + if ctssstotl.Databases != nil { + objectMap["databases"] = ctssstotl.Databases + } + if ctssstotl.Logins != nil { + objectMap["Logins"] = ctssstotl.Logins + } + if ctssstotl.AgentJobs != nil { + objectMap["AgentJobs"] = ctssstotl.AgentJobs + } + if ctssstotl.SourceServerVersion != nil { + objectMap["sourceServerVersion"] = ctssstotl.SourceServerVersion + } + if ctssstotl.SourceServerBrandVersion != nil { + objectMap["sourceServerBrandVersion"] = ctssstotl.SourceServerBrandVersion + } + if ctssstotl.ValidationErrors != nil { + objectMap["validationErrors"] = ctssstotl.ValidationErrors + } + if ctssstotl.ID != nil { + objectMap["id"] = ctssstotl.ID + } + if ctssstotl.ResultType != "" { + objectMap["resultType"] = ctssstotl.ResultType + } + return json.Marshal(objectMap) +} + +// AsConnectToSourceSQLServerTaskOutputAgentJobLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputAgentJobLevel() (*ConnectToSourceSQLServerTaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputLoginLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputLoginLevel() (*ConnectToSourceSQLServerTaskOutputLoginLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputDatabaseLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputDatabaseLevel() (*ConnectToSourceSQLServerTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskOutputTaskLevel is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutputTaskLevel() (*ConnectToSourceSQLServerTaskOutputTaskLevel, bool) { + return &ctssstotl, true +} + +// AsConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsConnectToSourceSQLServerTaskOutput() (*ConnectToSourceSQLServerTaskOutput, bool) { + return nil, false +} + +// AsBasicConnectToSourceSQLServerTaskOutput is the BasicConnectToSourceSQLServerTaskOutput implementation for ConnectToSourceSQLServerTaskOutputTaskLevel. +func (ctssstotl ConnectToSourceSQLServerTaskOutputTaskLevel) AsBasicConnectToSourceSQLServerTaskOutput() (BasicConnectToSourceSQLServerTaskOutput, bool) { + return &ctssstotl, true +} + +// ConnectToSourceSQLServerTaskProperties properties for the task that validates connection to SQL Server and also +// validates source server requirements +type ConnectToSourceSQLServerTaskProperties struct { + // Input - Task input + Input *ConnectToSourceSQLServerTaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]BasicConnectToSourceSQLServerTaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) MarshalJSON() ([]byte, error) { + ctssstp.TaskType = TaskTypeConnectToSourceSQLServer + objectMap := make(map[string]interface{}) + if ctssstp.Input != nil { + objectMap["input"] = ctssstp.Input + } + if ctssstp.Output != nil { + objectMap["output"] = ctssstp.Output + } + if ctssstp.Errors != nil { + objectMap["errors"] = ctssstp.Errors + } + if ctssstp.State != "" { + objectMap["state"] = ctssstp.State + } + if ctssstp.TaskType != "" { + objectMap["taskType"] = ctssstp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return &ctssstp, true +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToSourceSQLServerTaskProperties. +func (ctssstp ConnectToSourceSQLServerTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &ctssstp, true +} + +// UnmarshalJSON is the custom unmarshaler for ConnectToSourceSQLServerTaskProperties struct. +func (ctssstp *ConnectToSourceSQLServerTaskProperties) 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 "input": + if v != nil { + var input ConnectToSourceSQLServerTaskInput + err = json.Unmarshal(*v, &input) + if err != nil { + return err + } + ctssstp.Input = &input + } + case "output": + if v != nil { + output, err := unmarshalBasicConnectToSourceSQLServerTaskOutputArray(*v) + if err != nil { + return err + } + ctssstp.Output = &output + } + case "errors": + if v != nil { + var errorsVar []ODataError + err = json.Unmarshal(*v, &errorsVar) + if err != nil { + return err + } + ctssstp.Errors = &errorsVar + } + case "state": + if v != nil { + var state TaskState + err = json.Unmarshal(*v, &state) + if err != nil { + return err + } + ctssstp.State = state + } + case "taskType": + if v != nil { + var taskType TaskType + err = json.Unmarshal(*v, &taskType) + if err != nil { + return err + } + ctssstp.TaskType = taskType + } + } + } + + return nil +} + +// ConnectToTargetSQLDbTaskInput input for the task that validates connection to SQL DB and target server +// requirements +type ConnectToTargetSQLDbTaskInput struct { + // TargetConnectionInfo - Connection information for target SQL DB + TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` +} + +// ConnectToTargetSQLDbTaskOutput output for the task that validates connection to SQL DB and target server +// requirements +type ConnectToTargetSQLDbTaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // Databases - Source databases as a map from database name to database id + Databases map[string]*string `json:"databases"` + // TargetServerVersion - Version of the target server + TargetServerVersion *string `json:"targetServerVersion,omitempty"` + // TargetServerBrandVersion - Target server brand version + TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToTargetSQLDbTaskOutput. +func (cttsdto ConnectToTargetSQLDbTaskOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cttsdto.ID != nil { + objectMap["id"] = cttsdto.ID + } + if cttsdto.Databases != nil { + objectMap["databases"] = cttsdto.Databases + } + if cttsdto.TargetServerVersion != nil { + objectMap["targetServerVersion"] = cttsdto.TargetServerVersion + } + if cttsdto.TargetServerBrandVersion != nil { + objectMap["targetServerBrandVersion"] = cttsdto.TargetServerBrandVersion + } + return json.Marshal(objectMap) +} + +// ConnectToTargetSQLDbTaskProperties properties for the task that validates connection to SQL DB and target server +// requirements +type ConnectToTargetSQLDbTaskProperties struct { + // Input - Task input + Input *ConnectToTargetSQLDbTaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]ConnectToTargetSQLDbTaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) MarshalJSON() ([]byte, error) { + cttsdtp.TaskType = TaskTypeConnectToTargetSQLDb + objectMap := make(map[string]interface{}) + if cttsdtp.Input != nil { + objectMap["input"] = cttsdtp.Input + } + if cttsdtp.Output != nil { + objectMap["output"] = cttsdtp.Output + } + if cttsdtp.Errors != nil { + objectMap["errors"] = cttsdtp.Errors + } + if cttsdtp.State != "" { + objectMap["state"] = cttsdtp.State + } + if cttsdtp.TaskType != "" { + objectMap["taskType"] = cttsdtp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return &cttsdtp, true +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLDbTaskProperties. +func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &cttsdtp, true +} + +// ConnectToTargetSQLMITaskInput input for the task that validates connection to Azure SQL Database Managed +// Instance. +type ConnectToTargetSQLMITaskInput struct { + // TargetConnectionInfo - Connection information for target SQL Server + TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` +} + +// ConnectToTargetSQLMITaskOutput output for the task that validates connection to Azure SQL Database Managed +// Instance. +type ConnectToTargetSQLMITaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // TargetServerVersion - Target server version + TargetServerVersion *string `json:"targetServerVersion,omitempty"` + // TargetServerBrandVersion - Target server brand version + TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` + // Logins - List of logins on the target server. + Logins *[]string `json:"Logins,omitempty"` + // AgentJobs - List of agent jobs on the target server. + AgentJobs *[]string `json:"AgentJobs,omitempty"` + // ValidationErrors - Validation errors + ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` +} + +// ConnectToTargetSQLMITaskProperties properties for the task that validates connection to Azure SQL Database +// Managed Instance +type ConnectToTargetSQLMITaskProperties struct { + // Input - Task input + Input *ConnectToTargetSQLMITaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]ConnectToTargetSQLMITaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) MarshalJSON() ([]byte, error) { + cttsmtp.TaskType = TaskTypeConnectToTargetAzureSQLDbMI + objectMap := make(map[string]interface{}) + if cttsmtp.Input != nil { + objectMap["input"] = cttsmtp.Input + } + if cttsmtp.Output != nil { + objectMap["output"] = cttsmtp.Output + } + if cttsmtp.Errors != nil { + objectMap["errors"] = cttsmtp.Errors + } + if cttsmtp.State != "" { + objectMap["state"] = cttsmtp.State + } + if cttsmtp.TaskType != "" { + objectMap["taskType"] = cttsmtp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return &cttsmtp, true +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ConnectToTargetSQLMITaskProperties. +func (cttsmtp ConnectToTargetSQLMITaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &cttsmtp, true +} + +// Database information about a single database +type Database struct { + // ID - Unique identifier for the database + ID *string `json:"id,omitempty"` + // Name - Name of the database + Name *string `json:"name,omitempty"` + // CompatibilityLevel - SQL Server compatibility level of database. Possible values include: 'CompatLevel80', 'CompatLevel90', 'CompatLevel100', 'CompatLevel110', 'CompatLevel120', 'CompatLevel130', 'CompatLevel140' + CompatibilityLevel DatabaseCompatLevel `json:"compatibilityLevel,omitempty"` + // Collation - Collation name of the database + Collation *string `json:"collation,omitempty"` + // ServerName - Name of the server + ServerName *string `json:"serverName,omitempty"` + // Fqdn - Fully qualified name + Fqdn *string `json:"fqdn,omitempty"` + // InstallID - Install id of the database + InstallID *string `json:"installId,omitempty"` + // ServerVersion - Version of the server + ServerVersion *string `json:"serverVersion,omitempty"` + // ServerEdition - Edition of the server + ServerEdition *string `json:"serverEdition,omitempty"` + // ServerLevel - Product level of the server (RTM, SP, CTP). + ServerLevel *string `json:"serverLevel,omitempty"` + // ServerDefaultDataPath - Default path of the data files + ServerDefaultDataPath *string `json:"serverDefaultDataPath,omitempty"` + // ServerDefaultLogPath - Default path of the log files + ServerDefaultLogPath *string `json:"serverDefaultLogPath,omitempty"` + // ServerDefaultBackupPath - Default path of the backup folder + ServerDefaultBackupPath *string `json:"serverDefaultBackupPath,omitempty"` + // ServerCoreCount - Number of cores on the server + ServerCoreCount *int32 `json:"serverCoreCount,omitempty"` + // ServerVisibleOnlineCoreCount - Number of cores on the server that have VISIBLE ONLINE status + ServerVisibleOnlineCoreCount *int32 `json:"serverVisibleOnlineCoreCount,omitempty"` + // DatabaseState - State of the database. Possible values include: 'Online', 'Restoring', 'Recovering', 'RecoveryPending', 'Suspect', 'Emergency', 'Offline', 'Copying', 'OfflineSecondary' + DatabaseState DatabaseState `json:"databaseState,omitempty"` + // ServerID - The unique Server Id + ServerID *string `json:"serverId,omitempty"` +} + +// DatabaseFileInfo database file specific information +type DatabaseFileInfo struct { + // DatabaseName - Name of the database + DatabaseName *string `json:"databaseName,omitempty"` + // ID - Unique identifier for database file + ID *string `json:"id,omitempty"` + // LogicalName - Logical name of the file + LogicalName *string `json:"logicalName,omitempty"` + // PhysicalFullName - Operating-system full path of the file + PhysicalFullName *string `json:"physicalFullName,omitempty"` + // RestoreFullName - Suggested full path of the file for restoring + RestoreFullName *string `json:"restoreFullName,omitempty"` + // FileType - Database file type. Possible values include: 'Rows', 'Log', 'Filestream', 'NotSupported', 'Fulltext' + FileType DatabaseFileType `json:"fileType,omitempty"` + // SizeMB - Size of the file in megabytes + SizeMB *float64 `json:"sizeMB,omitempty"` +} + +// DatabaseFileInput database file specific information for input +type DatabaseFileInput struct { + // ID - Unique identifier for database file + ID *string `json:"id,omitempty"` + // LogicalName - Logical name of the file + LogicalName *string `json:"logicalName,omitempty"` + // PhysicalFullName - Operating-system full path of the file + PhysicalFullName *string `json:"physicalFullName,omitempty"` + // RestoreFullName - Suggested full path of the file for restoring + RestoreFullName *string `json:"restoreFullName,omitempty"` + // FileType - Database file type. Possible values include: 'Rows', 'Log', 'Filestream', 'NotSupported', 'Fulltext' + FileType DatabaseFileType `json:"fileType,omitempty"` +} + +// DatabaseInfo project Database Details +type DatabaseInfo struct { + // SourceDatabaseName - Name of the database + SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` +} + +// DatabaseObjectName a representation of the name of an object in a database +type DatabaseObjectName struct { + // DatabaseName - The unescaped name of the database containing the object + DatabaseName *string `json:"databaseName,omitempty"` + // ObjectName - The unescaped name of the object + ObjectName *string `json:"objectName,omitempty"` + // SchemaName - The unescaped name of the schema containing the object + SchemaName *string `json:"schemaName,omitempty"` + // ObjectType - Type of the object in the database. Possible values include: 'StoredProcedures', 'Table', 'User', 'View', 'Function' + ObjectType ObjectType `json:"objectType,omitempty"` +} + +// DatabaseSummaryResult summary of database results in the migration +type DatabaseSummaryResult struct { + // SizeMB - Size of the database in megabytes + SizeMB *float64 `json:"sizeMB,omitempty"` + // Name - Name of the item + Name *string `json:"name,omitempty"` + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // StatusMessage - Status message + StatusMessage *string `json:"statusMessage,omitempty"` + // ItemsCount - Number of items + ItemsCount *int64 `json:"itemsCount,omitempty"` + // ItemsCompletedCount - Number of successfully completed items + ItemsCompletedCount *int64 `json:"itemsCompletedCount,omitempty"` + // ErrorPrefix - Wildcard string prefix to use for querying all errors of the item + ErrorPrefix *string `json:"errorPrefix,omitempty"` + // ResultPrefix - Wildcard string prefix to use for querying all sub-tem results of the item + ResultPrefix *string `json:"resultPrefix,omitempty"` +} + +// DatabaseTable table properties +type DatabaseTable struct { + // HasRows - Indicates whether table is empty or not + HasRows *bool `json:"hasRows,omitempty"` + // Name - Schema-qualified name of the table + Name *string `json:"name,omitempty"` +} + +// DataIntegrityValidationResult results for checksum based Data Integrity validation results +type DataIntegrityValidationResult struct { + // FailedObjects - List of failed table names of source and target pair + FailedObjects map[string]*string `json:"failedObjects"` + // ValidationErrors - List of errors that happened while performing data integrity validation + ValidationErrors *ValidationError `json:"validationErrors,omitempty"` +} + +// MarshalJSON is the custom marshaler for DataIntegrityValidationResult. +func (divr DataIntegrityValidationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if divr.FailedObjects != nil { + objectMap["failedObjects"] = divr.FailedObjects + } + if divr.ValidationErrors != nil { + objectMap["validationErrors"] = divr.ValidationErrors + } + return json.Marshal(objectMap) +} + +// DataItemMigrationSummaryResult basic summary of a data item migration +type DataItemMigrationSummaryResult struct { + // Name - Name of the item + Name *string `json:"name,omitempty"` + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // StatusMessage - Status message + StatusMessage *string `json:"statusMessage,omitempty"` + // ItemsCount - Number of items + ItemsCount *int64 `json:"itemsCount,omitempty"` + // ItemsCompletedCount - Number of successfully completed items + ItemsCompletedCount *int64 `json:"itemsCompletedCount,omitempty"` + // ErrorPrefix - Wildcard string prefix to use for querying all errors of the item + ErrorPrefix *string `json:"errorPrefix,omitempty"` + // ResultPrefix - Wildcard string prefix to use for querying all sub-tem results of the item + ResultPrefix *string `json:"resultPrefix,omitempty"` +} + +// Error migration Task errors +type Error struct { + // Message - Error description + Message *string `json:"message,omitempty"` + // Type - Possible values include: 'ErrorTypeDefault', 'ErrorTypeWarning', 'ErrorTypeError' + Type ErrorType `json:"type,omitempty"` +} + +// ExecutionStatistics description about the errors happen while performing migration validation +type ExecutionStatistics struct { + // ExecutionCount - No. of query executions + ExecutionCount *int64 `json:"executionCount,omitempty"` + // CPUTimeMs - CPU Time in millisecond(s) for the query execution + CPUTimeMs *float64 `json:"cpuTimeMs,omitempty"` + // ElapsedTimeMs - Time taken in millisecond(s) for executing the query + ElapsedTimeMs *float64 `json:"elapsedTimeMs,omitempty"` + // WaitStats - Dictionary of sql query execution wait types and the respective statistics + WaitStats map[string]*WaitStatistics `json:"waitStats"` + // HasErrors - Indicates whether the query resulted in an error + HasErrors *bool `json:"hasErrors,omitempty"` + // SQLErrors - List of sql Errors + SQLErrors *[]string `json:"sqlErrors,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExecutionStatistics. +func (es ExecutionStatistics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if es.ExecutionCount != nil { + objectMap["executionCount"] = es.ExecutionCount + } + if es.CPUTimeMs != nil { + objectMap["cpuTimeMs"] = es.CPUTimeMs + } + if es.ElapsedTimeMs != nil { + objectMap["elapsedTimeMs"] = es.ElapsedTimeMs + } + if es.WaitStats != nil { + objectMap["waitStats"] = es.WaitStats + } + if es.HasErrors != nil { + objectMap["hasErrors"] = es.HasErrors + } + if es.SQLErrors != nil { + objectMap["sqlErrors"] = es.SQLErrors + } + return json.Marshal(objectMap) +} + +// FileShare file share information with Path, Username, and Password. +type FileShare struct { + // UserName - User name credential to connect to the share location + UserName *string `json:"userName,omitempty"` + // Password - Password credential used to connect to the share location. + Password *string `json:"password,omitempty"` + // Path - The folder path for this share. + Path *string `json:"path,omitempty"` +} + +// GetUserTablesSQLTaskInput input for the task that collects user tables for the given list of databases +type GetUserTablesSQLTaskInput struct { + // ConnectionInfo - Connection information for SQL Server + ConnectionInfo *SQLConnectionInfo `json:"connectionInfo,omitempty"` + // SelectedDatabases - List of database names to collect tables for + SelectedDatabases *[]string `json:"selectedDatabases,omitempty"` +} + +// GetUserTablesSQLTaskOutput output of the task that collects user tables for the given list of databases +type GetUserTablesSQLTaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // DatabasesToTables - Mapping from database name to list of tables + DatabasesToTables map[string][]DatabaseTable `json:"databasesToTables"` + // ValidationErrors - Validation errors + ValidationErrors *[]ReportableException `json:"validationErrors,omitempty"` +} + +// MarshalJSON is the custom marshaler for GetUserTablesSQLTaskOutput. +func (gutsto GetUserTablesSQLTaskOutput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gutsto.ID != nil { + objectMap["id"] = gutsto.ID + } + if gutsto.DatabasesToTables != nil { + objectMap["databasesToTables"] = gutsto.DatabasesToTables + } + if gutsto.ValidationErrors != nil { + objectMap["validationErrors"] = gutsto.ValidationErrors + } + return json.Marshal(objectMap) +} + +// GetUserTablesSQLTaskProperties properties for the task that collects user tables for the given list of databases +type GetUserTablesSQLTaskProperties struct { + // Input - Task input + Input *GetUserTablesSQLTaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]GetUserTablesSQLTaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) MarshalJSON() ([]byte, error) { + gutstp.TaskType = TaskTypeGetUserTablesSQL + objectMap := make(map[string]interface{}) + if gutstp.Input != nil { + objectMap["input"] = gutstp.Input + } + if gutstp.Output != nil { + objectMap["output"] = gutstp.Output + } + if gutstp.Errors != nil { + objectMap["errors"] = gutstp.Errors + } + if gutstp.State != "" { + objectMap["state"] = gutstp.State + } + if gutstp.TaskType != "" { + objectMap["taskType"] = gutstp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return &gutstp, true +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for GetUserTablesSQLTaskProperties. +func (gutstp GetUserTablesSQLTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &gutstp, true +} + +// MigrateSQLServerSQLDbDatabaseInput database specific information for SQL to Azure SQL DB migration task inputs +type MigrateSQLServerSQLDbDatabaseInput struct { + // Name - Name of the database + Name *string `json:"name,omitempty"` + // TargetDatabaseName - Name of target database. Note: Target database will be truncated before starting migration. + TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` + // MakeSourceDbReadOnly - Whether to set database read only before migration + MakeSourceDbReadOnly *bool `json:"makeSourceDbReadOnly,omitempty"` + // TableMap - Mapping of source to target tables + TableMap map[string]*string `json:"tableMap"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbDatabaseInput. +func (msssddi MigrateSQLServerSQLDbDatabaseInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msssddi.Name != nil { + objectMap["name"] = msssddi.Name + } + if msssddi.TargetDatabaseName != nil { + objectMap["targetDatabaseName"] = msssddi.TargetDatabaseName + } + if msssddi.MakeSourceDbReadOnly != nil { + objectMap["makeSourceDbReadOnly"] = msssddi.MakeSourceDbReadOnly + } + if msssddi.TableMap != nil { + objectMap["tableMap"] = msssddi.TableMap + } + return json.Marshal(objectMap) +} + +// MigrateSQLServerSQLDbTaskInput input for the task that migrates on-prem SQL Server databases to Azure SQL +// Database +type MigrateSQLServerSQLDbTaskInput struct { + // SelectedDatabases - Databases to migrate + SelectedDatabases *[]MigrateSQLServerSQLDbDatabaseInput `json:"selectedDatabases,omitempty"` + // ValidationOptions - Options for enabling various post migration validations. Available options, + // 1.) Data Integrity Check: Performs a checksum based comparison on source and target tables after the migration to ensure the correctness of the data. + // 2.) Schema Validation: Performs a thorough schema comparison between the source and target tables and provides a list of differences between the source and target database, 3.) Query Analysis: Executes a set of queries picked up automatically either from the Query Plan Cache or Query Store and execute them and compares the execution time between the source and target database. + ValidationOptions *MigrationValidationOptions `json:"validationOptions,omitempty"` + // SourceConnectionInfo - Information for connecting to source + SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` + // TargetConnectionInfo - Information for connecting to target + TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` +} + +// BasicMigrateSQLServerSQLDbTaskOutput output for the task that migrates on-prem SQL Server databases to Azure SQL +// Database +type BasicMigrateSQLServerSQLDbTaskOutput interface { + AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) + AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) + AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) + AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) + AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) +} + +// MigrateSQLServerSQLDbTaskOutput output for the task that migrates on-prem SQL Server databases to Azure SQL +// Database +type MigrateSQLServerSQLDbTaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' + ResultType ResultType `json:"resultType,omitempty"` +} + +func unmarshalBasicMigrateSQLServerSQLDbTaskOutput(body []byte) (BasicMigrateSQLServerSQLDbTaskOutput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["resultType"] { + case string(ResultTypeErrorOutput): + var msssdtoe MigrateSQLServerSQLDbTaskOutputError + err := json.Unmarshal(body, &msssdtoe) + return msssdtoe, err + case string(ResultTypeTableLevelOutput): + var msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel + err := json.Unmarshal(body, &msssdtotl) + return msssdtotl, err + case string(ResultTypeDatabaseLevelOutput): + var msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel + err := json.Unmarshal(body, &msssdtodl) + return msssdtodl, err + case string(ResultTypeMigrationLevelOutput): + var msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel + err := json.Unmarshal(body, &msssdtoml) + return msssdtoml, err + default: + var msssdto MigrateSQLServerSQLDbTaskOutput + err := json.Unmarshal(body, &msssdto) + return msssdto, err + } +} +func unmarshalBasicMigrateSQLServerSQLDbTaskOutputArray(body []byte) ([]BasicMigrateSQLServerSQLDbTaskOutput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + msssdtoArray := make([]BasicMigrateSQLServerSQLDbTaskOutput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + msssdto, err := unmarshalBasicMigrateSQLServerSQLDbTaskOutput(*rawMessage) + if err != nil { + return nil, err + } + msssdtoArray[index] = msssdto + } + return msssdtoArray, nil +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) MarshalJSON() ([]byte, error) { + msssdto.ResultType = ResultTypeMigrateSQLServerSQLDbTaskOutput + objectMap := make(map[string]interface{}) + if msssdto.ID != nil { + objectMap["id"] = msssdto.ID + } + if msssdto.ResultType != "" { + objectMap["resultType"] = msssdto.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { + return &msssdto, true +} + +// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutput. +func (msssdto MigrateSQLServerSQLDbTaskOutput) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { + return &msssdto, true +} + +// MigrateSQLServerSQLDbTaskOutputDatabaseLevel ... +type MigrateSQLServerSQLDbTaskOutputDatabaseLevel struct { + // DatabaseName - Name of the item + DatabaseName *string `json:"databaseName,omitempty"` + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // Stage - Migration stage that this database is in. Possible values include: 'DatabaseMigrationStageNone', 'DatabaseMigrationStageInitialize', 'DatabaseMigrationStageBackup', 'DatabaseMigrationStageFileCopy', 'DatabaseMigrationStageRestore', 'DatabaseMigrationStageCompleted' + Stage DatabaseMigrationStage `json:"stage,omitempty"` + // StatusMessage - Status message + StatusMessage *string `json:"statusMessage,omitempty"` + // Message - Migration progress message + Message *string `json:"message,omitempty"` + // NumberOfObjects - Number of objects + NumberOfObjects *int64 `json:"numberOfObjects,omitempty"` + // NumberOfObjectsCompleted - Number of successfully completed objects + NumberOfObjectsCompleted *int64 `json:"numberOfObjectsCompleted,omitempty"` + // ErrorCount - Number of database/object errors. + ErrorCount *int64 `json:"errorCount,omitempty"` + // ErrorPrefix - Wildcard string prefix to use for querying all errors of the item + ErrorPrefix *string `json:"errorPrefix,omitempty"` + // ResultPrefix - Wildcard string prefix to use for querying all sub-tem results of the item + ResultPrefix *string `json:"resultPrefix,omitempty"` + // ExceptionsAndWarnings - Migration exceptions and warnings. + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` + // ObjectSummary - Summary of object results in the migration + ObjectSummary map[string]*DataItemMigrationSummaryResult `json:"objectSummary"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' + ResultType ResultType `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { + msssdtodl.ResultType = ResultTypeDatabaseLevelOutput + objectMap := make(map[string]interface{}) + if msssdtodl.DatabaseName != nil { + objectMap["databaseName"] = msssdtodl.DatabaseName + } + if msssdtodl.StartedOn != nil { + objectMap["startedOn"] = msssdtodl.StartedOn + } + if msssdtodl.EndedOn != nil { + objectMap["endedOn"] = msssdtodl.EndedOn + } + if msssdtodl.State != "" { + objectMap["state"] = msssdtodl.State + } + if msssdtodl.Stage != "" { + objectMap["stage"] = msssdtodl.Stage + } + if msssdtodl.StatusMessage != nil { + objectMap["statusMessage"] = msssdtodl.StatusMessage + } + if msssdtodl.Message != nil { + objectMap["message"] = msssdtodl.Message + } + if msssdtodl.NumberOfObjects != nil { + objectMap["numberOfObjects"] = msssdtodl.NumberOfObjects + } + if msssdtodl.NumberOfObjectsCompleted != nil { + objectMap["numberOfObjectsCompleted"] = msssdtodl.NumberOfObjectsCompleted + } + if msssdtodl.ErrorCount != nil { + objectMap["errorCount"] = msssdtodl.ErrorCount + } + if msssdtodl.ErrorPrefix != nil { + objectMap["errorPrefix"] = msssdtodl.ErrorPrefix + } + if msssdtodl.ResultPrefix != nil { + objectMap["resultPrefix"] = msssdtodl.ResultPrefix + } + if msssdtodl.ExceptionsAndWarnings != nil { + objectMap["exceptionsAndWarnings"] = msssdtodl.ExceptionsAndWarnings + } + if msssdtodl.ObjectSummary != nil { + objectMap["objectSummary"] = msssdtodl.ObjectSummary + } + if msssdtodl.ID != nil { + objectMap["id"] = msssdtodl.ID + } + if msssdtodl.ResultType != "" { + objectMap["resultType"] = msssdtodl.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { + return &msssdtodl, true +} + +// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputDatabaseLevel. +func (msssdtodl MigrateSQLServerSQLDbTaskOutputDatabaseLevel) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { + return &msssdtodl, true +} + +// MigrateSQLServerSQLDbTaskOutputError ... +type MigrateSQLServerSQLDbTaskOutputError struct { + // Error - Migration error + Error *ReportableException `json:"error,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' + ResultType ResultType `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) MarshalJSON() ([]byte, error) { + msssdtoe.ResultType = ResultTypeErrorOutput + objectMap := make(map[string]interface{}) + if msssdtoe.Error != nil { + objectMap["error"] = msssdtoe.Error + } + if msssdtoe.ID != nil { + objectMap["id"] = msssdtoe.ID + } + if msssdtoe.ResultType != "" { + objectMap["resultType"] = msssdtoe.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { + return &msssdtoe, true +} + +// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputError. +func (msssdtoe MigrateSQLServerSQLDbTaskOutputError) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { + return &msssdtoe, true +} + +// MigrateSQLServerSQLDbTaskOutputMigrationLevel ... +type MigrateSQLServerSQLDbTaskOutputMigrationLevel struct { + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // DurationInSeconds - Duration of task execution in seconds. + DurationInSeconds *int64 `json:"durationInSeconds,omitempty"` + // Status - Current status of migration. Possible values include: 'MigrationStatusDefault', 'MigrationStatusConnecting', 'MigrationStatusSourceAndTargetSelected', 'MigrationStatusSelectLogins', 'MigrationStatusConfigured', 'MigrationStatusRunning', 'MigrationStatusError', 'MigrationStatusStopped', 'MigrationStatusCompleted', 'MigrationStatusCompletedWithWarnings' + Status MigrationStatus `json:"status,omitempty"` + // StatusMessage - Migration status message + StatusMessage *string `json:"statusMessage,omitempty"` + // Message - Migration progress message + Message *string `json:"message,omitempty"` + // Databases - Selected databases as a map from database name to database id + Databases map[string]*string `json:"databases"` + // DatabaseSummary - Summary of database results in the migration + DatabaseSummary map[string]*DatabaseSummaryResult `json:"databaseSummary"` + // MigrationReportResult - Migration Report Result, provides unique url for downloading your migration report. + MigrationReportResult *MigrationReportResult `json:"migrationReportResult,omitempty"` + // SourceServerVersion - Source server version + SourceServerVersion *string `json:"sourceServerVersion,omitempty"` + // SourceServerBrandVersion - Source server brand version + SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` + // TargetServerVersion - Target server version + TargetServerVersion *string `json:"targetServerVersion,omitempty"` + // TargetServerBrandVersion - Target server brand version + TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` + // ExceptionsAndWarnings - Migration exceptions and warnings. + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' + ResultType ResultType `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { + msssdtoml.ResultType = ResultTypeMigrationLevelOutput + objectMap := make(map[string]interface{}) + if msssdtoml.StartedOn != nil { + objectMap["startedOn"] = msssdtoml.StartedOn + } + if msssdtoml.EndedOn != nil { + objectMap["endedOn"] = msssdtoml.EndedOn + } + if msssdtoml.DurationInSeconds != nil { + objectMap["durationInSeconds"] = msssdtoml.DurationInSeconds + } + if msssdtoml.Status != "" { + objectMap["status"] = msssdtoml.Status + } + if msssdtoml.StatusMessage != nil { + objectMap["statusMessage"] = msssdtoml.StatusMessage + } + if msssdtoml.Message != nil { + objectMap["message"] = msssdtoml.Message + } + if msssdtoml.Databases != nil { + objectMap["databases"] = msssdtoml.Databases + } + if msssdtoml.DatabaseSummary != nil { + objectMap["databaseSummary"] = msssdtoml.DatabaseSummary + } + if msssdtoml.MigrationReportResult != nil { + objectMap["migrationReportResult"] = msssdtoml.MigrationReportResult + } + if msssdtoml.SourceServerVersion != nil { + objectMap["sourceServerVersion"] = msssdtoml.SourceServerVersion + } + if msssdtoml.SourceServerBrandVersion != nil { + objectMap["sourceServerBrandVersion"] = msssdtoml.SourceServerBrandVersion + } + if msssdtoml.TargetServerVersion != nil { + objectMap["targetServerVersion"] = msssdtoml.TargetServerVersion + } + if msssdtoml.TargetServerBrandVersion != nil { + objectMap["targetServerBrandVersion"] = msssdtoml.TargetServerBrandVersion + } + if msssdtoml.ExceptionsAndWarnings != nil { + objectMap["exceptionsAndWarnings"] = msssdtoml.ExceptionsAndWarnings + } + if msssdtoml.ID != nil { + objectMap["id"] = msssdtoml.ID + } + if msssdtoml.ResultType != "" { + objectMap["resultType"] = msssdtoml.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { + return &msssdtoml, true +} + +// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputMigrationLevel. +func (msssdtoml MigrateSQLServerSQLDbTaskOutputMigrationLevel) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { + return &msssdtoml, true +} + +// MigrateSQLServerSQLDbTaskOutputTableLevel ... +type MigrateSQLServerSQLDbTaskOutputTableLevel struct { + // ObjectName - Name of the item + ObjectName *string `json:"objectName,omitempty"` + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // StatusMessage - Status message + StatusMessage *string `json:"statusMessage,omitempty"` + // ItemsCount - Number of items + ItemsCount *int64 `json:"itemsCount,omitempty"` + // ItemsCompletedCount - Number of successfully completed items + ItemsCompletedCount *int64 `json:"itemsCompletedCount,omitempty"` + // ErrorPrefix - Wildcard string prefix to use for querying all errors of the item + ErrorPrefix *string `json:"errorPrefix,omitempty"` + // ResultPrefix - Wildcard string prefix to use for querying all sub-tem results of the item + ResultPrefix *string `json:"resultPrefix,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeMigrateSQLServerSQLDbTaskOutput', 'ResultTypeErrorOutput', 'ResultTypeTableLevelOutput', 'ResultTypeDatabaseLevelOutput', 'ResultTypeMigrationLevelOutput' + ResultType ResultType `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) MarshalJSON() ([]byte, error) { + msssdtotl.ResultType = ResultTypeTableLevelOutput + objectMap := make(map[string]interface{}) + if msssdtotl.ObjectName != nil { + objectMap["objectName"] = msssdtotl.ObjectName + } + if msssdtotl.StartedOn != nil { + objectMap["startedOn"] = msssdtotl.StartedOn + } + if msssdtotl.EndedOn != nil { + objectMap["endedOn"] = msssdtotl.EndedOn + } + if msssdtotl.State != "" { + objectMap["state"] = msssdtotl.State + } + if msssdtotl.StatusMessage != nil { + objectMap["statusMessage"] = msssdtotl.StatusMessage + } + if msssdtotl.ItemsCount != nil { + objectMap["itemsCount"] = msssdtotl.ItemsCount + } + if msssdtotl.ItemsCompletedCount != nil { + objectMap["itemsCompletedCount"] = msssdtotl.ItemsCompletedCount + } + if msssdtotl.ErrorPrefix != nil { + objectMap["errorPrefix"] = msssdtotl.ErrorPrefix + } + if msssdtotl.ResultPrefix != nil { + objectMap["resultPrefix"] = msssdtotl.ResultPrefix + } + if msssdtotl.ID != nil { + objectMap["id"] = msssdtotl.ID + } + if msssdtotl.ResultType != "" { + objectMap["resultType"] = msssdtotl.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLDbTaskOutputError is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputError() (*MigrateSQLServerSQLDbTaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputTableLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputTableLevel() (*MigrateSQLServerSQLDbTaskOutputTableLevel, bool) { + return &msssdtotl, true +} + +// AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputDatabaseLevel() (*MigrateSQLServerSQLDbTaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutputMigrationLevel is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutputMigrationLevel() (*MigrateSQLServerSQLDbTaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsMigrateSQLServerSQLDbTaskOutput() (*MigrateSQLServerSQLDbTaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLDbTaskOutput is the BasicMigrateSQLServerSQLDbTaskOutput implementation for MigrateSQLServerSQLDbTaskOutputTableLevel. +func (msssdtotl MigrateSQLServerSQLDbTaskOutputTableLevel) AsBasicMigrateSQLServerSQLDbTaskOutput() (BasicMigrateSQLServerSQLDbTaskOutput, bool) { + return &msssdtotl, true +} + +// MigrateSQLServerSQLDbTaskProperties properties for the task that migrates on-prem SQL Server databases to Azure +// SQL Database +type MigrateSQLServerSQLDbTaskProperties struct { + // Input - Task input + Input *MigrateSQLServerSQLDbTaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]BasicMigrateSQLServerSQLDbTaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) MarshalJSON() ([]byte, error) { + msssdtp.TaskType = TaskTypeMigrateSQLServerSQLDb + objectMap := make(map[string]interface{}) + if msssdtp.Input != nil { + objectMap["input"] = msssdtp.Input + } + if msssdtp.Output != nil { + objectMap["output"] = msssdtp.Output + } + if msssdtp.Errors != nil { + objectMap["errors"] = msssdtp.Errors + } + if msssdtp.State != "" { + objectMap["state"] = msssdtp.State + } + if msssdtp.TaskType != "" { + objectMap["taskType"] = msssdtp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return &msssdtp, true +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLDbTaskProperties. +func (msssdtp MigrateSQLServerSQLDbTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &msssdtp, true +} + +// UnmarshalJSON is the custom unmarshaler for MigrateSQLServerSQLDbTaskProperties struct. +func (msssdtp *MigrateSQLServerSQLDbTaskProperties) 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 "input": + if v != nil { + var input MigrateSQLServerSQLDbTaskInput + err = json.Unmarshal(*v, &input) + if err != nil { + return err + } + msssdtp.Input = &input + } + case "output": + if v != nil { + output, err := unmarshalBasicMigrateSQLServerSQLDbTaskOutputArray(*v) + if err != nil { + return err + } + msssdtp.Output = &output + } + case "errors": + if v != nil { + var errorsVar []ODataError + err = json.Unmarshal(*v, &errorsVar) + if err != nil { + return err + } + msssdtp.Errors = &errorsVar + } + case "state": + if v != nil { + var state TaskState + err = json.Unmarshal(*v, &state) + if err != nil { + return err + } + msssdtp.State = state + } + case "taskType": + if v != nil { + var taskType TaskType + err = json.Unmarshal(*v, &taskType) + if err != nil { + return err + } + msssdtp.TaskType = taskType + } + } + } + + return nil +} + +// MigrateSQLServerSQLMIDatabaseInput database specific information for SQL to Azure SQL DB Managed Instance +// migration task inputs +type MigrateSQLServerSQLMIDatabaseInput struct { + // Name - Name of the database + Name *string `json:"name,omitempty"` + // RestoreDatabaseName - Name of the database at destination + RestoreDatabaseName *string `json:"restoreDatabaseName,omitempty"` + // BackupFileShare - Backup file share information for backing up this database. + BackupFileShare *FileShare `json:"backupFileShare,omitempty"` +} + +// MigrateSQLServerSQLMITaskInput input for task that migrates SQL Server databases to Azure SQL Database Managed +// Instance. +type MigrateSQLServerSQLMITaskInput struct { + // SelectedDatabases - Databases to migrate + SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` + // SelectedLogins - Logins to migrate. + SelectedLogins *[]string `json:"selectedLogins,omitempty"` + // SelectedAgentJobs - Agent Jobs to migrate. + SelectedAgentJobs *[]string `json:"selectedAgentJobs,omitempty"` + // BackupFileShare - Backup file share information for all selected databases. + BackupFileShare *FileShare `json:"backupFileShare,omitempty"` + // BackupBlobShare - SAS URI of Azure Storage Account Container to be used for storing backup files. + BackupBlobShare *BlobShare `json:"backupBlobShare,omitempty"` + // SourceConnectionInfo - Information for connecting to source + SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` + // TargetConnectionInfo - Information for connecting to target + TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` +} + +// BasicMigrateSQLServerSQLMITaskOutput output for task that migrates SQL Server databases to Azure SQL Database +// Managed Instance. +type BasicMigrateSQLServerSQLMITaskOutput interface { + AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) + AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) + AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) + AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) + AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) + AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) +} + +// MigrateSQLServerSQLMITaskOutput output for task that migrates SQL Server databases to Azure SQL Database Managed +// Instance. +type MigrateSQLServerSQLMITaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' + ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` +} + +func unmarshalBasicMigrateSQLServerSQLMITaskOutput(body []byte) (BasicMigrateSQLServerSQLMITaskOutput, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["resultType"] { + case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput): + var msssmtoe MigrateSQLServerSQLMITaskOutputError + err := json.Unmarshal(body, &msssmtoe) + return msssmtoe, err + case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput): + var msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel + err := json.Unmarshal(body, &msssmtoll) + return msssmtoll, err + case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput): + var msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel + err := json.Unmarshal(body, &msssmtoajl) + return msssmtoajl, err + case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput): + var msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel + err := json.Unmarshal(body, &msssmtodl) + return msssmtodl, err + case string(ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput): + var msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel + err := json.Unmarshal(body, &msssmtoml) + return msssmtoml, err + default: + var msssmto MigrateSQLServerSQLMITaskOutput + err := json.Unmarshal(body, &msssmto) + return msssmto, err + } +} +func unmarshalBasicMigrateSQLServerSQLMITaskOutputArray(body []byte) ([]BasicMigrateSQLServerSQLMITaskOutput, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + msssmtoArray := make([]BasicMigrateSQLServerSQLMITaskOutput, len(rawMessages)) + + for index, rawMessage := range rawMessages { + msssmto, err := unmarshalBasicMigrateSQLServerSQLMITaskOutput(*rawMessage) + if err != nil { + return nil, err + } + msssmtoArray[index] = msssmto + } + return msssmtoArray, nil +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) MarshalJSON() ([]byte, error) { + msssmto.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput + objectMap := make(map[string]interface{}) + if msssmto.ID != nil { + objectMap["id"] = msssmto.ID + } + if msssmto.ResultType != "" { + objectMap["resultType"] = msssmto.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { + return &msssmto, true +} + +// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutput. +func (msssmto MigrateSQLServerSQLMITaskOutput) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { + return &msssmto, true +} + +// MigrateSQLServerSQLMITaskOutputAgentJobLevel ... +type MigrateSQLServerSQLMITaskOutputAgentJobLevel struct { + // Name - AgentJob name. + Name *string `json:"name,omitempty"` + // IsEnabled - The state of the original AgentJob. + IsEnabled *bool `json:"isEnabled,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // Message - Migration progress message + Message *string `json:"message,omitempty"` + // ExceptionsAndWarnings - Migration errors and warnings per job + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' + ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) MarshalJSON() ([]byte, error) { + msssmtoajl.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput + objectMap := make(map[string]interface{}) + if msssmtoajl.Name != nil { + objectMap["name"] = msssmtoajl.Name + } + if msssmtoajl.IsEnabled != nil { + objectMap["isEnabled"] = msssmtoajl.IsEnabled + } + if msssmtoajl.State != "" { + objectMap["state"] = msssmtoajl.State + } + if msssmtoajl.StartedOn != nil { + objectMap["startedOn"] = msssmtoajl.StartedOn + } + if msssmtoajl.EndedOn != nil { + objectMap["endedOn"] = msssmtoajl.EndedOn + } + if msssmtoajl.Message != nil { + objectMap["message"] = msssmtoajl.Message + } + if msssmtoajl.ExceptionsAndWarnings != nil { + objectMap["exceptionsAndWarnings"] = msssmtoajl.ExceptionsAndWarnings + } + if msssmtoajl.ID != nil { + objectMap["id"] = msssmtoajl.ID + } + if msssmtoajl.ResultType != "" { + objectMap["resultType"] = msssmtoajl.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { + return &msssmtoajl, true +} + +// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputAgentJobLevel. +func (msssmtoajl MigrateSQLServerSQLMITaskOutputAgentJobLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { + return &msssmtoajl, true +} + +// MigrateSQLServerSQLMITaskOutputDatabaseLevel ... +type MigrateSQLServerSQLMITaskOutputDatabaseLevel struct { + // DatabaseName - Name of the database + DatabaseName *string `json:"databaseName,omitempty"` + // SizeMB - Size of the database in megabytes + SizeMB *float64 `json:"sizeMB,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // Stage - Current stage of migration. Possible values include: 'DatabaseMigrationStageNone', 'DatabaseMigrationStageInitialize', 'DatabaseMigrationStageBackup', 'DatabaseMigrationStageFileCopy', 'DatabaseMigrationStageRestore', 'DatabaseMigrationStageCompleted' + Stage DatabaseMigrationStage `json:"stage,omitempty"` + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // Message - Migration progress message + Message *string `json:"message,omitempty"` + // ExceptionsAndWarnings - Migration exceptions and warnings + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' + ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) MarshalJSON() ([]byte, error) { + msssmtodl.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput + objectMap := make(map[string]interface{}) + if msssmtodl.DatabaseName != nil { + objectMap["databaseName"] = msssmtodl.DatabaseName + } + if msssmtodl.SizeMB != nil { + objectMap["sizeMB"] = msssmtodl.SizeMB + } + if msssmtodl.State != "" { + objectMap["state"] = msssmtodl.State + } + if msssmtodl.Stage != "" { + objectMap["stage"] = msssmtodl.Stage + } + if msssmtodl.StartedOn != nil { + objectMap["startedOn"] = msssmtodl.StartedOn + } + if msssmtodl.EndedOn != nil { + objectMap["endedOn"] = msssmtodl.EndedOn + } + if msssmtodl.Message != nil { + objectMap["message"] = msssmtodl.Message + } + if msssmtodl.ExceptionsAndWarnings != nil { + objectMap["exceptionsAndWarnings"] = msssmtodl.ExceptionsAndWarnings + } + if msssmtodl.ID != nil { + objectMap["id"] = msssmtodl.ID + } + if msssmtodl.ResultType != "" { + objectMap["resultType"] = msssmtodl.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { + return &msssmtodl, true +} + +// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputDatabaseLevel. +func (msssmtodl MigrateSQLServerSQLMITaskOutputDatabaseLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { + return &msssmtodl, true +} + +// MigrateSQLServerSQLMITaskOutputError ... +type MigrateSQLServerSQLMITaskOutputError struct { + // Error - Migration error + Error *ReportableException `json:"error,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' + ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) MarshalJSON() ([]byte, error) { + msssmtoe.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput + objectMap := make(map[string]interface{}) + if msssmtoe.Error != nil { + objectMap["error"] = msssmtoe.Error + } + if msssmtoe.ID != nil { + objectMap["id"] = msssmtoe.ID + } + if msssmtoe.ResultType != "" { + objectMap["resultType"] = msssmtoe.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { + return &msssmtoe, true +} + +// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputError. +func (msssmtoe MigrateSQLServerSQLMITaskOutputError) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { + return &msssmtoe, true +} + +// MigrateSQLServerSQLMITaskOutputLoginLevel ... +type MigrateSQLServerSQLMITaskOutputLoginLevel struct { + // LoginName - Login name. + LoginName *string `json:"loginName,omitempty"` + // State - Current state of login. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // Stage - Current stage of login. Possible values include: 'LoginMigrationStageNone', 'LoginMigrationStageInitialize', 'LoginMigrationStageLoginMigration', 'LoginMigrationStageEstablishUserMapping', 'LoginMigrationStageAssignRoleMembership', 'LoginMigrationStageAssignRoleOwnership', 'LoginMigrationStageEstablishServerPermissions', 'LoginMigrationStageEstablishObjectPermissions', 'LoginMigrationStageCompleted' + Stage LoginMigrationStage `json:"stage,omitempty"` + // StartedOn - Login migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Login migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // Message - Login migration progress message + Message *string `json:"message,omitempty"` + // ExceptionsAndWarnings - Login migration errors and warnings per login + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' + ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) MarshalJSON() ([]byte, error) { + msssmtoll.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput + objectMap := make(map[string]interface{}) + if msssmtoll.LoginName != nil { + objectMap["loginName"] = msssmtoll.LoginName + } + if msssmtoll.State != "" { + objectMap["state"] = msssmtoll.State + } + if msssmtoll.Stage != "" { + objectMap["stage"] = msssmtoll.Stage + } + if msssmtoll.StartedOn != nil { + objectMap["startedOn"] = msssmtoll.StartedOn + } + if msssmtoll.EndedOn != nil { + objectMap["endedOn"] = msssmtoll.EndedOn + } + if msssmtoll.Message != nil { + objectMap["message"] = msssmtoll.Message + } + if msssmtoll.ExceptionsAndWarnings != nil { + objectMap["exceptionsAndWarnings"] = msssmtoll.ExceptionsAndWarnings + } + if msssmtoll.ID != nil { + objectMap["id"] = msssmtoll.ID + } + if msssmtoll.ResultType != "" { + objectMap["resultType"] = msssmtoll.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { + return &msssmtoll, true +} + +// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputLoginLevel. +func (msssmtoll MigrateSQLServerSQLMITaskOutputLoginLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { + return &msssmtoll, true +} + +// MigrateSQLServerSQLMITaskOutputMigrationLevel ... +type MigrateSQLServerSQLMITaskOutputMigrationLevel struct { + // StartedOn - Migration start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Migration end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // Status - Current status of migration. Possible values include: 'MigrationStatusDefault', 'MigrationStatusConnecting', 'MigrationStatusSourceAndTargetSelected', 'MigrationStatusSelectLogins', 'MigrationStatusConfigured', 'MigrationStatusRunning', 'MigrationStatusError', 'MigrationStatusStopped', 'MigrationStatusCompleted', 'MigrationStatusCompletedWithWarnings' + Status MigrationStatus `json:"status,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // AgentJobs - Selected agent jobs as a map from name to id + AgentJobs map[string]*string `json:"agentJobs"` + // Logins - Selected logins as a map from name to id + Logins map[string]*string `json:"logins"` + // Message - Migration progress message + Message *string `json:"message,omitempty"` + // ServerRoleResults - Map of server role migration results. + ServerRoleResults map[string]*StartMigrationScenarioServerRoleResult `json:"serverRoleResults"` + // OrphanedUsers - Map of users to database name of orphaned users. + OrphanedUsers map[string]*string `json:"orphanedUsers"` + // Databases - Selected databases as a map from database name to database id + Databases map[string]*string `json:"databases"` + // SourceServerVersion - Source server version + SourceServerVersion *string `json:"sourceServerVersion,omitempty"` + // SourceServerBrandVersion - Source server brand version + SourceServerBrandVersion *string `json:"sourceServerBrandVersion,omitempty"` + // TargetServerVersion - Target server version + TargetServerVersion *string `json:"targetServerVersion,omitempty"` + // TargetServerBrandVersion - Target server brand version + TargetServerBrandVersion *string `json:"targetServerBrandVersion,omitempty"` + // ExceptionsAndWarnings - Migration exceptions and warnings. + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` + // ID - Result identifier + ID *string `json:"id,omitempty"` + // ResultType - Possible values include: 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrateSQLServerSQLMITaskOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeErrorOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeLoginLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeAgentJobLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeDatabaseLevelOutput', 'ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput' + ResultType ResultTypeBasicMigrateSQLServerSQLMITaskOutput `json:"resultType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) MarshalJSON() ([]byte, error) { + msssmtoml.ResultType = ResultTypeBasicMigrateSQLServerSQLMITaskOutputResultTypeMigrationLevelOutput + objectMap := make(map[string]interface{}) + if msssmtoml.StartedOn != nil { + objectMap["startedOn"] = msssmtoml.StartedOn + } + if msssmtoml.EndedOn != nil { + objectMap["endedOn"] = msssmtoml.EndedOn + } + if msssmtoml.Status != "" { + objectMap["status"] = msssmtoml.Status + } + if msssmtoml.State != "" { + objectMap["state"] = msssmtoml.State + } + if msssmtoml.AgentJobs != nil { + objectMap["agentJobs"] = msssmtoml.AgentJobs + } + if msssmtoml.Logins != nil { + objectMap["logins"] = msssmtoml.Logins + } + if msssmtoml.Message != nil { + objectMap["message"] = msssmtoml.Message + } + if msssmtoml.ServerRoleResults != nil { + objectMap["serverRoleResults"] = msssmtoml.ServerRoleResults + } + if msssmtoml.OrphanedUsers != nil { + objectMap["orphanedUsers"] = msssmtoml.OrphanedUsers + } + if msssmtoml.Databases != nil { + objectMap["databases"] = msssmtoml.Databases + } + if msssmtoml.SourceServerVersion != nil { + objectMap["sourceServerVersion"] = msssmtoml.SourceServerVersion + } + if msssmtoml.SourceServerBrandVersion != nil { + objectMap["sourceServerBrandVersion"] = msssmtoml.SourceServerBrandVersion + } + if msssmtoml.TargetServerVersion != nil { + objectMap["targetServerVersion"] = msssmtoml.TargetServerVersion + } + if msssmtoml.TargetServerBrandVersion != nil { + objectMap["targetServerBrandVersion"] = msssmtoml.TargetServerBrandVersion + } + if msssmtoml.ExceptionsAndWarnings != nil { + objectMap["exceptionsAndWarnings"] = msssmtoml.ExceptionsAndWarnings + } + if msssmtoml.ID != nil { + objectMap["id"] = msssmtoml.ID + } + if msssmtoml.ResultType != "" { + objectMap["resultType"] = msssmtoml.ResultType + } + return json.Marshal(objectMap) +} + +// AsMigrateSQLServerSQLMITaskOutputError is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputError() (*MigrateSQLServerSQLMITaskOutputError, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputLoginLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputLoginLevel() (*MigrateSQLServerSQLMITaskOutputLoginLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputAgentJobLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputAgentJobLevel() (*MigrateSQLServerSQLMITaskOutputAgentJobLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputDatabaseLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputDatabaseLevel() (*MigrateSQLServerSQLMITaskOutputDatabaseLevel, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskOutputMigrationLevel is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutputMigrationLevel() (*MigrateSQLServerSQLMITaskOutputMigrationLevel, bool) { + return &msssmtoml, true +} + +// AsMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsMigrateSQLServerSQLMITaskOutput() (*MigrateSQLServerSQLMITaskOutput, bool) { + return nil, false +} + +// AsBasicMigrateSQLServerSQLMITaskOutput is the BasicMigrateSQLServerSQLMITaskOutput implementation for MigrateSQLServerSQLMITaskOutputMigrationLevel. +func (msssmtoml MigrateSQLServerSQLMITaskOutputMigrationLevel) AsBasicMigrateSQLServerSQLMITaskOutput() (BasicMigrateSQLServerSQLMITaskOutput, bool) { + return &msssmtoml, true +} + +// MigrateSQLServerSQLMITaskProperties properties for task that migrates SQL Server databases to Azure SQL Database +// Managed Instance +type MigrateSQLServerSQLMITaskProperties struct { + // Input - Task input + Input *MigrateSQLServerSQLMITaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]BasicMigrateSQLServerSQLMITaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) MarshalJSON() ([]byte, error) { + msssmtp.TaskType = TaskTypeMigrateSQLServerAzureSQLDbMI + objectMap := make(map[string]interface{}) + if msssmtp.Input != nil { + objectMap["input"] = msssmtp.Input + } + if msssmtp.Output != nil { + objectMap["output"] = msssmtp.Output + } + if msssmtp.Errors != nil { + objectMap["errors"] = msssmtp.Errors + } + if msssmtp.State != "" { + objectMap["state"] = msssmtp.State + } + if msssmtp.TaskType != "" { + objectMap["taskType"] = msssmtp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return &msssmtp, true +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for MigrateSQLServerSQLMITaskProperties. +func (msssmtp MigrateSQLServerSQLMITaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &msssmtp, true +} + +// UnmarshalJSON is the custom unmarshaler for MigrateSQLServerSQLMITaskProperties struct. +func (msssmtp *MigrateSQLServerSQLMITaskProperties) 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 "input": + if v != nil { + var input MigrateSQLServerSQLMITaskInput + err = json.Unmarshal(*v, &input) + if err != nil { + return err + } + msssmtp.Input = &input + } + case "output": + if v != nil { + output, err := unmarshalBasicMigrateSQLServerSQLMITaskOutputArray(*v) + if err != nil { + return err + } + msssmtp.Output = &output + } + case "errors": + if v != nil { + var errorsVar []ODataError + err = json.Unmarshal(*v, &errorsVar) + if err != nil { + return err + } + msssmtp.Errors = &errorsVar + } + case "state": + if v != nil { + var state TaskState + err = json.Unmarshal(*v, &state) + if err != nil { + return err + } + msssmtp.State = state + } + case "taskType": + if v != nil { + var taskType TaskType + err = json.Unmarshal(*v, &taskType) + if err != nil { + return err + } + msssmtp.TaskType = taskType + } + } + } + + return nil +} + +// MigrateSQLServerSQLServerDatabaseInput database specific information for SQL to SQL migration task inputs +type MigrateSQLServerSQLServerDatabaseInput struct { + // Name - Name of the database + Name *string `json:"name,omitempty"` + // RestoreDatabaseName - Name of the database at destination + RestoreDatabaseName *string `json:"restoreDatabaseName,omitempty"` + // BackupFileShare - Backup file share information for this database. + BackupFileShare *FileShare `json:"backupFileShare,omitempty"` + // DatabaseFiles - The list of database files + DatabaseFiles *[]DatabaseFileInput `json:"databaseFiles,omitempty"` +} + +// MigrationEligibilityInfo information about migration eligibility of a server object +type MigrationEligibilityInfo struct { + // IsEligibileForMigration - Whether object is eligible for migration or not. + IsEligibileForMigration *bool `json:"isEligibileForMigration,omitempty"` + // ValidationMessages - Information about eligibility failure for the server object. + ValidationMessages *[]string `json:"validationMessages,omitempty"` +} + +// MigrationReportResult migration validation report result, contains the url for downloading the generated report. +type MigrationReportResult struct { + // ID - Migration validation result identifier + ID *string `json:"id,omitempty"` + // ReportURL - The url of the report. + ReportURL *string `json:"reportUrl,omitempty"` +} + +// MigrationTableMetadata metadata for tables selected in migration project +type MigrationTableMetadata struct { + // SourceTableName - Source table name + SourceTableName *string `json:"sourceTableName,omitempty"` + // TargetTableName - Target table name + TargetTableName *string `json:"targetTableName,omitempty"` +} + +// MigrationValidationDatabaseLevelResult database level validation results +type MigrationValidationDatabaseLevelResult struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // MigrationID - Migration Identifier + MigrationID *string `json:"migrationId,omitempty"` + // SourceDatabaseName - Name of the source database + SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` + // TargetDatabaseName - Name of the target database + TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` + // StartedOn - Validation start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Validation end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // DataIntegrityValidationResult - Provides data integrity validation result between the source and target tables that are migrated. + DataIntegrityValidationResult *DataIntegrityValidationResult `json:"dataIntegrityValidationResult,omitempty"` + // SchemaValidationResult - Provides schema comparison result between source and target database + SchemaValidationResult *SchemaComparisonValidationResult `json:"schemaValidationResult,omitempty"` + // QueryAnalysisValidationResult - Results of some of the query execution result between source and target database + QueryAnalysisValidationResult *QueryAnalysisValidationResult `json:"queryAnalysisValidationResult,omitempty"` + // Status - Current status of validation at the database level. Possible values include: 'ValidationStatusDefault', 'ValidationStatusNotStarted', 'ValidationStatusInitialized', 'ValidationStatusInProgress', 'ValidationStatusCompleted', 'ValidationStatusCompletedWithIssues', 'ValidationStatusFailed', 'ValidationStatusStopped' + Status ValidationStatus `json:"status,omitempty"` +} + +// MigrationValidationDatabaseSummaryResult migration Validation Database level summary result +type MigrationValidationDatabaseSummaryResult struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // MigrationID - Migration Identifier + MigrationID *string `json:"migrationId,omitempty"` + // SourceDatabaseName - Name of the source database + SourceDatabaseName *string `json:"sourceDatabaseName,omitempty"` + // TargetDatabaseName - Name of the target database + TargetDatabaseName *string `json:"targetDatabaseName,omitempty"` + // StartedOn - Validation start time + StartedOn *date.Time `json:"startedOn,omitempty"` + // EndedOn - Validation end time + EndedOn *date.Time `json:"endedOn,omitempty"` + // Status - Current status of validation at the database level. Possible values include: 'ValidationStatusDefault', 'ValidationStatusNotStarted', 'ValidationStatusInitialized', 'ValidationStatusInProgress', 'ValidationStatusCompleted', 'ValidationStatusCompletedWithIssues', 'ValidationStatusFailed', 'ValidationStatusStopped' + Status ValidationStatus `json:"status,omitempty"` +} + +// MigrationValidationOptions types of validations to run after the migration +type MigrationValidationOptions struct { + // EnableSchemaValidation - Allows to compare the schema information between source and target. + EnableSchemaValidation *bool `json:"enableSchemaValidation,omitempty"` + // EnableDataIntegrityValidation - Allows to perform a checksum based data integrity validation between source and target for the selected database / tables . + EnableDataIntegrityValidation *bool `json:"enableDataIntegrityValidation,omitempty"` + // EnableQueryAnalysisValidation - Allows to perform a quick and intelligent query analysis by retrieving queries from the source database and executes them in the target. The result will have execution statistics for executions in source and target databases for the extracted queries. + EnableQueryAnalysisValidation *bool `json:"enableQueryAnalysisValidation,omitempty"` +} + +// MigrationValidationResult migration Validation Result +type MigrationValidationResult struct { + // ID - Migration validation result identifier + ID *string `json:"id,omitempty"` + // MigrationID - Migration Identifier + MigrationID *string `json:"migrationId,omitempty"` + // SummaryResults - Validation summary results for each database + SummaryResults map[string]*MigrationValidationDatabaseSummaryResult `json:"summaryResults"` + // Status - Current status of validation at the migration level. Status from the database validation result status will be aggregated here. Possible values include: 'ValidationStatusDefault', 'ValidationStatusNotStarted', 'ValidationStatusInitialized', 'ValidationStatusInProgress', 'ValidationStatusCompleted', 'ValidationStatusCompletedWithIssues', 'ValidationStatusFailed', 'ValidationStatusStopped' + Status ValidationStatus `json:"status,omitempty"` +} + +// MarshalJSON is the custom marshaler for MigrationValidationResult. +func (mvr MigrationValidationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mvr.ID != nil { + objectMap["id"] = mvr.ID + } + if mvr.MigrationID != nil { + objectMap["migrationId"] = mvr.MigrationID + } + if mvr.SummaryResults != nil { + objectMap["summaryResults"] = mvr.SummaryResults + } + if mvr.Status != "" { + objectMap["status"] = mvr.Status + } + return json.Marshal(objectMap) +} + +// NameAvailabilityRequest a resource type and proposed name +type NameAvailabilityRequest struct { + // Name - The proposed resource name + Name *string `json:"name,omitempty"` + // Type - The resource type chain (e.g. virtualMachines/extensions) + Type *string `json:"type,omitempty"` +} + +// NameAvailabilityResponse indicates whether a proposed resource name is available +type NameAvailabilityResponse struct { + autorest.Response `json:"-"` + // NameAvailable - If true, the name is valid and available. If false, 'reason' describes why not. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Reason - The reason why the name is not available, if nameAvailable is false. Possible values include: 'AlreadyExists', 'Invalid' + Reason NameCheckFailureReason `json:"reason,omitempty"` + // Message - The localized reason why the name is not available, if nameAvailable is false + Message *string `json:"message,omitempty"` +} + +// ODataError error information in OData format. +type ODataError struct { + // Code - The machine-readable description of the error, such as 'InvalidRequest' or 'InternalServerError' + Code *string `json:"code,omitempty"` + // Message - The human-readable description of the error + Message *string `json:"message,omitempty"` + // Details - Inner errors that caused this error + Details *[]ODataError `json:"details,omitempty"` +} + +// Project a project resource +type Project struct { + autorest.Response `json:"-"` + // ProjectProperties - Project properties + *ProjectProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Project. +func (p Project) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProjectProperties != nil { + objectMap["properties"] = p.ProjectProperties + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.ID != nil { + objectMap["id"] = p.ID + } + if p.Name != nil { + objectMap["name"] = p.Name + } + if p.Type != nil { + objectMap["type"] = p.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Project struct. +func (p *Project) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var projectProperties ProjectProperties + err = json.Unmarshal(*v, &projectProperties) + if err != nil { + return err + } + p.ProjectProperties = &projectProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + } + } + + return nil +} + +// ProjectList oData page of project resources +type ProjectList struct { + autorest.Response `json:"-"` + // Value - List of projects + Value *[]Project `json:"value,omitempty"` + // NextLink - URL to load the next page of projects + NextLink *string `json:"nextLink,omitempty"` +} + +// ProjectListIterator provides access to a complete listing of Project values. +type ProjectListIterator struct { + i int + page ProjectListPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProjectListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProjectListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProjectListIterator) Response() ProjectList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProjectListIterator) Value() Project { + if !iter.page.NotDone() { + return Project{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (pl ProjectList) IsEmpty() bool { + return pl.Value == nil || len(*pl.Value) == 0 +} + +// projectListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pl ProjectList) projectListPreparer() (*http.Request, error) { + if pl.NextLink == nil || len(to.String(pl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pl.NextLink))) +} + +// ProjectListPage contains a page of Project values. +type ProjectListPage struct { + fn func(ProjectList) (ProjectList, error) + pl ProjectList +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProjectListPage) Next() error { + next, err := page.fn(page.pl) + if err != nil { + return err + } + page.pl = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProjectListPage) NotDone() bool { + return !page.pl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProjectListPage) Response() ProjectList { + return page.pl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProjectListPage) Values() []Project { + if page.pl.IsEmpty() { + return nil + } + return *page.pl.Value +} + +// ProjectMetadata common metadata for migration projects +type ProjectMetadata struct { + // SourceServerName - Source server name + SourceServerName *string `json:"sourceServerName,omitempty"` + // SourceServerPort - Source server port number + SourceServerPort *string `json:"sourceServerPort,omitempty"` + // SourceUsername - Source username + SourceUsername *string `json:"sourceUsername,omitempty"` + // TargetServerName - Target server name + TargetServerName *string `json:"targetServerName,omitempty"` + // TargetUsername - Target username + TargetUsername *string `json:"targetUsername,omitempty"` + // TargetDbName - Target database name + TargetDbName *string `json:"targetDbName,omitempty"` + // TargetUsingWinAuth - Whether target connection is Windows authentication + TargetUsingWinAuth *bool `json:"targetUsingWinAuth,omitempty"` + // SelectedMigrationTables - List of tables selected for migration + SelectedMigrationTables *[]MigrationTableMetadata `json:"selectedMigrationTables,omitempty"` +} + +// ProjectProperties project-specific properties +type ProjectProperties struct { + // SourcePlatform - Source platform for the project. Possible values include: 'SQL', 'Unknown' + SourcePlatform ProjectSourcePlatform `json:"sourcePlatform,omitempty"` + // TargetPlatform - Target platform for the project. Possible values include: 'ProjectTargetPlatformSQLDB', 'ProjectTargetPlatformSQLMI', 'ProjectTargetPlatformUnknown' + TargetPlatform ProjectTargetPlatform `json:"targetPlatform,omitempty"` + // CreationTime - UTC Date and time when project was created + CreationTime *date.Time `json:"creationTime,omitempty"` + // SourceConnectionInfo - Information for connecting to source + SourceConnectionInfo BasicConnectionInfo `json:"sourceConnectionInfo,omitempty"` + // TargetConnectionInfo - Information for connecting to target + TargetConnectionInfo BasicConnectionInfo `json:"targetConnectionInfo,omitempty"` + // DatabasesInfo - List of DatabaseInfo + DatabasesInfo *[]DatabaseInfo `json:"databasesInfo,omitempty"` + // ProvisioningState - The project's provisioning state. Possible values include: 'Deleting', 'Succeeded' + ProvisioningState ProjectProvisioningState `json:"provisioningState,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ProjectProperties struct. +func (pp *ProjectProperties) 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 "sourcePlatform": + if v != nil { + var sourcePlatform ProjectSourcePlatform + err = json.Unmarshal(*v, &sourcePlatform) + if err != nil { + return err + } + pp.SourcePlatform = sourcePlatform + } + case "targetPlatform": + if v != nil { + var targetPlatform ProjectTargetPlatform + err = json.Unmarshal(*v, &targetPlatform) + if err != nil { + return err + } + pp.TargetPlatform = targetPlatform + } + case "creationTime": + if v != nil { + var creationTime date.Time + err = json.Unmarshal(*v, &creationTime) + if err != nil { + return err + } + pp.CreationTime = &creationTime + } + case "sourceConnectionInfo": + if v != nil { + sourceConnectionInfo, err := unmarshalBasicConnectionInfo(*v) + if err != nil { + return err + } + pp.SourceConnectionInfo = sourceConnectionInfo + } + case "targetConnectionInfo": + if v != nil { + targetConnectionInfo, err := unmarshalBasicConnectionInfo(*v) + if err != nil { + return err + } + pp.TargetConnectionInfo = targetConnectionInfo + } + case "databasesInfo": + if v != nil { + var databasesInfo []DatabaseInfo + err = json.Unmarshal(*v, &databasesInfo) + if err != nil { + return err + } + pp.DatabasesInfo = &databasesInfo + } + case "provisioningState": + if v != nil { + var provisioningState ProjectProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + pp.ProvisioningState = provisioningState + } + } + } + + return nil +} + +// ProjectTask a task resource +type ProjectTask struct { + autorest.Response `json:"-"` + // Etag - HTTP strong entity tag value. This is ignored if submitted. + Etag *string `json:"etag,omitempty"` + // Properties - Custom task properties + Properties BasicProjectTaskProperties `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for ProjectTask struct. +func (pt *ProjectTask) 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 "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pt.Etag = &etag + } + case "properties": + if v != nil { + properties, err := unmarshalBasicProjectTaskProperties(*v) + if err != nil { + return err + } + pt.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pt.Type = &typeVar + } + } + } + + return nil +} + +// BasicProjectTaskProperties base class for all types of DMS task properties. If task is not supported by current +// client, this object is returned. +type BasicProjectTaskProperties interface { + AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) + AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) + AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) + AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) + AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) + AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) + AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) + AsProjectTaskProperties() (*ProjectTaskProperties, bool) +} + +// ProjectTaskProperties base class for all types of DMS task properties. If task is not supported by current +// client, this object is returned. +type ProjectTaskProperties struct { + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +func unmarshalBasicProjectTaskProperties(body []byte) (BasicProjectTaskProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["taskType"] { + case string(TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI): + var vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties + err := json.Unmarshal(body, &vmisssmtp) + return vmisssmtp, err + case string(TaskTypeMigrateSQLServerSQLDb): + var msssdtp MigrateSQLServerSQLDbTaskProperties + err := json.Unmarshal(body, &msssdtp) + return msssdtp, err + case string(TaskTypeMigrateSQLServerAzureSQLDbMI): + var msssmtp MigrateSQLServerSQLMITaskProperties + err := json.Unmarshal(body, &msssmtp) + return msssmtp, err + case string(TaskTypeGetUserTablesSQL): + var gutstp GetUserTablesSQLTaskProperties + err := json.Unmarshal(body, &gutstp) + return gutstp, err + case string(TaskTypeConnectToTargetSQLDb): + var cttsdtp ConnectToTargetSQLDbTaskProperties + err := json.Unmarshal(body, &cttsdtp) + return cttsdtp, err + case string(TaskTypeConnectToTargetAzureSQLDbMI): + var cttsmtp ConnectToTargetSQLMITaskProperties + err := json.Unmarshal(body, &cttsmtp) + return cttsmtp, err + case string(TaskTypeConnectToSourceSQLServer): + var ctssstp ConnectToSourceSQLServerTaskProperties + err := json.Unmarshal(body, &ctssstp) + return ctssstp, err + default: + var ptp ProjectTaskProperties + err := json.Unmarshal(body, &ptp) + return ptp, err + } +} +func unmarshalBasicProjectTaskPropertiesArray(body []byte) ([]BasicProjectTaskProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ptpArray := make([]BasicProjectTaskProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ptp, err := unmarshalBasicProjectTaskProperties(*rawMessage) + if err != nil { + return nil, err + } + ptpArray[index] = ptp + } + return ptpArray, nil +} + +// MarshalJSON is the custom marshaler for ProjectTaskProperties. +func (ptp ProjectTaskProperties) MarshalJSON() ([]byte, error) { + ptp.TaskType = TaskTypeUnknown + objectMap := make(map[string]interface{}) + if ptp.Errors != nil { + objectMap["errors"] = ptp.Errors + } + if ptp.State != "" { + objectMap["state"] = ptp.State + } + if ptp.TaskType != "" { + objectMap["taskType"] = ptp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return &ptp, true +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ProjectTaskProperties. +func (ptp ProjectTaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &ptp, true +} + +// QueryAnalysisValidationResult results for query analysis comparison between the source and target +type QueryAnalysisValidationResult struct { + // QueryResults - List of queries executed and it's execution results in source and target + QueryResults *QueryExecutionResult `json:"queryResults,omitempty"` + // ValidationErrors - Errors that are part of the execution + ValidationErrors *ValidationError `json:"validationErrors,omitempty"` +} + +// QueryExecutionResult describes query analysis results for execution in source and target +type QueryExecutionResult struct { + // QueryText - Query text retrieved from the source server + QueryText *string `json:"queryText,omitempty"` + // StatementsInBatch - Total no. of statements in the batch + StatementsInBatch *int64 `json:"statementsInBatch,omitempty"` + // SourceResult - Query analysis result from the source + SourceResult *ExecutionStatistics `json:"sourceResult,omitempty"` + // TargetResult - Query analysis result from the target + TargetResult *ExecutionStatistics `json:"targetResult,omitempty"` +} + +// Quota describes a quota for or usage details about a resource +type Quota struct { + // CurrentValue - The current value of the quota. If null or missing, the current value cannot be determined in the context of the request. + CurrentValue *float64 `json:"currentValue,omitempty"` + // ID - The resource ID of the quota object + ID *string `json:"id,omitempty"` + // Limit - The maximum value of the quota. If null or missing, the quota has no maximum, in which case it merely tracks usage. + Limit *float64 `json:"limit,omitempty"` + // Name - The name of the quota + Name *QuotaName `json:"name,omitempty"` + // Unit - The unit for the quota, such as Count, Bytes, BytesPerSecond, etc. + Unit *string `json:"unit,omitempty"` +} + +// QuotaList oData page of quota objects +type QuotaList struct { + autorest.Response `json:"-"` + // Value - List of quotas + Value *[]Quota `json:"value,omitempty"` + // NextLink - URL to load the next page of quotas, or null or missing if this is the last page + NextLink *string `json:"nextLink,omitempty"` +} + +// QuotaListIterator provides access to a complete listing of Quota values. +type QuotaListIterator struct { + i int + page QuotaListPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *QuotaListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter QuotaListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter QuotaListIterator) Response() QuotaList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter QuotaListIterator) Value() Quota { + if !iter.page.NotDone() { + return Quota{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (ql QuotaList) IsEmpty() bool { + return ql.Value == nil || len(*ql.Value) == 0 +} + +// quotaListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ql QuotaList) quotaListPreparer() (*http.Request, error) { + if ql.NextLink == nil || len(to.String(ql.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ql.NextLink))) +} + +// QuotaListPage contains a page of Quota values. +type QuotaListPage struct { + fn func(QuotaList) (QuotaList, error) + ql QuotaList +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *QuotaListPage) Next() error { + next, err := page.fn(page.ql) + if err != nil { + return err + } + page.ql = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page QuotaListPage) NotDone() bool { + return !page.ql.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page QuotaListPage) Response() QuotaList { + return page.ql +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page QuotaListPage) Values() []Quota { + if page.ql.IsEmpty() { + return nil + } + return *page.ql.Value +} + +// QuotaName the name of the quota +type QuotaName struct { + // LocalizedValue - The localized name of the quota + LocalizedValue *string `json:"localizedValue,omitempty"` + // Value - The unlocalized name (or ID) of the quota + Value *string `json:"value,omitempty"` +} + +// ReportableException exception object for all custom exceptions +type ReportableException struct { + // Message - Error message + Message *string `json:"message,omitempty"` + // FilePath - The path to the file where exception occurred + FilePath *string `json:"filePath,omitempty"` + // LineNumber - The line number where exception occurred + LineNumber *string `json:"lineNumber,omitempty"` + // HResult - Coded numerical value that is assigned to a specific exception + HResult *int32 `json:"hResult,omitempty"` + // StackTrace - Stack trace + StackTrace *string `json:"stackTrace,omitempty"` +} + +// Resource ARM resource. +type Resource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// ResourceSku describes an available DMS SKU. +type ResourceSku struct { + // ResourceType - The type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - The name of SKU. + Name *string `json:"name,omitempty"` + // Tier - Specifies the tier of DMS in a scale set. + Tier *string `json:"tier,omitempty"` + // Size - The Size of the SKU. + Size *string `json:"size,omitempty"` + // Family - The Family of this particular SKU. + Family *string `json:"family,omitempty"` + // Kind - The Kind of resources that are supported in this SKU. + Kind *string `json:"kind,omitempty"` + // Capacity - Not used. + Capacity *ResourceSkuCapacity `json:"capacity,omitempty"` + // Locations - The set of locations that the SKU is available. + Locations *[]string `json:"locations,omitempty"` + // APIVersions - The api versions that support this SKU. + APIVersions *[]string `json:"apiVersions,omitempty"` + // Costs - Metadata for retrieving price info. + Costs *[]ResourceSkuCosts `json:"costs,omitempty"` + // Capabilities - A name value pair to describe the capability. + Capabilities *[]ResourceSkuCapabilities `json:"capabilities,omitempty"` + // Restrictions - The restrictions because of which SKU cannot be used. This is empty if there are no restrictions. + Restrictions *[]ResourceSkuRestrictions `json:"restrictions,omitempty"` +} + +// ResourceSkuCapabilities describes The SKU capabilites object. +type ResourceSkuCapabilities struct { + // Name - An invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - An invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// ResourceSkuCapacity describes scaling information of a SKU. +type ResourceSkuCapacity struct { + // Minimum - The minimum capacity. + Minimum *int64 `json:"minimum,omitempty"` + // Maximum - The maximum capacity. + Maximum *int64 `json:"maximum,omitempty"` + // Default - The default capacity. + Default *int64 `json:"default,omitempty"` + // ScaleType - The scale type applicable to the SKU. Possible values include: 'ResourceSkuCapacityScaleTypeAutomatic', 'ResourceSkuCapacityScaleTypeManual', 'ResourceSkuCapacityScaleTypeNone' + ScaleType ResourceSkuCapacityScaleType `json:"scaleType,omitempty"` +} + +// ResourceSkuCosts describes metadata for retrieving price info. +type ResourceSkuCosts struct { + // MeterID - Used for querying price from commerce. + MeterID *string `json:"meterID,omitempty"` + // Quantity - The multiplier is needed to extend the base metered cost. + Quantity *int64 `json:"quantity,omitempty"` + // ExtendedUnit - An invariant to show the extended unit. + ExtendedUnit *string `json:"extendedUnit,omitempty"` +} + +// ResourceSkuRestrictions describes scaling information of a SKU. +type ResourceSkuRestrictions struct { + // Type - The type of restrictions. Possible values include: 'Location' + Type ResourceSkuRestrictionsType `json:"type,omitempty"` + // Values - The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // ReasonCode - The reason code for restriction. Possible values include: 'QuotaID', 'NotAvailableForSubscription' + ReasonCode ResourceSkuRestrictionsReasonCode `json:"reasonCode,omitempty"` +} + +// ResourceSkusResult the DMS List SKUs operation response. +type ResourceSkusResult struct { + autorest.Response `json:"-"` + // Value - The list of SKUs available for the subscription. + Value *[]ResourceSku `json:"value,omitempty"` + // NextLink - The uri to fetch the next page of DMS SKUs. Call ListNext() with this to fetch the next page of DMS SKUs. + NextLink *string `json:"nextLink,omitempty"` +} + +// ResourceSkusResultIterator provides access to a complete listing of ResourceSku values. +type ResourceSkusResultIterator struct { + i int + page ResourceSkusResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceSkusResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceSkusResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceSkusResultIterator) Response() ResourceSkusResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceSkusResultIterator) Value() ResourceSku { + if !iter.page.NotDone() { + return ResourceSku{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (rsr ResourceSkusResult) IsEmpty() bool { + return rsr.Value == nil || len(*rsr.Value) == 0 +} + +// resourceSkusResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rsr ResourceSkusResult) resourceSkusResultPreparer() (*http.Request, error) { + if rsr.NextLink == nil || len(to.String(rsr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rsr.NextLink))) +} + +// ResourceSkusResultPage contains a page of ResourceSku values. +type ResourceSkusResultPage struct { + fn func(ResourceSkusResult) (ResourceSkusResult, error) + rsr ResourceSkusResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceSkusResultPage) Next() error { + next, err := page.fn(page.rsr) + if err != nil { + return err + } + page.rsr = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceSkusResultPage) NotDone() bool { + return !page.rsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceSkusResultPage) Response() ResourceSkusResult { + return page.rsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceSkusResultPage) Values() []ResourceSku { + if page.rsr.IsEmpty() { + return nil + } + return *page.rsr.Value +} + +// SchemaComparisonValidationResult results for schema comparison between the source and target +type SchemaComparisonValidationResult struct { + // SchemaDifferences - List of schema differences between the source and target databases + SchemaDifferences *SchemaComparisonValidationResultType `json:"schemaDifferences,omitempty"` + // ValidationErrors - List of errors that happened while performing schema compare validation + ValidationErrors *ValidationError `json:"validationErrors,omitempty"` + // SourceDatabaseObjectCount - Count of source database objects + SourceDatabaseObjectCount map[string]*int64 `json:"sourceDatabaseObjectCount"` + // TargetDatabaseObjectCount - Count of target database objects + TargetDatabaseObjectCount map[string]*int64 `json:"targetDatabaseObjectCount"` +} + +// MarshalJSON is the custom marshaler for SchemaComparisonValidationResult. +func (scvr SchemaComparisonValidationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scvr.SchemaDifferences != nil { + objectMap["schemaDifferences"] = scvr.SchemaDifferences + } + if scvr.ValidationErrors != nil { + objectMap["validationErrors"] = scvr.ValidationErrors + } + if scvr.SourceDatabaseObjectCount != nil { + objectMap["sourceDatabaseObjectCount"] = scvr.SourceDatabaseObjectCount + } + if scvr.TargetDatabaseObjectCount != nil { + objectMap["targetDatabaseObjectCount"] = scvr.TargetDatabaseObjectCount + } + return json.Marshal(objectMap) +} + +// SchemaComparisonValidationResultType description about the errors happen while performing migration validation +type SchemaComparisonValidationResultType struct { + // ObjectName - Name of the object that has the difference + ObjectName *string `json:"objectName,omitempty"` + // ObjectType - Type of the object that has the difference. e.g (Table/View/StoredProcedure). Possible values include: 'StoredProcedures', 'Table', 'User', 'View', 'Function' + ObjectType ObjectType `json:"objectType,omitempty"` + // UpdateAction - Update action type with respect to target. Possible values include: 'DeletedOnTarget', 'ChangedOnTarget', 'AddedOnTarget' + UpdateAction UpdateActionType `json:"updateAction,omitempty"` +} + +// Service a Data Migration Service resource +type Service struct { + autorest.Response `json:"-"` + // Etag - HTTP strong entity tag value. Ignored if submitted + Etag *string `json:"etag,omitempty"` + // Kind - The resource kind. Only 'vm' (the default) is supported. + Kind *string `json:"kind,omitempty"` + // ServiceProperties - Custom service properties + *ServiceProperties `json:"properties,omitempty"` + // Sku - Service SKU + Sku *ServiceSku `json:"sku,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Service. +func (s Service) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.Etag != nil { + objectMap["etag"] = s.Etag + } + if s.Kind != nil { + objectMap["kind"] = s.Kind + } + if s.ServiceProperties != nil { + objectMap["properties"] = s.ServiceProperties + } + if s.Sku != nil { + objectMap["sku"] = s.Sku + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + if s.Location != nil { + objectMap["location"] = s.Location + } + if s.ID != nil { + objectMap["id"] = s.ID + } + if s.Name != nil { + objectMap["name"] = s.Name + } + if s.Type != nil { + objectMap["type"] = s.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Service struct. +func (s *Service) 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 "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + s.Etag = &etag + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + s.Kind = &kind + } + case "properties": + if v != nil { + var serviceProperties ServiceProperties + err = json.Unmarshal(*v, &serviceProperties) + if err != nil { + return err + } + s.ServiceProperties = &serviceProperties + } + case "sku": + if v != nil { + var sku ServiceSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + s.Sku = &sku + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// ServiceList oData page of service objects +type ServiceList struct { + autorest.Response `json:"-"` + // Value - List of services + Value *[]Service `json:"value,omitempty"` + // NextLink - URL to load the next page of services + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceListIterator provides access to a complete listing of Service values. +type ServiceListIterator struct { + i int + page ServiceListPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceListIterator) Response() ServiceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceListIterator) Value() Service { + if !iter.page.NotDone() { + return Service{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl ServiceList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// serviceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl ServiceList) serviceListPreparer() (*http.Request, error) { + if sl.NextLink == nil || len(to.String(sl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// ServiceListPage contains a page of Service values. +type ServiceListPage struct { + fn func(ServiceList) (ServiceList, error) + sl ServiceList +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceListPage) Next() error { + next, err := page.fn(page.sl) + if err != nil { + return err + } + page.sl = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceListPage) Response() ServiceList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceListPage) Values() []Service { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// ServiceOperation description of an action supported by the Data Migration Service +type ServiceOperation struct { + // Name - The fully qualified action name, e.g. Microsoft.DataMigration/services/read + Name *string `json:"name,omitempty"` + // Display - Localized display text + Display *ServiceOperationDisplay `json:"display,omitempty"` +} + +// ServiceOperationDisplay localized display text +type ServiceOperationDisplay struct { + // Provider - The localized resource provider name + Provider *string `json:"provider,omitempty"` + // Resource - The localized resource type name + Resource *string `json:"resource,omitempty"` + // Operation - The localized operation name + Operation *string `json:"operation,omitempty"` + // Description - The localized operation description + Description *string `json:"description,omitempty"` +} + +// ServiceOperationList oData page of action (operation) objects +type ServiceOperationList struct { + autorest.Response `json:"-"` + // Value - List of actions + Value *[]ServiceOperation `json:"value,omitempty"` + // NextLink - URL to load the next page of actions + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceOperationListIterator provides access to a complete listing of ServiceOperation values. +type ServiceOperationListIterator struct { + i int + page ServiceOperationListPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceOperationListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceOperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceOperationListIterator) Response() ServiceOperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceOperationListIterator) Value() ServiceOperation { + if !iter.page.NotDone() { + return ServiceOperation{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (sol ServiceOperationList) IsEmpty() bool { + return sol.Value == nil || len(*sol.Value) == 0 +} + +// serviceOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sol ServiceOperationList) serviceOperationListPreparer() (*http.Request, error) { + if sol.NextLink == nil || len(to.String(sol.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sol.NextLink))) +} + +// ServiceOperationListPage contains a page of ServiceOperation values. +type ServiceOperationListPage struct { + fn func(ServiceOperationList) (ServiceOperationList, error) + sol ServiceOperationList +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceOperationListPage) Next() error { + next, err := page.fn(page.sol) + if err != nil { + return err + } + page.sol = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceOperationListPage) NotDone() bool { + return !page.sol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceOperationListPage) Response() ServiceOperationList { + return page.sol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceOperationListPage) Values() []ServiceOperation { + if page.sol.IsEmpty() { + return nil + } + return *page.sol.Value +} + +// ServiceProperties properties of the Data Migration service instance +type ServiceProperties struct { + // ProvisioningState - The resource's provisioning state. Possible values include: 'ServiceProvisioningStateAccepted', 'ServiceProvisioningStateDeleting', 'ServiceProvisioningStateDeploying', 'ServiceProvisioningStateStopped', 'ServiceProvisioningStateStopping', 'ServiceProvisioningStateStarting', 'ServiceProvisioningStateFailedToStart', 'ServiceProvisioningStateFailedToStop', 'ServiceProvisioningStateSucceeded', 'ServiceProvisioningStateFailed' + ProvisioningState ServiceProvisioningState `json:"provisioningState,omitempty"` + // PublicKey - The public key of the service, used to encrypt secrets sent to the service + PublicKey *string `json:"publicKey,omitempty"` + // VirtualSubnetID - The ID of the Microsoft.Network/virtualNetworks/subnets resource to which the service should be joined + VirtualSubnetID *string `json:"virtualSubnetId,omitempty"` +} + +// ServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ServicesCreateOrUpdateFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future ServicesCreateOrUpdateFuture) Result(client ServicesClient) (s Service, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return s, azure.NewAsyncOpIncompleteError("datamigration.ServicesCreateOrUpdateFuture") + } + if future.PollingMethod() == azure.PollingLocation { + s, err = client.CreateOrUpdateResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesCreateOrUpdateFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesCreateOrUpdateFuture", "Result", resp, "Failure sending request") + return + } + s, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesCreateOrUpdateFuture", "Result", resp, "Failure responding to request") + } + return +} + +// ServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServicesDeleteFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future ServicesDeleteFuture) Result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("datamigration.ServicesDeleteFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.DeleteResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesDeleteFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesDeleteFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesDeleteFuture", "Result", resp, "Failure responding to request") + } + return +} + +// ServiceSku an Azure SKU instance +type ServiceSku struct { + // Name - The unique name of the SKU, such as 'P3' + Name *string `json:"name,omitempty"` + // Tier - The tier of the SKU, such as 'Free', 'Basic', 'Standard', or 'Premium' + Tier *string `json:"tier,omitempty"` + // Family - The SKU family, used when the service has multiple performance classes within a tier, such as 'A', 'D', etc. for virtual machines + Family *string `json:"family,omitempty"` + // Size - The size of the SKU, used when the name alone does not denote a service size or when a SKU has multiple performance classes within a family, e.g. 'A1' for virtual machines + Size *string `json:"size,omitempty"` + // Capacity - The capacity of the SKU, if it supports scaling + Capacity *int32 `json:"capacity,omitempty"` +} + +// ServiceSkuList oData page of available SKUs +type ServiceSkuList struct { + autorest.Response `json:"-"` + // Value - List of service SKUs + Value *[]AvailableServiceSku `json:"value,omitempty"` + // NextLink - URL to load the next page of service SKUs + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceSkuListIterator provides access to a complete listing of AvailableServiceSku values. +type ServiceSkuListIterator struct { + i int + page ServiceSkuListPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceSkuListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceSkuListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceSkuListIterator) Response() ServiceSkuList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceSkuListIterator) Value() AvailableServiceSku { + if !iter.page.NotDone() { + return AvailableServiceSku{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (ssl ServiceSkuList) IsEmpty() bool { + return ssl.Value == nil || len(*ssl.Value) == 0 +} + +// serviceSkuListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ssl ServiceSkuList) serviceSkuListPreparer() (*http.Request, error) { + if ssl.NextLink == nil || len(to.String(ssl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ssl.NextLink))) +} + +// ServiceSkuListPage contains a page of AvailableServiceSku values. +type ServiceSkuListPage struct { + fn func(ServiceSkuList) (ServiceSkuList, error) + ssl ServiceSkuList +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceSkuListPage) Next() error { + next, err := page.fn(page.ssl) + if err != nil { + return err + } + page.ssl = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceSkuListPage) NotDone() bool { + return !page.ssl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceSkuListPage) Response() ServiceSkuList { + return page.ssl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceSkuListPage) Values() []AvailableServiceSku { + if page.ssl.IsEmpty() { + return nil + } + return *page.ssl.Value +} + +// ServicesStartFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServicesStartFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future ServicesStartFuture) Result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("datamigration.ServicesStartFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.StartResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStartFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStartFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStartFuture", "Result", resp, "Failure responding to request") + } + return +} + +// ServicesStopFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServicesStopFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future ServicesStopFuture) Result(client ServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("datamigration.ServicesStopFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.StopResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStopFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStopFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesStopFuture", "Result", resp, "Failure responding to request") + } + return +} + +// ServiceStatusResponse service health status +type ServiceStatusResponse struct { + autorest.Response `json:"-"` + // AgentVersion - The DMS instance agent version + AgentVersion *string `json:"agentVersion,omitempty"` + // Status - The machine-readable status, such as 'Initializing', 'Offline', 'Online', 'Deploying', 'Deleting', 'Stopped', 'Stopping', 'Starting', 'FailedToStart', 'FailedToStop' or 'Failed' + Status *string `json:"status,omitempty"` + // VMSize - The services virtual machine size, such as 'Standard_D2_v2' + VMSize *string `json:"vmSize,omitempty"` + // SupportedTaskTypes - The list of supported task types + SupportedTaskTypes *[]string `json:"supportedTaskTypes,omitempty"` +} + +// ServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ServicesUpdateFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future ServicesUpdateFuture) Result(client ServicesClient) (s Service, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return s, azure.NewAsyncOpIncompleteError("datamigration.ServicesUpdateFuture") + } + if future.PollingMethod() == azure.PollingLocation { + s, err = client.UpdateResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesUpdateFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesUpdateFuture", "Result", resp, "Failure sending request") + return + } + s, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesUpdateFuture", "Result", resp, "Failure responding to request") + } + return +} + +// SQLConnectionInfo information for connecting to SQL database server +type SQLConnectionInfo struct { + // DataSource - Data source in the format Protocol:MachineName\SQLServerInstanceName,PortNumber + DataSource *string `json:"dataSource,omitempty"` + // Authentication - Authentication type to use for connection. Possible values include: 'None', 'WindowsAuthentication', 'SQLAuthentication', 'ActiveDirectoryIntegrated', 'ActiveDirectoryPassword' + Authentication AuthenticationType `json:"authentication,omitempty"` + // EncryptConnection - Whether to encrypt the connection + EncryptConnection *bool `json:"encryptConnection,omitempty"` + // AdditionalSettings - Additional connection settings + AdditionalSettings *string `json:"additionalSettings,omitempty"` + // TrustServerCertificate - Whether to trust the server certificate + TrustServerCertificate *bool `json:"trustServerCertificate,omitempty"` + // UserName - User name + UserName *string `json:"userName,omitempty"` + // Password - Password credential. + Password *string `json:"password,omitempty"` + // Type - Possible values include: 'TypeUnknown', 'TypeSQLConnectionInfo' + Type Type `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SQLConnectionInfo. +func (sci SQLConnectionInfo) MarshalJSON() ([]byte, error) { + sci.Type = TypeSQLConnectionInfo + objectMap := make(map[string]interface{}) + if sci.DataSource != nil { + objectMap["dataSource"] = sci.DataSource + } + if sci.Authentication != "" { + objectMap["authentication"] = sci.Authentication + } + if sci.EncryptConnection != nil { + objectMap["encryptConnection"] = sci.EncryptConnection + } + if sci.AdditionalSettings != nil { + objectMap["additionalSettings"] = sci.AdditionalSettings + } + if sci.TrustServerCertificate != nil { + objectMap["trustServerCertificate"] = sci.TrustServerCertificate + } + if sci.UserName != nil { + objectMap["userName"] = sci.UserName + } + if sci.Password != nil { + objectMap["password"] = sci.Password + } + if sci.Type != "" { + objectMap["type"] = sci.Type + } + return json.Marshal(objectMap) +} + +// AsSQLConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. +func (sci SQLConnectionInfo) AsSQLConnectionInfo() (*SQLConnectionInfo, bool) { + return &sci, true +} + +// AsConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. +func (sci SQLConnectionInfo) AsConnectionInfo() (*ConnectionInfo, bool) { + return nil, false +} + +// AsBasicConnectionInfo is the BasicConnectionInfo implementation for SQLConnectionInfo. +func (sci SQLConnectionInfo) AsBasicConnectionInfo() (BasicConnectionInfo, bool) { + return &sci, true +} + +// SQLMigrationTaskInput base class for migration task input +type SQLMigrationTaskInput struct { + // SourceConnectionInfo - Information for connecting to source + SourceConnectionInfo *SQLConnectionInfo `json:"sourceConnectionInfo,omitempty"` + // TargetConnectionInfo - Information for connecting to target + TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` +} + +// StartMigrationScenarioServerRoleResult ... +type StartMigrationScenarioServerRoleResult struct { + // Name - Name of server role. + Name *string `json:"name,omitempty"` + // State - Current state of migration. Possible values include: 'MigrationStateNone', 'MigrationStateInProgress', 'MigrationStateFailed', 'MigrationStateWarning', 'MigrationStateCompleted', 'MigrationStateSkipped', 'MigrationStateStopped' + State MigrationState `json:"state,omitempty"` + // ExceptionsAndWarnings - Migration exceptions and warnings. + ExceptionsAndWarnings *[]ReportableException `json:"exceptionsAndWarnings,omitempty"` +} + +// TaskList oData page of tasks +type TaskList struct { + autorest.Response `json:"-"` + // Value - List of tasks + Value *[]ProjectTask `json:"value,omitempty"` + // NextLink - URL to load the next page of tasks + NextLink *string `json:"nextLink,omitempty"` +} + +// TaskListIterator provides access to a complete listing of ProjectTask values. +type TaskListIterator struct { + i int + page TaskListPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TaskListIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TaskListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TaskListIterator) Response() TaskList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TaskListIterator) Value() ProjectTask { + if !iter.page.NotDone() { + return ProjectTask{} + } + return iter.page.Values()[iter.i] +} + +// IsEmpty returns true if the ListResult contains no values. +func (tl TaskList) IsEmpty() bool { + return tl.Value == nil || len(*tl.Value) == 0 +} + +// taskListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tl TaskList) taskListPreparer() (*http.Request, error) { + if tl.NextLink == nil || len(to.String(tl.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tl.NextLink))) +} + +// TaskListPage contains a page of ProjectTask values. +type TaskListPage struct { + fn func(TaskList) (TaskList, error) + tl TaskList +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TaskListPage) Next() error { + next, err := page.fn(page.tl) + if err != nil { + return err + } + page.tl = next + return nil +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TaskListPage) NotDone() bool { + return !page.tl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TaskListPage) Response() TaskList { + return page.tl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TaskListPage) Values() []ProjectTask { + if page.tl.IsEmpty() { + return nil + } + return *page.tl.Value +} + +// TrackedResource ARM tracked top level resource. +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + if tr.ID != nil { + objectMap["id"] = tr.ID + } + if tr.Name != nil { + objectMap["name"] = tr.Name + } + if tr.Type != nil { + objectMap["type"] = tr.Type + } + return json.Marshal(objectMap) +} + +// ValidateMigrationInputSQLServerSQLMITaskInput input for task that validates migration input for SQL to Azure SQL +// Managed Instance +type ValidateMigrationInputSQLServerSQLMITaskInput struct { + // TargetConnectionInfo - Information for connecting to target + TargetConnectionInfo *SQLConnectionInfo `json:"targetConnectionInfo,omitempty"` + // SelectedDatabases - Databases to migrate + SelectedDatabases *[]MigrateSQLServerSQLMIDatabaseInput `json:"selectedDatabases,omitempty"` + // BackupFileShare - Backup file share information for all selected databases. + BackupFileShare *FileShare `json:"backupFileShare,omitempty"` + // BackupBlobShare - SAS URI of Azure Storage Account Container to be used for storing backup files. + BackupBlobShare *BlobShare `json:"backupBlobShare,omitempty"` +} + +// ValidateMigrationInputSQLServerSQLMITaskOutput output for task that validates migration input for SQL to Azure +// SQL Managed Instance migrations +type ValidateMigrationInputSQLServerSQLMITaskOutput struct { + // ID - Result identifier + ID *string `json:"id,omitempty"` + // Name - Name of database + Name *string `json:"name,omitempty"` + // RestoreDatabaseNameErrors - Errors associated with the RestoreDatabaseName + RestoreDatabaseNameErrors *[]ReportableException `json:"restoreDatabaseNameErrors,omitempty"` + // BackupFolderErrors - Errors associated with the BackupFolder path + BackupFolderErrors *[]ReportableException `json:"backupFolderErrors,omitempty"` + // BackupShareCredentialsErrors - Errors associated with backup share user name and password credentials + BackupShareCredentialsErrors *[]ReportableException `json:"backupShareCredentialsErrors,omitempty"` + // BackupStorageAccountErrors - Errors associated with the storage account provided. + BackupStorageAccountErrors *[]ReportableException `json:"backupStorageAccountErrors,omitempty"` +} + +// ValidateMigrationInputSQLServerSQLMITaskProperties properties for task that validates migration input for SQL to +// Azure SQL Database Managed Instance +type ValidateMigrationInputSQLServerSQLMITaskProperties struct { + // Input - Task input + Input *ValidateMigrationInputSQLServerSQLMITaskInput `json:"input,omitempty"` + // Output - Task output. This is ignored if submitted. + Output *[]ValidateMigrationInputSQLServerSQLMITaskOutput `json:"output,omitempty"` + // Errors - Array of errors. This is ignored if submitted. + Errors *[]ODataError `json:"errors,omitempty"` + // State - The state of the task. This is ignored if submitted. Possible values include: 'TaskStateUnknown', 'TaskStateQueued', 'TaskStateRunning', 'TaskStateCanceled', 'TaskStateSucceeded', 'TaskStateFailed', 'TaskStateFailedInputValidation', 'TaskStateFaulted' + State TaskState `json:"state,omitempty"` + // TaskType - Possible values include: 'TaskTypeUnknown', 'TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI', 'TaskTypeMigrateSQLServerSQLDb', 'TaskTypeMigrateSQLServerAzureSQLDbMI', 'TaskTypeGetUserTablesSQL', 'TaskTypeConnectToTargetSQLDb', 'TaskTypeConnectToTargetAzureSQLDbMI', 'TaskTypeConnectToSourceSQLServer' + TaskType TaskType `json:"taskType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) MarshalJSON() ([]byte, error) { + vmisssmtp.TaskType = TaskTypeValidateMigrationInputSQLServerAzureSQLDbMI + objectMap := make(map[string]interface{}) + if vmisssmtp.Input != nil { + objectMap["input"] = vmisssmtp.Input + } + if vmisssmtp.Output != nil { + objectMap["output"] = vmisssmtp.Output + } + if vmisssmtp.Errors != nil { + objectMap["errors"] = vmisssmtp.Errors + } + if vmisssmtp.State != "" { + objectMap["state"] = vmisssmtp.State + } + if vmisssmtp.TaskType != "" { + objectMap["taskType"] = vmisssmtp.TaskType + } + return json.Marshal(objectMap) +} + +// AsValidateMigrationInputSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsValidateMigrationInputSQLServerSQLMITaskProperties() (*ValidateMigrationInputSQLServerSQLMITaskProperties, bool) { + return &vmisssmtp, true +} + +// AsMigrateSQLServerSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLDbTaskProperties() (*MigrateSQLServerSQLDbTaskProperties, bool) { + return nil, false +} + +// AsMigrateSQLServerSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsMigrateSQLServerSQLMITaskProperties() (*MigrateSQLServerSQLMITaskProperties, bool) { + return nil, false +} + +// AsGetUserTablesSQLTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsGetUserTablesSQLTaskProperties() (*GetUserTablesSQLTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLDbTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) { + return nil, false +} + +// AsConnectToTargetSQLMITaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) { + return nil, false +} + +// AsConnectToSourceSQLServerTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) { + return nil, false +} + +// AsProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsProjectTaskProperties() (*ProjectTaskProperties, bool) { + return nil, false +} + +// AsBasicProjectTaskProperties is the BasicProjectTaskProperties implementation for ValidateMigrationInputSQLServerSQLMITaskProperties. +func (vmisssmtp ValidateMigrationInputSQLServerSQLMITaskProperties) AsBasicProjectTaskProperties() (BasicProjectTaskProperties, bool) { + return &vmisssmtp, true +} + +// ValidationError description about the errors happen while performing migration validation +type ValidationError struct { + // Text - Error Text + Text *string `json:"text,omitempty"` + // Severity - Severity of the error. Possible values include: 'SeverityMessage', 'SeverityWarning', 'SeverityError' + Severity Severity `json:"severity,omitempty"` +} + +// WaitStatistics wait statistics gathered during query batch execution +type WaitStatistics struct { + // WaitType - Type of the Wait + WaitType *string `json:"waitType,omitempty"` + // WaitTimeMs - Total wait time in millisecond(s) + WaitTimeMs *float64 `json:"waitTimeMs,omitempty"` + // WaitCount - Total no. of waits + WaitCount *int64 `json:"waitCount,omitempty"` +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/operations.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/operations.go new file mode 100644 index 000000000000..ddd13f4a5e7e --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/operations.go @@ -0,0 +1,126 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// OperationsClient is the data Migration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all available actions exposed by the Data Migration Service resource provider. +func (client OperationsClient) List(ctx context.Context) (result ServiceOperationListPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.sol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DataMigration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ServiceOperationList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(lastResults ServiceOperationList) (result ServiceOperationList, err error) { + req, err := lastResults.serviceOperationListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result ServiceOperationListIterator, err error) { + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/projects.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/projects.go new file mode 100644 index 000000000000..ab3993bd62af --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/projects.go @@ -0,0 +1,416 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ProjectsClient is the data Migration Client +type ProjectsClient struct { + BaseClient +} + +// NewProjectsClient creates an instance of the ProjectsClient client. +func NewProjectsClient(subscriptionID string) ProjectsClient { + return NewProjectsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProjectsClientWithBaseURI creates an instance of the ProjectsClient client. +func NewProjectsClientWithBaseURI(baseURI string, subscriptionID string) ProjectsClient { + return ProjectsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the project resource is a nested resource representing a stored migration project. The PUT method +// creates a new project or updates an existing one. +// +// parameters is information about the project groupName is name of the resource group serviceName is name of the +// service projectName is name of the project +func (client ProjectsClient) CreateOrUpdate(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (result Project, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, parameters, groupName, serviceName, projectName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProjectsClient) CreateOrUpdatePreparer(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProjectsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProjectsClient) CreateOrUpdateResponder(resp *http.Response) (result Project, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the project resource is a nested resource representing a stored migration project. The DELETE method deletes +// a project. +// +// groupName is name of the resource group serviceName is name of the service projectName is name of the project +// deleteRunningTasks is delete the resource even if it contains running tasks +func (client ProjectsClient) Delete(ctx context.Context, groupName string, serviceName string, projectName string, deleteRunningTasks *bool) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, groupName, serviceName, projectName, deleteRunningTasks) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProjectsClient) DeletePreparer(ctx context.Context, groupName string, serviceName string, projectName string, deleteRunningTasks *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteRunningTasks != nil { + queryParameters["deleteRunningTasks"] = autorest.Encode("query", *deleteRunningTasks) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProjectsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProjectsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the project resource is a nested resource representing a stored migration project. The GET method retrieves +// information about a project. +// +// groupName is name of the resource group serviceName is name of the service projectName is name of the project +func (client ProjectsClient) Get(ctx context.Context, groupName string, serviceName string, projectName string) (result Project, err error) { + req, err := client.GetPreparer(ctx, groupName, serviceName, projectName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProjectsClient) GetPreparer(ctx context.Context, groupName string, serviceName string, projectName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProjectsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProjectsClient) GetResponder(resp *http.Response) (result Project, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the project resource is a nested resource representing a stored migration project. This method returns a list +// of projects owned by a service resource. +// +// groupName is name of the resource group serviceName is name of the service +func (client ProjectsClient) List(ctx context.Context, groupName string, serviceName string) (result ProjectListPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "List", resp, "Failure sending request") + return + } + + result.pl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ProjectsClient) ListPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProjectsClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProjectsClient) ListResponder(resp *http.Response) (result ProjectList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProjectsClient) listNextResults(lastResults ProjectList) (result ProjectList, err error) { + req, err := lastResults.projectListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProjectsClient) ListComplete(ctx context.Context, groupName string, serviceName string) (result ProjectListIterator, err error) { + result.page, err = client.List(ctx, groupName, serviceName) + return +} + +// Update the project resource is a nested resource representing a stored migration project. The PATCH method updates +// an existing project. +// +// parameters is information about the project groupName is name of the resource group serviceName is name of the +// service projectName is name of the project +func (client ProjectsClient) Update(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (result Project, err error) { + req, err := client.UpdatePreparer(ctx, parameters, groupName, serviceName, projectName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ProjectsClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ProjectsClient) UpdatePreparer(ctx context.Context, parameters Project, groupName string, serviceName string, projectName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ProjectsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ProjectsClient) UpdateResponder(resp *http.Response) (result Project, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/resourceskus.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/resourceskus.go new file mode 100644 index 000000000000..0d8934e967dd --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/resourceskus.go @@ -0,0 +1,130 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ResourceSkusClient is the data Migration Client +type ResourceSkusClient struct { + BaseClient +} + +// NewResourceSkusClient creates an instance of the ResourceSkusClient client. +func NewResourceSkusClient(subscriptionID string) ResourceSkusClient { + return NewResourceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceSkusClientWithBaseURI creates an instance of the ResourceSkusClient client. +func NewResourceSkusClientWithBaseURI(baseURI string, subscriptionID string) ResourceSkusClient { + return ResourceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListSkus the skus action returns the list of SKUs that DMS supports. +func (client ResourceSkusClient) ListSkus(ctx context.Context) (result ResourceSkusResultPage, err error) { + result.fn = client.listSkusNextResults + req, err := client.ListSkusPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.rsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "ListSkus", resp, "Failure sending request") + return + } + + result.rsr, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client ResourceSkusClient) ListSkusPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceSkusClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client ResourceSkusClient) ListSkusResponder(resp *http.Response) (result ResourceSkusResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSkusNextResults retrieves the next set of results, if any. +func (client ResourceSkusClient) listSkusNextResults(lastResults ResourceSkusResult) (result ResourceSkusResult, err error) { + req, err := lastResults.resourceSkusResultPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "listSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "listSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ResourceSkusClient", "listSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourceSkusClient) ListSkusComplete(ctx context.Context) (result ResourceSkusResultIterator, err error) { + result.page, err = client.ListSkus(ctx) + return +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/services.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/services.go new file mode 100644 index 000000000000..4d24b0313a33 --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/services.go @@ -0,0 +1,957 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// ServicesClient is the data Migration Client +type ServicesClient struct { + BaseClient +} + +// NewServicesClient creates an instance of the ServicesClient client. +func NewServicesClient(subscriptionID string) ServicesClient { + return NewServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicesClientWithBaseURI creates an instance of the ServicesClient client. +func NewServicesClientWithBaseURI(baseURI string, subscriptionID string) ServicesClient { + return ServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckChildrenNameAvailability this method checks whether a proposed nested resource name is valid and available. +// +// groupName is name of the resource group serviceName is name of the service parameters is requested name to +// validate +func (client ServicesClient) CheckChildrenNameAvailability(ctx context.Context, groupName string, serviceName string, parameters NameAvailabilityRequest) (result NameAvailabilityResponse, err error) { + req, err := client.CheckChildrenNameAvailabilityPreparer(ctx, groupName, serviceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckChildrenNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckChildrenNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckChildrenNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckChildrenNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckChildrenNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckChildrenNameAvailabilityPreparer prepares the CheckChildrenNameAvailability request. +func (client ServicesClient) CheckChildrenNameAvailabilityPreparer(ctx context.Context, groupName string, serviceName string, parameters NameAvailabilityRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckChildrenNameAvailabilitySender sends the CheckChildrenNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckChildrenNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CheckChildrenNameAvailabilityResponder handles the response to the CheckChildrenNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckChildrenNameAvailabilityResponder(resp *http.Response) (result NameAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckNameAvailability this method checks whether a proposed top-level resource name is valid and available. +// +// location is the Azure region of the operation parameters is requested name to validate +func (client ServicesClient) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityRequest) (result NameAvailabilityResponse, err error) { + req, err := client.CheckNameAvailabilityPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client ServicesClient) CheckNameAvailabilityPreparer(ctx context.Context, location string, parameters NameAvailabilityRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckNameAvailabilityResponder(resp *http.Response) (result NameAvailabilityResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckStatus the services resource is the top-level resource that represents the Data Migration Service. This action +// performs a health check and returns the status of the service and virtual machine size. +// +// groupName is name of the resource group serviceName is name of the service +func (client ServicesClient) CheckStatus(ctx context.Context, groupName string, serviceName string) (result ServiceStatusResponse, err error) { + req, err := client.CheckStatusPreparer(ctx, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckStatus", nil, "Failure preparing request") + return + } + + resp, err := client.CheckStatusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckStatus", resp, "Failure sending request") + return + } + + result, err = client.CheckStatusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CheckStatus", resp, "Failure responding to request") + } + + return +} + +// CheckStatusPreparer prepares the CheckStatus request. +func (client ServicesClient) CheckStatusPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/checkStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckStatusSender sends the CheckStatus request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CheckStatusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CheckStatusResponder handles the response to the CheckStatus request. The method always +// closes the http.Response Body. +func (client ServicesClient) CheckStatusResponder(resp *http.Response) (result ServiceStatusResponse, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate the services resource is the top-level resource that represents the Data Migration Service. The PUT +// method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. +// tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although +// other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if +// tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The +// provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState +// property. +// +// parameters is information about the service groupName is name of the resource group serviceName is name of the +// service +func (client ServicesClient) CreateOrUpdate(ctx context.Context, parameters Service, groupName string, serviceName string) (result ServicesCreateOrUpdateFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ServiceProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ServiceProperties.VirtualSubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("datamigration.ServicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServicesClient) CreateOrUpdatePreparer(ctx context.Context, parameters Service, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) CreateOrUpdateSender(req *http.Request) (future ServicesCreateOrUpdateFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted)) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServicesClient) CreateOrUpdateResponder(resp *http.Response) (result Service, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the services resource is the top-level resource that represents the Data Migration Service. The DELETE method +// deletes a service. Any running tasks will be canceled. +// +// groupName is name of the resource group serviceName is name of the service deleteRunningTasks is delete the +// resource even if it contains running tasks +func (client ServicesClient) Delete(ctx context.Context, groupName string, serviceName string, deleteRunningTasks *bool) (result ServicesDeleteFuture, err error) { + req, err := client.DeletePreparer(ctx, groupName, serviceName, deleteRunningTasks) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServicesClient) DeletePreparer(ctx context.Context, groupName string, serviceName string, deleteRunningTasks *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteRunningTasks != nil { + queryParameters["deleteRunningTasks"] = autorest.Encode("query", *deleteRunningTasks) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) DeleteSender(req *http.Request) (future ServicesDeleteFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the services resource is the top-level resource that represents the Data Migration Service. The GET method +// retrieves information about a service instance. +// +// groupName is name of the resource group serviceName is name of the service +func (client ServicesClient) Get(ctx context.Context, groupName string, serviceName string) (result Service, err error) { + req, err := client.GetPreparer(ctx, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicesClient) GetPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServicesClient) GetResponder(resp *http.Response) (result Service, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the services resource is the top-level resource that represents the Data Migration Service. This method returns +// a list of service resources in a subscription. +func (client ServicesClient) List(ctx context.Context) (result ServiceListPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "List", resp, "Failure sending request") + return + } + + result.sl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client ServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/services", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListResponder(resp *http.Response) (result ServiceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ServicesClient) listNextResults(lastResults ServiceList) (result ServiceList, err error) { + req, err := lastResults.serviceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListComplete(ctx context.Context) (result ServiceListIterator, err error) { + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup the Services resource is the top-level resource that represents the Data Migration Service. This +// method returns a list of service resources in a resource group. +// +// groupName is name of the resource group +func (client ServicesClient) ListByResourceGroup(ctx context.Context, groupName string) (result ServiceListPage, err error) { + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServicesClient) ListByResourceGroupPreparer(ctx context.Context, groupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ServicesClient) listByResourceGroupNextResults(lastResults ServiceList) (result ServiceList, err error) { + req, err := lastResults.serviceListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListByResourceGroupComplete(ctx context.Context, groupName string) (result ServiceListIterator, err error) { + result.page, err = client.ListByResourceGroup(ctx, groupName) + return +} + +// ListSkus the services resource is the top-level resource that represents the Data Migration Service. The skus action +// returns the list of SKUs that a service resource can be updated to. +// +// groupName is name of the resource group serviceName is name of the service +func (client ServicesClient) ListSkus(ctx context.Context, groupName string, serviceName string) (result ServiceSkuListPage, err error) { + result.fn = client.listSkusNextResults + req, err := client.ListSkusPreparer(ctx, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListSkus", nil, "Failure preparing request") + return + } + + resp, err := client.ListSkusSender(req) + if err != nil { + result.ssl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListSkus", resp, "Failure sending request") + return + } + + result.ssl, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "ListSkus", resp, "Failure responding to request") + } + + return +} + +// ListSkusPreparer prepares the ListSkus request. +func (client ServicesClient) ListSkusPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/skus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSkusSender sends the ListSkus request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) ListSkusSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListSkusResponder handles the response to the ListSkus request. The method always +// closes the http.Response Body. +func (client ServicesClient) ListSkusResponder(resp *http.Response) (result ServiceSkuList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listSkusNextResults retrieves the next set of results, if any. +func (client ServicesClient) listSkusNextResults(lastResults ServiceSkuList) (result ServiceSkuList, err error) { + req, err := lastResults.serviceSkuListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listSkusNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSkusSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listSkusNextResults", resp, "Failure sending next results request") + } + result, err = client.ListSkusResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "listSkusNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListSkusComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServicesClient) ListSkusComplete(ctx context.Context, groupName string, serviceName string) (result ServiceSkuListIterator, err error) { + result.page, err = client.ListSkus(ctx, groupName, serviceName) + return +} + +// Start the services resource is the top-level resource that represents the Data Migration Service. This action starts +// the service and the service can be used for data migration. +// +// groupName is name of the resource group serviceName is name of the service +func (client ServicesClient) Start(ctx context.Context, groupName string, serviceName string) (result ServicesStartFuture, err error) { + req, err := client.StartPreparer(ctx, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ServicesClient) StartPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) StartSender(req *http.Request) (future ServicesStartFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ServicesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop the services resource is the top-level resource that represents the Data Migration Service. This action stops +// the service and the service cannot be used for data migration. The service owner won't be billed when the service is +// stopped. +// +// groupName is name of the resource group serviceName is name of the service +func (client ServicesClient) Stop(ctx context.Context, groupName string, serviceName string) (result ServicesStopFuture, err error) { + req, err := client.StopPreparer(ctx, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ServicesClient) StopPreparer(ctx context.Context, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) StopSender(req *http.Request) (future ServicesStopFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ServicesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update the services resource is the top-level resource that represents the Data Migration Service. The PATCH method +// updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are +// currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). +// +// parameters is information about the service groupName is name of the resource group serviceName is name of the +// service +func (client ServicesClient) Update(ctx context.Context, parameters Service, groupName string, serviceName string) (result ServicesUpdateFuture, err error) { + req, err := client.UpdatePreparer(ctx, parameters, groupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.ServicesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ServicesClient) UpdatePreparer(ctx context.Context, parameters Service, groupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ServicesClient) UpdateSender(req *http.Request) (future ServicesUpdateFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ServicesClient) UpdateResponder(resp *http.Response) (result Service, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/tasks.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/tasks.go new file mode 100644 index 000000000000..5696a7a32b02 --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/tasks.go @@ -0,0 +1,501 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// TasksClient is the data Migration Client +type TasksClient struct { + BaseClient +} + +// NewTasksClient creates an instance of the TasksClient client. +func NewTasksClient(subscriptionID string) TasksClient { + return NewTasksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTasksClientWithBaseURI creates an instance of the TasksClient client. +func NewTasksClientWithBaseURI(baseURI string, subscriptionID string) TasksClient { + return TasksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. This +// method cancels a task if it's currently queued or running. +// +// groupName is name of the resource group serviceName is name of the service projectName is name of the project +// taskName is name of the Task +func (client TasksClient) Cancel(ctx context.Context, groupName string, serviceName string, projectName string, taskName string) (result ProjectTask, err error) { + req, err := client.CancelPreparer(ctx, groupName, serviceName, projectName, taskName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Cancel", resp, "Failure responding to request") + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client TasksClient) CancelPreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) CancelSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client TasksClient) CancelResponder(resp *http.Response) (result ProjectTask, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. +// The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom +// properties, there is little reason to update an exising one. +// +// parameters is information about the task groupName is name of the resource group serviceName is name of the +// service projectName is name of the project taskName is name of the Task +func (client TasksClient) CreateOrUpdate(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (result ProjectTask, err error) { + req, err := client.CreateOrUpdatePreparer(ctx, parameters, groupName, serviceName, projectName, taskName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TasksClient) CreateOrUpdatePreparer(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TasksClient) CreateOrUpdateResponder(resp *http.Response) (result ProjectTask, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The DELETE +// method deletes a task, canceling it first if it's running. +// +// groupName is name of the resource group serviceName is name of the service projectName is name of the project +// taskName is name of the Task deleteRunningTasks is delete the resource even if it contains running tasks +func (client TasksClient) Delete(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, deleteRunningTasks *bool) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, groupName, serviceName, projectName, taskName, deleteRunningTasks) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TasksClient) DeletePreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, deleteRunningTasks *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if deleteRunningTasks != nil { + queryParameters["deleteRunningTasks"] = autorest.Encode("query", *deleteRunningTasks) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TasksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The GET +// method retrieves information about a task. +// +// groupName is name of the resource group serviceName is name of the service projectName is name of the project +// taskName is name of the Task expand is expand the response +func (client TasksClient) Get(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, expand string) (result ProjectTask, err error) { + req, err := client.GetPreparer(ctx, groupName, serviceName, projectName, taskName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client TasksClient) GetPreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client TasksClient) GetResponder(resp *http.Response) (result ProjectTask, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the services resource is the top-level resource that represents the Data Migration Service. This method returns +// a list of tasks owned by a service resource. Some tasks may have a status of Unknown, which indicates that an error +// occurred while querying the status of that task. +// +// groupName is name of the resource group serviceName is name of the service projectName is name of the project +// taskType is filter tasks by task type +func (client TasksClient) List(ctx context.Context, groupName string, serviceName string, projectName string, taskType string) (result TaskListPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, groupName, serviceName, projectName, taskType) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "List", resp, "Failure sending request") + return + } + + result.tl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TasksClient) ListPreparer(ctx context.Context, groupName string, serviceName string, projectName string, taskType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(taskType) > 0 { + queryParameters["taskType"] = autorest.Encode("query", taskType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TasksClient) ListResponder(resp *http.Response) (result TaskList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TasksClient) listNextResults(lastResults TaskList) (result TaskList, err error) { + req, err := lastResults.taskListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.TasksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.TasksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TasksClient) ListComplete(ctx context.Context, groupName string, serviceName string, projectName string, taskType string) (result TaskListIterator, err error) { + result.page, err = client.List(ctx, groupName, serviceName, projectName, taskType) + return +} + +// Update the tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PATCH +// method updates an existing task, but since tasks have no mutable custom properties, there is little reason to do so. +// +// parameters is information about the task groupName is name of the resource group serviceName is name of the +// service projectName is name of the project taskName is name of the Task +func (client TasksClient) Update(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (result ProjectTask, err error) { + req, err := client.UpdatePreparer(ctx, parameters, groupName, serviceName, projectName, taskName) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.TasksClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client TasksClient) UpdatePreparer(ctx context.Context, parameters ProjectTask, groupName string, serviceName string, projectName string, taskName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "projectName": autorest.Encode("path", projectName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "taskName": autorest.Encode("path", taskName), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.DataMigration/services/{serviceName}/projects/{projectName}/tasks/{taskName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client TasksClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client TasksClient) UpdateResponder(resp *http.Response) (result ProjectTask, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/usages.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/usages.go new file mode 100644 index 000000000000..a3cf218b013b --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/usages.go @@ -0,0 +1,133 @@ +package datamigration + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// UsagesClient is the data Migration Client +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client. +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List this method returns region-specific quotas and resource usage information for the Data Migration Service. +// +// location is the Azure region of the operation +func (client UsagesClient) List(ctx context.Context, location string) (result QuotaListPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ql.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.ql, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-31-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataMigration/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result QuotaList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesClient) listNextResults(lastResults QuotaList) (result QuotaList, err error) { + req, err := lastResults.quotaListPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "datamigration.UsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "datamigration.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "datamigration.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, location string) (result QuotaListIterator, err error) { + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/version.go b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/version.go new file mode 100644 index 000000000000..6250f32c4d5f --- /dev/null +++ b/services/preview/datamigration/mgmt/2018-03-31-preview/datamigration/version.go @@ -0,0 +1,30 @@ +package datamigration + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + version.Number + " datamigration/2018-03-31-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}