Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR datamigration/resource-manager] Add Agent Jobs and Login migration for SQL to MI public preview scenario #2298

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-03-15-preview'
self.api_version = '2018-03-31-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
from .migrate_sql_server_sql_db_task_input_py3 import MigrateSqlServerSqlDbTaskInput
from .migrate_sql_server_sql_db_task_properties_py3 import MigrateSqlServerSqlDbTaskProperties
from .migrate_sql_server_sql_mi_task_output_error_py3 import MigrateSqlServerSqlMITaskOutputError
from .migrate_sql_server_sql_mi_task_output_login_level_py3 import MigrateSqlServerSqlMITaskOutputLoginLevel
from .migrate_sql_server_sql_mi_task_output_agent_job_level_py3 import MigrateSqlServerSqlMITaskOutputAgentJobLevel
from .migrate_sql_server_sql_mi_task_output_database_level_py3 import MigrateSqlServerSqlMITaskOutputDatabaseLevel
from .start_migration_scenario_server_role_result_py3 import StartMigrationScenarioServerRoleResult
from .migrate_sql_server_sql_mi_task_output_migration_level_py3 import MigrateSqlServerSqlMITaskOutputMigrationLevel
from .migrate_sql_server_sql_mi_task_output_py3 import MigrateSqlServerSqlMITaskOutput
from .migrate_sql_server_sql_mi_task_input_py3 import MigrateSqlServerSqlMITaskInput
Expand All @@ -62,6 +65,9 @@
from .connect_to_target_sql_mi_task_output_py3 import ConnectToTargetSqlMITaskOutput
from .connect_to_target_sql_mi_task_input_py3 import ConnectToTargetSqlMITaskInput
from .connect_to_target_sql_mi_task_properties_py3 import ConnectToTargetSqlMITaskProperties
from .migration_eligibility_info_py3 import MigrationEligibilityInfo
from .connect_to_source_sql_server_task_output_agent_job_level_py3 import ConnectToSourceSqlServerTaskOutputAgentJobLevel
from .connect_to_source_sql_server_task_output_login_level_py3 import ConnectToSourceSqlServerTaskOutputLoginLevel
from .database_file_info_py3 import DatabaseFileInfo
from .connect_to_source_sql_server_task_output_database_level_py3 import ConnectToSourceSqlServerTaskOutputDatabaseLevel
from .connect_to_source_sql_server_task_output_task_level_py3 import ConnectToSourceSqlServerTaskOutputTaskLevel
Expand Down Expand Up @@ -135,7 +141,10 @@
from .migrate_sql_server_sql_db_task_input import MigrateSqlServerSqlDbTaskInput
from .migrate_sql_server_sql_db_task_properties import MigrateSqlServerSqlDbTaskProperties
from .migrate_sql_server_sql_mi_task_output_error import MigrateSqlServerSqlMITaskOutputError
from .migrate_sql_server_sql_mi_task_output_login_level import MigrateSqlServerSqlMITaskOutputLoginLevel
from .migrate_sql_server_sql_mi_task_output_agent_job_level import MigrateSqlServerSqlMITaskOutputAgentJobLevel
from .migrate_sql_server_sql_mi_task_output_database_level import MigrateSqlServerSqlMITaskOutputDatabaseLevel
from .start_migration_scenario_server_role_result import StartMigrationScenarioServerRoleResult
from .migrate_sql_server_sql_mi_task_output_migration_level import MigrateSqlServerSqlMITaskOutputMigrationLevel
from .migrate_sql_server_sql_mi_task_output import MigrateSqlServerSqlMITaskOutput
from .migrate_sql_server_sql_mi_task_input import MigrateSqlServerSqlMITaskInput
Expand All @@ -150,6 +159,9 @@
from .connect_to_target_sql_mi_task_output import ConnectToTargetSqlMITaskOutput
from .connect_to_target_sql_mi_task_input import ConnectToTargetSqlMITaskInput
from .connect_to_target_sql_mi_task_properties import ConnectToTargetSqlMITaskProperties
from .migration_eligibility_info import MigrationEligibilityInfo
from .connect_to_source_sql_server_task_output_agent_job_level import ConnectToSourceSqlServerTaskOutputAgentJobLevel
from .connect_to_source_sql_server_task_output_login_level import ConnectToSourceSqlServerTaskOutputLoginLevel
from .database_file_info import DatabaseFileInfo
from .connect_to_source_sql_server_task_output_database_level import ConnectToSourceSqlServerTaskOutputDatabaseLevel
from .connect_to_source_sql_server_task_output_task_level import ConnectToSourceSqlServerTaskOutputTaskLevel
Expand Down Expand Up @@ -201,6 +213,8 @@
MigrationState,
DatabaseMigrationStage,
MigrationStatus,
LoginMigrationStage,
LoginType,
DatabaseState,
DatabaseCompatLevel,
DatabaseFileType,
Expand Down Expand Up @@ -256,7 +270,10 @@
'MigrateSqlServerSqlDbTaskInput',
'MigrateSqlServerSqlDbTaskProperties',
'MigrateSqlServerSqlMITaskOutputError',
'MigrateSqlServerSqlMITaskOutputLoginLevel',
'MigrateSqlServerSqlMITaskOutputAgentJobLevel',
'MigrateSqlServerSqlMITaskOutputDatabaseLevel',
'StartMigrationScenarioServerRoleResult',
'MigrateSqlServerSqlMITaskOutputMigrationLevel',
'MigrateSqlServerSqlMITaskOutput',
'MigrateSqlServerSqlMITaskInput',
Expand All @@ -271,6 +288,9 @@
'ConnectToTargetSqlMITaskOutput',
'ConnectToTargetSqlMITaskInput',
'ConnectToTargetSqlMITaskProperties',
'MigrationEligibilityInfo',
'ConnectToSourceSqlServerTaskOutputAgentJobLevel',
'ConnectToSourceSqlServerTaskOutputLoginLevel',
'DatabaseFileInfo',
'ConnectToSourceSqlServerTaskOutputDatabaseLevel',
'ConnectToSourceSqlServerTaskOutputTaskLevel',
Expand Down Expand Up @@ -321,6 +341,8 @@
'MigrationState',
'DatabaseMigrationStage',
'MigrationStatus',
'LoginMigrationStage',
'LoginType',
'DatabaseState',
'DatabaseCompatLevel',
'DatabaseFileType',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class ConnectToSourceSqlServerTaskInput(Model):
values include: 'Default', 'MigrationFromSqlServerToAzureDB'
:type check_permissions_group: str or
~azure.mgmt.datamigration.models.ServerLevelPermissionsGroup
:param collect_logins: Flag for whether to collect logins from source
server. Default value: False .
:type collect_logins: bool
:param collect_agent_jobs: Flag for whether to collect agent jobs from
source server. Default value: False .
:type collect_agent_jobs: bool
"""

_validation = {
Expand All @@ -35,9 +41,13 @@ class ConnectToSourceSqlServerTaskInput(Model):
_attribute_map = {
'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'SqlConnectionInfo'},
'check_permissions_group': {'key': 'checkPermissionsGroup', 'type': 'str'},
'collect_logins': {'key': 'CollectLogins', 'type': 'bool'},
'collect_agent_jobs': {'key': 'CollectAgentJobs', 'type': 'bool'},
}

def __init__(self, **kwargs):
super(ConnectToSourceSqlServerTaskInput, self).__init__(**kwargs)
self.source_connection_info = kwargs.get('source_connection_info', None)
self.check_permissions_group = kwargs.get('check_permissions_group', None)
self.collect_logins = kwargs.get('collect_logins', False)
self.collect_agent_jobs = kwargs.get('collect_agent_jobs', False)
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class ConnectToSourceSqlServerTaskInput(Model):
values include: 'Default', 'MigrationFromSqlServerToAzureDB'
:type check_permissions_group: str or
~azure.mgmt.datamigration.models.ServerLevelPermissionsGroup
:param collect_logins: Flag for whether to collect logins from source
server. Default value: False .
:type collect_logins: bool
:param collect_agent_jobs: Flag for whether to collect agent jobs from
source server. Default value: False .
:type collect_agent_jobs: bool
"""

_validation = {
Expand All @@ -35,9 +41,13 @@ class ConnectToSourceSqlServerTaskInput(Model):
_attribute_map = {
'source_connection_info': {'key': 'sourceConnectionInfo', 'type': 'SqlConnectionInfo'},
'check_permissions_group': {'key': 'checkPermissionsGroup', 'type': 'str'},
'collect_logins': {'key': 'CollectLogins', 'type': 'bool'},
'collect_agent_jobs': {'key': 'CollectAgentJobs', 'type': 'bool'},
}

def __init__(self, *, source_connection_info, check_permissions_group=None, **kwargs) -> None:
def __init__(self, *, source_connection_info, check_permissions_group=None, collect_logins: bool=False, collect_agent_jobs: bool=False, **kwargs) -> None:
super(ConnectToSourceSqlServerTaskInput, self).__init__(**kwargs)
self.source_connection_info = source_connection_info
self.check_permissions_group = check_permissions_group
self.collect_logins = collect_logins
self.collect_agent_jobs = collect_agent_jobs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class ConnectToSourceSqlServerTaskOutput(Model):
validates source server requirements.

You probably want to use the sub-classes and not this class directly. Known
sub-classes are: ConnectToSourceSqlServerTaskOutputDatabaseLevel,
sub-classes are: ConnectToSourceSqlServerTaskOutputAgentJobLevel,
ConnectToSourceSqlServerTaskOutputLoginLevel,
ConnectToSourceSqlServerTaskOutputDatabaseLevel,
ConnectToSourceSqlServerTaskOutputTaskLevel

Variables are only populated by the server, and will be ignored when
Expand All @@ -42,7 +44,7 @@ class ConnectToSourceSqlServerTaskOutput(Model):
}

_subtype_map = {
'result_type': {'DatabaseLevelOutput': 'ConnectToSourceSqlServerTaskOutputDatabaseLevel', 'TaskLevelOutput': 'ConnectToSourceSqlServerTaskOutputTaskLevel'}
'result_type': {'AgentJobLevelOutput': 'ConnectToSourceSqlServerTaskOutputAgentJobLevel', 'LoginLevelOutput': 'ConnectToSourceSqlServerTaskOutputLoginLevel', 'DatabaseLevelOutput': 'ConnectToSourceSqlServerTaskOutputDatabaseLevel', 'TaskLevelOutput': 'ConnectToSourceSqlServerTaskOutputTaskLevel'}
}

def __init__(self, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .connect_to_source_sql_server_task_output import ConnectToSourceSqlServerTaskOutput


class ConnectToSourceSqlServerTaskOutputAgentJobLevel(ConnectToSourceSqlServerTaskOutput):
"""AgentJob level output for the task that validates connection to SQL Server
and also validates source server requirements.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Result identifier
:vartype id: str
:param result_type: Required. Constant filled by server.
:type result_type: str
:ivar name: AgentJob name
:vartype name: str
:ivar job_category: The type of AgentJob.
:vartype job_category: str
:ivar is_enabled: The state of the original AgentJob.
:vartype is_enabled: bool
:ivar job_owner: The owner of the AgentJob
:vartype job_owner: str
:ivar last_executed_on: UTC Date and time when the AgentJob was last
executed.
:vartype last_executed_on: datetime
:ivar migration_eligibility: Information about eligiblity of agent job for
migration.
:vartype migration_eligibility:
~azure.mgmt.datamigration.models.MigrationEligibilityInfo
"""

_validation = {
'id': {'readonly': True},
'result_type': {'required': True},
'name': {'readonly': True},
'job_category': {'readonly': True},
'is_enabled': {'readonly': True},
'job_owner': {'readonly': True},
'last_executed_on': {'readonly': True},
'migration_eligibility': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'result_type': {'key': 'resultType', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'job_category': {'key': 'jobCategory', 'type': 'str'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'job_owner': {'key': 'jobOwner', 'type': 'str'},
'last_executed_on': {'key': 'lastExecutedOn', 'type': 'iso-8601'},
'migration_eligibility': {'key': 'migrationEligibility', 'type': 'MigrationEligibilityInfo'},
}

def __init__(self, **kwargs):
super(ConnectToSourceSqlServerTaskOutputAgentJobLevel, self).__init__(**kwargs)
self.name = None
self.job_category = None
self.is_enabled = None
self.job_owner = None
self.last_executed_on = None
self.migration_eligibility = None
self.result_type = 'AgentJobLevelOutput'
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .connect_to_source_sql_server_task_output import ConnectToSourceSqlServerTaskOutput


class ConnectToSourceSqlServerTaskOutputAgentJobLevel(ConnectToSourceSqlServerTaskOutput):
"""AgentJob level output for the task that validates connection to SQL Server
and also validates source server requirements.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Result identifier
:vartype id: str
:param result_type: Required. Constant filled by server.
:type result_type: str
:ivar name: AgentJob name
:vartype name: str
:ivar job_category: The type of AgentJob.
:vartype job_category: str
:ivar is_enabled: The state of the original AgentJob.
:vartype is_enabled: bool
:ivar job_owner: The owner of the AgentJob
:vartype job_owner: str
:ivar last_executed_on: UTC Date and time when the AgentJob was last
executed.
:vartype last_executed_on: datetime
:ivar migration_eligibility: Information about eligiblity of agent job for
migration.
:vartype migration_eligibility:
~azure.mgmt.datamigration.models.MigrationEligibilityInfo
"""

_validation = {
'id': {'readonly': True},
'result_type': {'required': True},
'name': {'readonly': True},
'job_category': {'readonly': True},
'is_enabled': {'readonly': True},
'job_owner': {'readonly': True},
'last_executed_on': {'readonly': True},
'migration_eligibility': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'result_type': {'key': 'resultType', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'job_category': {'key': 'jobCategory', 'type': 'str'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'job_owner': {'key': 'jobOwner', 'type': 'str'},
'last_executed_on': {'key': 'lastExecutedOn', 'type': 'iso-8601'},
'migration_eligibility': {'key': 'migrationEligibility', 'type': 'MigrationEligibilityInfo'},
}

def __init__(self, **kwargs) -> None:
super(ConnectToSourceSqlServerTaskOutputAgentJobLevel, self).__init__(, **kwargs)
self.name = None
self.job_category = None
self.is_enabled = None
self.job_owner = None
self.last_executed_on = None
self.migration_eligibility = None
self.result_type = 'AgentJobLevelOutput'
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .connect_to_source_sql_server_task_output import ConnectToSourceSqlServerTaskOutput


class ConnectToSourceSqlServerTaskOutputLoginLevel(ConnectToSourceSqlServerTaskOutput):
"""Login level output for the task that validates connection to SQL Server and
also validates source server requirements.

Variables are only populated by the server, and will be ignored when
sending a request.

All required parameters must be populated in order to send to Azure.

:ivar id: Result identifier
:vartype id: str
:param result_type: Required. Constant filled by server.
:type result_type: str
:ivar name: Login name.
:vartype name: str
:ivar login_type: The type of login. Possible values include:
'WindowsUser', 'WindowsGroup', 'SqlLogin', 'Certificate', 'AsymmetricKey',
'ExternalUser', 'ExternalGroup'
:vartype login_type: str or ~azure.mgmt.datamigration.models.LoginType
:ivar default_database: The default database for the login.
:vartype default_database: str
:ivar is_enabled: The state of the login.
:vartype is_enabled: bool
:ivar migration_eligibility: Information about eligiblity of login for
migration.
:vartype migration_eligibility:
~azure.mgmt.datamigration.models.MigrationEligibilityInfo
"""

_validation = {
'id': {'readonly': True},
'result_type': {'required': True},
'name': {'readonly': True},
'login_type': {'readonly': True},
'default_database': {'readonly': True},
'is_enabled': {'readonly': True},
'migration_eligibility': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'result_type': {'key': 'resultType', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'login_type': {'key': 'loginType', 'type': 'LoginType'},
'default_database': {'key': 'defaultDatabase', 'type': 'str'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'migration_eligibility': {'key': 'migrationEligibility', 'type': 'MigrationEligibilityInfo'},
}

def __init__(self, **kwargs):
super(ConnectToSourceSqlServerTaskOutputLoginLevel, self).__init__(**kwargs)
self.name = None
self.login_type = None
self.default_database = None
self.is_enabled = None
self.migration_eligibility = None
self.result_type = 'LoginLevelOutput'
Loading