From 4f76579e2ddb0432f78160df37bae1a33f44d20e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 10 Jun 2019 10:42:11 -0700 Subject: [PATCH 1/8] Generated from e3a05a01222ce524bdf38587ddb8aa054c2b1dff (#5766) Add instancePools.json to sql readme.md --- .../azure/mgmt/sql/models/__init__.py | 14 + .../azure/mgmt/sql/models/database.py | 25 +- .../azure/mgmt/sql/models/database_py3.py | 27 +- .../azure/mgmt/sql/models/database_update.py | 13 +- .../mgmt/sql/models/database_update_py3.py | 15 +- .../azure/mgmt/sql/models/elastic_pool.py | 9 +- .../azure/mgmt/sql/models/elastic_pool_py3.py | 9 +- .../azure/mgmt/sql/models/import_request.py | 14 +- .../mgmt/sql/models/import_request_py3.py | 14 +- .../azure/mgmt/sql/models/instance_pool.py | 74 +++ .../mgmt/sql/models/instance_pool_paged.py | 27 + .../mgmt/sql/models/instance_pool_py3.py | 74 +++ .../mgmt/sql/models/instance_pool_update.py | 28 + .../sql/models/instance_pool_update_py3.py | 28 + .../azure/mgmt/sql/models/managed_instance.py | 41 +- .../mgmt/sql/models/managed_instance_py3.py | 43 +- .../sql/models/managed_instance_update.py | 38 +- .../sql/models/managed_instance_update_py3.py | 40 +- .../sql/models/recommended_elastic_pool.py | 3 +- .../models/recommended_elastic_pool_py3.py | 3 +- .../mgmt/sql/models/sensitivity_label.py | 7 + .../mgmt/sql/models/sensitivity_label_py3.py | 7 + .../sql/models/sql_management_client_enums.py | 25 + .../azure/mgmt/sql/operations/__init__.py | 2 + .../operations/instance_pools_operations.py | 529 ++++++++++++++++++ ..._database_sensitivity_labels_operations.py | 158 +++++- .../managed_instances_operations.py | 200 ++++--- .../sensitivity_labels_operations.py | 158 +++++- .../azure/mgmt/sql/sql_management_client.py | 5 + .../azure-mgmt-sql/azure/mgmt/sql/version.py | 3 +- 30 files changed, 1522 insertions(+), 111 deletions(-) create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_paged.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_py3.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update_py3.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/instance_pools_operations.py diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 0a543180d7e4..837322623c9c 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -161,6 +161,8 @@ from .recoverable_managed_database_py3 import RecoverableManagedDatabase from .managed_instance_vulnerability_assessment_py3 import ManagedInstanceVulnerabilityAssessment from .server_vulnerability_assessment_py3 import ServerVulnerabilityAssessment + from .instance_pool_py3 import InstancePool + from .instance_pool_update_py3 import InstancePoolUpdate except (SyntaxError, ImportError): from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -313,6 +315,8 @@ from .recoverable_managed_database import RecoverableManagedDatabase from .managed_instance_vulnerability_assessment import ManagedInstanceVulnerabilityAssessment from .server_vulnerability_assessment import ServerVulnerabilityAssessment + from .instance_pool import InstancePool + from .instance_pool_update import InstancePoolUpdate from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -378,6 +382,7 @@ from .recoverable_managed_database_paged import RecoverableManagedDatabasePaged from .managed_instance_vulnerability_assessment_paged import ManagedInstanceVulnerabilityAssessmentPaged from .server_vulnerability_assessment_paged import ServerVulnerabilityAssessmentPaged +from .instance_pool_paged import InstancePoolPaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -412,6 +417,8 @@ ReadOnlyEndpointFailoverPolicy, FailoverGroupReplicationRole, IdentityType, + ManagedServerCreateMode, + ManagedInstanceLicenseType, ManagedInstanceProxyOverride, OperationOrigin, SyncAgentState, @@ -453,6 +460,7 @@ VulnerabilityAssessmentScanTriggerType, VulnerabilityAssessmentScanState, InstanceFailoverGroupReplicationRole, + InstancePoolLicenseType, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, SensitivityLabelSource, @@ -611,6 +619,8 @@ 'RecoverableManagedDatabase', 'ManagedInstanceVulnerabilityAssessment', 'ServerVulnerabilityAssessment', + 'InstancePool', + 'InstancePoolUpdate', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -676,6 +686,7 @@ 'RecoverableManagedDatabasePaged', 'ManagedInstanceVulnerabilityAssessmentPaged', 'ServerVulnerabilityAssessmentPaged', + 'InstancePoolPaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', @@ -709,6 +720,8 @@ 'ReadOnlyEndpointFailoverPolicy', 'FailoverGroupReplicationRole', 'IdentityType', + 'ManagedServerCreateMode', + 'ManagedInstanceLicenseType', 'ManagedInstanceProxyOverride', 'OperationOrigin', 'SyncAgentState', @@ -750,6 +763,7 @@ 'VulnerabilityAssessmentScanTriggerType', 'VulnerabilityAssessmentScanState', 'InstanceFailoverGroupReplicationRole', + 'InstancePoolLicenseType', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', 'SensitivityLabelSource', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database.py index f3f66d024a7a..0cd833b70f46 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database.py @@ -30,7 +30,17 @@ class Database(TrackedResource): :type location: str :param tags: Resource tags. :type tags: dict[str, str] - :param sku: The name and tier of the SKU. + :param sku: The database SKU. + The list of SKUs may vary by region and support offer. To determine the + SKUs (including the SKU name, tier/edition, family, and capacity) that are + available to your subscription in an Azure region, use the + `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location + ```` :type sku: ~azure.mgmt.sql.models.Sku :ivar kind: Kind of database. This is metadata used for the Azure portal experience. @@ -85,7 +95,8 @@ class Database(TrackedResource): 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', - 'Paused', 'Resuming', 'Scaling' + 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', + 'OnlineChangingDwPerformanceTiers' :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus :ivar database_id: The ID of the database. :vartype database_id: str @@ -146,6 +157,12 @@ class Database(TrackedResource): :type read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale :ivar current_sku: The name and tier of the SKU. :vartype current_sku: ~azure.mgmt.sql.models.Sku + :param auto_pause_delay: Time in minutes after which database is + automatically paused. A value of -1 means that automatic pause is disabled + :type auto_pause_delay: int + :param min_capacity: Minimal capacity that database will always have + allocated, if not paused + :type min_capacity: float """ _validation = { @@ -202,6 +219,8 @@ class Database(TrackedResource): 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'read_scale': {'key': 'properties.readScale', 'type': 'str'}, 'current_sku': {'key': 'properties.currentSku', 'type': 'Sku'}, + 'auto_pause_delay': {'key': 'properties.autoPauseDelay', 'type': 'int'}, + 'min_capacity': {'key': 'properties.minCapacity', 'type': 'float'}, } def __init__(self, **kwargs): @@ -235,3 +254,5 @@ def __init__(self, **kwargs): self.earliest_restore_date = None self.read_scale = kwargs.get('read_scale', None) self.current_sku = None + self.auto_pause_delay = kwargs.get('auto_pause_delay', None) + self.min_capacity = kwargs.get('min_capacity', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_py3.py index 9cfb4d07a7e6..5c4f3f5868d8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_py3.py @@ -30,7 +30,17 @@ class Database(TrackedResource): :type location: str :param tags: Resource tags. :type tags: dict[str, str] - :param sku: The name and tier of the SKU. + :param sku: The database SKU. + The list of SKUs may vary by region and support offer. To determine the + SKUs (including the SKU name, tier/edition, family, and capacity) that are + available to your subscription in an Azure region, use the + `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location + ```` :type sku: ~azure.mgmt.sql.models.Sku :ivar kind: Kind of database. This is metadata used for the Azure portal experience. @@ -85,7 +95,8 @@ class Database(TrackedResource): 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', - 'Paused', 'Resuming', 'Scaling' + 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', + 'OnlineChangingDwPerformanceTiers' :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus :ivar database_id: The ID of the database. :vartype database_id: str @@ -146,6 +157,12 @@ class Database(TrackedResource): :type read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale :ivar current_sku: The name and tier of the SKU. :vartype current_sku: ~azure.mgmt.sql.models.Sku + :param auto_pause_delay: Time in minutes after which database is + automatically paused. A value of -1 means that automatic pause is disabled + :type auto_pause_delay: int + :param min_capacity: Minimal capacity that database will always have + allocated, if not paused + :type min_capacity: float """ _validation = { @@ -202,9 +219,11 @@ class Database(TrackedResource): 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'read_scale': {'key': 'properties.readScale', 'type': 'str'}, 'current_sku': {'key': 'properties.currentSku', 'type': 'Sku'}, + 'auto_pause_delay': {'key': 'properties.autoPauseDelay', 'type': 'int'}, + 'min_capacity': {'key': 'properties.minCapacity', 'type': 'float'}, } - def __init__(self, *, location: str, tags=None, sku=None, create_mode=None, collation: str=None, max_size_bytes: int=None, sample_name=None, elastic_pool_id: str=None, source_database_id: str=None, restore_point_in_time=None, source_database_deletion_date=None, recovery_services_recovery_point_id: str=None, long_term_retention_backup_resource_id: str=None, recoverable_database_id: str=None, restorable_dropped_database_id: str=None, catalog_collation=None, zone_redundant: bool=None, license_type=None, read_scale=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, sku=None, create_mode=None, collation: str=None, max_size_bytes: int=None, sample_name=None, elastic_pool_id: str=None, source_database_id: str=None, restore_point_in_time=None, source_database_deletion_date=None, recovery_services_recovery_point_id: str=None, long_term_retention_backup_resource_id: str=None, recoverable_database_id: str=None, restorable_dropped_database_id: str=None, catalog_collation=None, zone_redundant: bool=None, license_type=None, read_scale=None, auto_pause_delay: int=None, min_capacity: float=None, **kwargs) -> None: super(Database, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.kind = None @@ -235,3 +254,5 @@ def __init__(self, *, location: str, tags=None, sku=None, create_mode=None, coll self.earliest_restore_date = None self.read_scale = read_scale self.current_sku = None + self.auto_pause_delay = auto_pause_delay + self.min_capacity = min_capacity diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py index d4d4cbdf4270..3d9d701da6ca 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update.py @@ -68,7 +68,8 @@ class DatabaseUpdate(Model): 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', - 'Paused', 'Resuming', 'Scaling' + 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', + 'OnlineChangingDwPerformanceTiers' :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus :ivar database_id: The ID of the database. :vartype database_id: str @@ -129,6 +130,12 @@ class DatabaseUpdate(Model): :type read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale :ivar current_sku: The name and tier of the SKU. :vartype current_sku: ~azure.mgmt.sql.models.Sku + :param auto_pause_delay: Time in minutes after which database is + automatically paused. A value of -1 means that automatic pause is disabled + :type auto_pause_delay: int + :param min_capacity: Minimal capacity that database will always have + allocated, if not paused + :type min_capacity: float :param tags: Resource tags. :type tags: dict[str, str] """ @@ -174,6 +181,8 @@ class DatabaseUpdate(Model): 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'read_scale': {'key': 'properties.readScale', 'type': 'str'}, 'current_sku': {'key': 'properties.currentSku', 'type': 'Sku'}, + 'auto_pause_delay': {'key': 'properties.autoPauseDelay', 'type': 'int'}, + 'min_capacity': {'key': 'properties.minCapacity', 'type': 'float'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -206,4 +215,6 @@ def __init__(self, **kwargs): self.earliest_restore_date = None self.read_scale = kwargs.get('read_scale', None) self.current_sku = None + self.auto_pause_delay = kwargs.get('auto_pause_delay', None) + self.min_capacity = kwargs.get('min_capacity', None) self.tags = kwargs.get('tags', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update_py3.py index 5a9a6f3b742d..080a1d783c1d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_update_py3.py @@ -68,7 +68,8 @@ class DatabaseUpdate(Model): 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', - 'Paused', 'Resuming', 'Scaling' + 'Paused', 'Resuming', 'Scaling', 'OfflineChangingDwPerformanceTiers', + 'OnlineChangingDwPerformanceTiers' :vartype status: str or ~azure.mgmt.sql.models.DatabaseStatus :ivar database_id: The ID of the database. :vartype database_id: str @@ -129,6 +130,12 @@ class DatabaseUpdate(Model): :type read_scale: str or ~azure.mgmt.sql.models.DatabaseReadScale :ivar current_sku: The name and tier of the SKU. :vartype current_sku: ~azure.mgmt.sql.models.Sku + :param auto_pause_delay: Time in minutes after which database is + automatically paused. A value of -1 means that automatic pause is disabled + :type auto_pause_delay: int + :param min_capacity: Minimal capacity that database will always have + allocated, if not paused + :type min_capacity: float :param tags: Resource tags. :type tags: dict[str, str] """ @@ -174,10 +181,12 @@ class DatabaseUpdate(Model): 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, 'read_scale': {'key': 'properties.readScale', 'type': 'str'}, 'current_sku': {'key': 'properties.currentSku', 'type': 'Sku'}, + 'auto_pause_delay': {'key': 'properties.autoPauseDelay', 'type': 'int'}, + 'min_capacity': {'key': 'properties.minCapacity', 'type': 'float'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, sku=None, create_mode=None, collation: str=None, max_size_bytes: int=None, sample_name=None, elastic_pool_id: str=None, source_database_id: str=None, restore_point_in_time=None, source_database_deletion_date=None, recovery_services_recovery_point_id: str=None, long_term_retention_backup_resource_id: str=None, recoverable_database_id: str=None, restorable_dropped_database_id: str=None, catalog_collation=None, zone_redundant: bool=None, license_type=None, read_scale=None, tags=None, **kwargs) -> None: + def __init__(self, *, sku=None, create_mode=None, collation: str=None, max_size_bytes: int=None, sample_name=None, elastic_pool_id: str=None, source_database_id: str=None, restore_point_in_time=None, source_database_deletion_date=None, recovery_services_recovery_point_id: str=None, long_term_retention_backup_resource_id: str=None, recoverable_database_id: str=None, restorable_dropped_database_id: str=None, catalog_collation=None, zone_redundant: bool=None, license_type=None, read_scale=None, auto_pause_delay: int=None, min_capacity: float=None, tags=None, **kwargs) -> None: super(DatabaseUpdate, self).__init__(**kwargs) self.sku = sku self.create_mode = create_mode @@ -206,4 +215,6 @@ def __init__(self, *, sku=None, create_mode=None, collation: str=None, max_size_ self.earliest_restore_date = None self.read_scale = read_scale self.current_sku = None + self.auto_pause_delay = auto_pause_delay + self.min_capacity = min_capacity self.tags = tags diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool.py index 10a28ea0f6e3..34926d4a176e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool.py @@ -30,7 +30,14 @@ class ElasticPool(TrackedResource): :type location: str :param tags: Resource tags. :type tags: dict[str, str] - :param sku: + :param sku: The elastic pool SKU. + The list of SKUs may vary by region and support offer. To determine the + SKUs (including the SKU name, tier/edition, family, and capacity) that are + available to your subscription in an Azure region, use the + `Capabilities_ListByLocation` REST API or the following command: + ```azurecli + az sql elastic-pool list-editions -l -o table + ```` :type sku: ~azure.mgmt.sql.models.Sku :ivar kind: Kind of elastic pool. This is metadata used for the Azure portal experience. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_py3.py index eb092529ac3b..d487ba2c7e28 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/elastic_pool_py3.py @@ -30,7 +30,14 @@ class ElasticPool(TrackedResource): :type location: str :param tags: Resource tags. :type tags: dict[str, str] - :param sku: + :param sku: The elastic pool SKU. + The list of SKUs may vary by region and support offer. To determine the + SKUs (including the SKU name, tier/edition, family, and capacity) that are + available to your subscription in an Azure region, use the + `Capabilities_ListByLocation` REST API or the following command: + ```azurecli + az sql elastic-pool list-editions -l -o table + ```` :type sku: ~azure.mgmt.sql.models.Sku :ivar kind: Kind of elastic pool. This is metadata used for the Azure portal experience. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request.py index a1683ffad9b4..b5598c478e76 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request.py @@ -37,9 +37,19 @@ class ImportRequest(ExportRequest): :param database_name: Required. The name of the database to import. :type database_name: str :param edition: Required. The edition for the database being created. - Possible values include: 'Web', 'Business', 'Basic', 'Standard', + The list of SKUs may vary by region and support offer. To determine the + SKUs (including the SKU name, tier/edition, family, and capacity) that are + available to your subscription in an Azure region, use the + `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location + ```` + . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', - 'System2' + 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' :type edition: str or ~azure.mgmt.sql.models.DatabaseEdition :param service_objective_name: Required. The name of the service objective to assign to the database. Possible values include: 'System', 'System0', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request_py3.py index 68b97ae814a3..915db6297521 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/import_request_py3.py @@ -37,9 +37,19 @@ class ImportRequest(ExportRequest): :param database_name: Required. The name of the database to import. :type database_name: str :param edition: Required. The edition for the database being created. - Possible values include: 'Web', 'Business', 'Basic', 'Standard', + The list of SKUs may vary by region and support offer. To determine the + SKUs (including the SKU name, tier/edition, family, and capacity) that are + available to your subscription in an Azure region, use the + `Capabilities_ListByLocation` REST API or one of the following commands: + ```azurecli + az sql db list-editions -l -o table + ```` + ```powershell + Get-AzSqlServerServiceObjective -Location + ```` + . Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', - 'System2' + 'System2', 'GeneralPurpose', 'BusinessCritical', 'Hyperscale' :type edition: str or ~azure.mgmt.sql.models.DatabaseEdition :param service_objective_name: Required. The name of the service objective to assign to the database. Possible values include: 'System', 'System0', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool.py new file mode 100644 index 000000000000..0171e141ba13 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool.py @@ -0,0 +1,74 @@ +# 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 .tracked_resource import TrackedResource + + +class InstancePool(TrackedResource): + """An Azure SQL instance pool. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param sku: The name and tier of the SKU. + :type sku: ~azure.mgmt.sql.models.Sku + :param subnet_id: Required. Resource ID of the subnet to place this + instance pool in. + :type subnet_id: str + :param v_cores: Required. Count of vCores belonging to this instance pool. + :type v_cores: int + :param license_type: Required. The license type. Possible values are + 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' + (without SQL license price). Possible values include: 'LicenseIncluded', + 'BasePrice' + :type license_type: str or ~azure.mgmt.sql.models.InstancePoolLicenseType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'subnet_id': {'required': True}, + 'v_cores': {'required': True}, + 'license_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'v_cores': {'key': 'properties.vCores', 'type': 'int'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(InstancePool, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.subnet_id = kwargs.get('subnet_id', None) + self.v_cores = kwargs.get('v_cores', None) + self.license_type = kwargs.get('license_type', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_paged.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_paged.py new file mode 100644 index 000000000000..e58684226691 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class InstancePoolPaged(Paged): + """ + A paging container for iterating over a list of :class:`InstancePool ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[InstancePool]'} + } + + def __init__(self, *args, **kwargs): + + super(InstancePoolPaged, self).__init__(*args, **kwargs) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_py3.py new file mode 100644 index 000000000000..9e211f8c118f --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_py3.py @@ -0,0 +1,74 @@ +# 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 .tracked_resource_py3 import TrackedResource + + +class InstancePool(TrackedResource): + """An Azure SQL instance pool. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param sku: The name and tier of the SKU. + :type sku: ~azure.mgmt.sql.models.Sku + :param subnet_id: Required. Resource ID of the subnet to place this + instance pool in. + :type subnet_id: str + :param v_cores: Required. Count of vCores belonging to this instance pool. + :type v_cores: int + :param license_type: Required. The license type. Possible values are + 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' + (without SQL license price). Possible values include: 'LicenseIncluded', + 'BasePrice' + :type license_type: str or ~azure.mgmt.sql.models.InstancePoolLicenseType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'subnet_id': {'required': True}, + 'v_cores': {'required': True}, + 'license_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'v_cores': {'key': 'properties.vCores', 'type': 'int'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + } + + def __init__(self, *, location: str, subnet_id: str, v_cores: int, license_type, tags=None, sku=None, **kwargs) -> None: + super(InstancePool, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.subnet_id = subnet_id + self.v_cores = v_cores + self.license_type = license_type diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update.py new file mode 100644 index 000000000000..39bf79911fd6 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update.py @@ -0,0 +1,28 @@ +# 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 msrest.serialization import Model + + +class InstancePoolUpdate(Model): + """An update to an Instance pool. + + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(InstancePoolUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update_py3.py new file mode 100644 index 000000000000..4b4c8c3dd908 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/instance_pool_update_py3.py @@ -0,0 +1,28 @@ +# 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 msrest.serialization import Model + + +class InstancePoolUpdate(Model): + """An update to an Instance pool. + + :param tags: Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(InstancePoolUpdate, self).__init__(**kwargs) + self.tags = tags diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py index cf680e0ddac0..309df9ce615a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance.py @@ -33,8 +33,17 @@ class ManagedInstance(TrackedResource): :param identity: The Azure Active Directory identity of the managed instance. :type identity: ~azure.mgmt.sql.models.ResourceIdentity - :param sku: Managed instance sku + :param sku: Managed instance SKU. Allowed values for sku.name: GP_Gen4, + GP_Gen5, BC_Gen4, BC_Gen5 :type sku: ~azure.mgmt.sql.models.Sku + :param managed_instance_create_mode: Specifies the mode of database + creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific + point in time. RestorePointInTime and SourceManagedInstanceId must be + specified. Possible values include: 'Default', 'PointInTimeRestore' + :type managed_instance_create_mode: str or + ~azure.mgmt.sql.models.ManagedServerCreateMode :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance. :vartype fully_qualified_domain_name: str @@ -50,11 +59,16 @@ class ManagedInstance(TrackedResource): :ivar state: The state of the managed instance. :vartype state: str :param license_type: The license type. Possible values are - 'LicenseIncluded' and 'BasePrice'. - :type license_type: str - :param v_cores: The number of VCores. + 'LicenseIncluded' (regular price inclusive of a new SQL license) and + 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + Possible values include: 'LicenseIncluded', 'BasePrice' + :type license_type: str or + ~azure.mgmt.sql.models.ManagedInstanceLicenseType + :param v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, + 64, 80. :type v_cores: int - :param storage_size_in_gb: The maximum storage size in GB. + :param storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum + value: 8192. Increments of 32 GB allowed only. :type storage_size_in_gb: int :param collation: Collation of the managed instance. :type collation: str @@ -66,6 +80,12 @@ class ManagedInstance(TrackedResource): :param public_data_endpoint_enabled: Whether or not the public data endpoint is enabled. :type public_data_endpoint_enabled: bool + :param source_managed_instance_id: The resource identifier of the source + managed instance associated with create operation of this instance. + :type source_managed_instance_id: str + :param restore_point_in_time: Specifies the point in time (ISO8601 format) + of the source database that will be restored to create the new database. + :type restore_point_in_time: datetime :param proxy_override: Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' :type proxy_override: str or @@ -83,6 +103,9 @@ class ManagedInstance(TrackedResource): An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". :type timezone_id: str + :param instance_pool_id: The Id of the instance pool this managed server + belongs to. + :type instance_pool_id: str """ _validation = { @@ -103,6 +126,7 @@ class ManagedInstance(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'managed_instance_create_mode': {'key': 'properties.managedInstanceCreateMode', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, @@ -115,14 +139,18 @@ class ManagedInstance(TrackedResource): 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, 'public_data_endpoint_enabled': {'key': 'properties.publicDataEndpointEnabled', 'type': 'bool'}, + 'source_managed_instance_id': {'key': 'properties.sourceManagedInstanceId', 'type': 'str'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, + 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, } def __init__(self, **kwargs): super(ManagedInstance, self).__init__(**kwargs) self.identity = kwargs.get('identity', None) self.sku = kwargs.get('sku', None) + self.managed_instance_create_mode = kwargs.get('managed_instance_create_mode', None) self.fully_qualified_domain_name = None self.administrator_login = kwargs.get('administrator_login', None) self.administrator_login_password = kwargs.get('administrator_login_password', None) @@ -135,5 +163,8 @@ def __init__(self, **kwargs): self.dns_zone = None self.dns_zone_partner = kwargs.get('dns_zone_partner', None) self.public_data_endpoint_enabled = kwargs.get('public_data_endpoint_enabled', None) + self.source_managed_instance_id = kwargs.get('source_managed_instance_id', None) + self.restore_point_in_time = kwargs.get('restore_point_in_time', None) self.proxy_override = kwargs.get('proxy_override', None) self.timezone_id = kwargs.get('timezone_id', None) + self.instance_pool_id = kwargs.get('instance_pool_id', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py index 9233da80dae4..01bfe2801b29 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_py3.py @@ -33,8 +33,17 @@ class ManagedInstance(TrackedResource): :param identity: The Azure Active Directory identity of the managed instance. :type identity: ~azure.mgmt.sql.models.ResourceIdentity - :param sku: Managed instance sku + :param sku: Managed instance SKU. Allowed values for sku.name: GP_Gen4, + GP_Gen5, BC_Gen4, BC_Gen5 :type sku: ~azure.mgmt.sql.models.Sku + :param managed_instance_create_mode: Specifies the mode of database + creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific + point in time. RestorePointInTime and SourceManagedInstanceId must be + specified. Possible values include: 'Default', 'PointInTimeRestore' + :type managed_instance_create_mode: str or + ~azure.mgmt.sql.models.ManagedServerCreateMode :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance. :vartype fully_qualified_domain_name: str @@ -50,11 +59,16 @@ class ManagedInstance(TrackedResource): :ivar state: The state of the managed instance. :vartype state: str :param license_type: The license type. Possible values are - 'LicenseIncluded' and 'BasePrice'. - :type license_type: str - :param v_cores: The number of VCores. + 'LicenseIncluded' (regular price inclusive of a new SQL license) and + 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + Possible values include: 'LicenseIncluded', 'BasePrice' + :type license_type: str or + ~azure.mgmt.sql.models.ManagedInstanceLicenseType + :param v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, + 64, 80. :type v_cores: int - :param storage_size_in_gb: The maximum storage size in GB. + :param storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum + value: 8192. Increments of 32 GB allowed only. :type storage_size_in_gb: int :param collation: Collation of the managed instance. :type collation: str @@ -66,6 +80,12 @@ class ManagedInstance(TrackedResource): :param public_data_endpoint_enabled: Whether or not the public data endpoint is enabled. :type public_data_endpoint_enabled: bool + :param source_managed_instance_id: The resource identifier of the source + managed instance associated with create operation of this instance. + :type source_managed_instance_id: str + :param restore_point_in_time: Specifies the point in time (ISO8601 format) + of the source database that will be restored to create the new database. + :type restore_point_in_time: datetime :param proxy_override: Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' :type proxy_override: str or @@ -83,6 +103,9 @@ class ManagedInstance(TrackedResource): An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". :type timezone_id: str + :param instance_pool_id: The Id of the instance pool this managed server + belongs to. + :type instance_pool_id: str """ _validation = { @@ -103,6 +126,7 @@ class ManagedInstance(TrackedResource): 'tags': {'key': 'tags', 'type': '{str}'}, 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, 'sku': {'key': 'sku', 'type': 'Sku'}, + 'managed_instance_create_mode': {'key': 'properties.managedInstanceCreateMode', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, @@ -115,14 +139,18 @@ class ManagedInstance(TrackedResource): 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, 'public_data_endpoint_enabled': {'key': 'properties.publicDataEndpointEnabled', 'type': 'bool'}, + 'source_managed_instance_id': {'key': 'properties.sourceManagedInstanceId', 'type': 'str'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, + 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, identity=None, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, public_data_endpoint_enabled: bool=None, proxy_override=None, timezone_id: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, identity=None, sku=None, managed_instance_create_mode=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, public_data_endpoint_enabled: bool=None, source_managed_instance_id: str=None, restore_point_in_time=None, proxy_override=None, timezone_id: str=None, instance_pool_id: str=None, **kwargs) -> None: super(ManagedInstance, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.sku = sku + self.managed_instance_create_mode = managed_instance_create_mode self.fully_qualified_domain_name = None self.administrator_login = administrator_login self.administrator_login_password = administrator_login_password @@ -135,5 +163,8 @@ def __init__(self, *, location: str, tags=None, identity=None, sku=None, adminis self.dns_zone = None self.dns_zone_partner = dns_zone_partner self.public_data_endpoint_enabled = public_data_endpoint_enabled + self.source_managed_instance_id = source_managed_instance_id + self.restore_point_in_time = restore_point_in_time self.proxy_override = proxy_override self.timezone_id = timezone_id + self.instance_pool_id = instance_pool_id diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py index e3c543f0a6b1..d4d9bf3ba75d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update.py @@ -20,6 +20,14 @@ class ManagedInstanceUpdate(Model): :param sku: Managed instance sku :type sku: ~azure.mgmt.sql.models.Sku + :param managed_instance_create_mode: Specifies the mode of database + creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific + point in time. RestorePointInTime and SourceManagedInstanceId must be + specified. Possible values include: 'Default', 'PointInTimeRestore' + :type managed_instance_create_mode: str or + ~azure.mgmt.sql.models.ManagedServerCreateMode :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance. :vartype fully_qualified_domain_name: str @@ -35,11 +43,16 @@ class ManagedInstanceUpdate(Model): :ivar state: The state of the managed instance. :vartype state: str :param license_type: The license type. Possible values are - 'LicenseIncluded' and 'BasePrice'. - :type license_type: str - :param v_cores: The number of VCores. + 'LicenseIncluded' (regular price inclusive of a new SQL license) and + 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + Possible values include: 'LicenseIncluded', 'BasePrice' + :type license_type: str or + ~azure.mgmt.sql.models.ManagedInstanceLicenseType + :param v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, + 64, 80. :type v_cores: int - :param storage_size_in_gb: The maximum storage size in GB. + :param storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum + value: 8192. Increments of 32 GB allowed only. :type storage_size_in_gb: int :param collation: Collation of the managed instance. :type collation: str @@ -51,6 +64,12 @@ class ManagedInstanceUpdate(Model): :param public_data_endpoint_enabled: Whether or not the public data endpoint is enabled. :type public_data_endpoint_enabled: bool + :param source_managed_instance_id: The resource identifier of the source + managed instance associated with create operation of this instance. + :type source_managed_instance_id: str + :param restore_point_in_time: Specifies the point in time (ISO8601 format) + of the source database that will be restored to create the new database. + :type restore_point_in_time: datetime :param proxy_override: Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' :type proxy_override: str or @@ -68,6 +87,9 @@ class ManagedInstanceUpdate(Model): An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". :type timezone_id: str + :param instance_pool_id: The Id of the instance pool this managed server + belongs to. + :type instance_pool_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -80,6 +102,7 @@ class ManagedInstanceUpdate(Model): _attribute_map = { 'sku': {'key': 'sku', 'type': 'Sku'}, + 'managed_instance_create_mode': {'key': 'properties.managedInstanceCreateMode', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, @@ -92,14 +115,18 @@ class ManagedInstanceUpdate(Model): 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, 'public_data_endpoint_enabled': {'key': 'properties.publicDataEndpointEnabled', 'type': 'bool'}, + 'source_managed_instance_id': {'key': 'properties.sourceManagedInstanceId', 'type': 'str'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, + 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__(self, **kwargs): super(ManagedInstanceUpdate, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) + self.managed_instance_create_mode = kwargs.get('managed_instance_create_mode', None) self.fully_qualified_domain_name = None self.administrator_login = kwargs.get('administrator_login', None) self.administrator_login_password = kwargs.get('administrator_login_password', None) @@ -112,6 +139,9 @@ def __init__(self, **kwargs): self.dns_zone = None self.dns_zone_partner = kwargs.get('dns_zone_partner', None) self.public_data_endpoint_enabled = kwargs.get('public_data_endpoint_enabled', None) + self.source_managed_instance_id = kwargs.get('source_managed_instance_id', None) + self.restore_point_in_time = kwargs.get('restore_point_in_time', None) self.proxy_override = kwargs.get('proxy_override', None) self.timezone_id = kwargs.get('timezone_id', None) + self.instance_pool_id = kwargs.get('instance_pool_id', None) self.tags = kwargs.get('tags', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py index 4a2e6aa0bd78..d18fe0b5da00 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_update_py3.py @@ -20,6 +20,14 @@ class ManagedInstanceUpdate(Model): :param sku: Managed instance sku :type sku: ~azure.mgmt.sql.models.Sku + :param managed_instance_create_mode: Specifies the mode of database + creation. + Default: Regular instance creation. + Restore: Creates an instance by restoring a set of backups to specific + point in time. RestorePointInTime and SourceManagedInstanceId must be + specified. Possible values include: 'Default', 'PointInTimeRestore' + :type managed_instance_create_mode: str or + ~azure.mgmt.sql.models.ManagedServerCreateMode :ivar fully_qualified_domain_name: The fully qualified domain name of the managed instance. :vartype fully_qualified_domain_name: str @@ -35,11 +43,16 @@ class ManagedInstanceUpdate(Model): :ivar state: The state of the managed instance. :vartype state: str :param license_type: The license type. Possible values are - 'LicenseIncluded' and 'BasePrice'. - :type license_type: str - :param v_cores: The number of VCores. + 'LicenseIncluded' (regular price inclusive of a new SQL license) and + 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + Possible values include: 'LicenseIncluded', 'BasePrice' + :type license_type: str or + ~azure.mgmt.sql.models.ManagedInstanceLicenseType + :param v_cores: The number of vCores. Allowed values: 8, 16, 24, 32, 40, + 64, 80. :type v_cores: int - :param storage_size_in_gb: The maximum storage size in GB. + :param storage_size_in_gb: Storage size in GB. Minimum value: 32. Maximum + value: 8192. Increments of 32 GB allowed only. :type storage_size_in_gb: int :param collation: Collation of the managed instance. :type collation: str @@ -51,6 +64,12 @@ class ManagedInstanceUpdate(Model): :param public_data_endpoint_enabled: Whether or not the public data endpoint is enabled. :type public_data_endpoint_enabled: bool + :param source_managed_instance_id: The resource identifier of the source + managed instance associated with create operation of this instance. + :type source_managed_instance_id: str + :param restore_point_in_time: Specifies the point in time (ISO8601 format) + of the source database that will be restored to create the new database. + :type restore_point_in_time: datetime :param proxy_override: Connection type used for connecting to the instance. Possible values include: 'Proxy', 'Redirect', 'Default' :type proxy_override: str or @@ -68,6 +87,9 @@ class ManagedInstanceUpdate(Model): An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". :type timezone_id: str + :param instance_pool_id: The Id of the instance pool this managed server + belongs to. + :type instance_pool_id: str :param tags: Resource tags. :type tags: dict[str, str] """ @@ -80,6 +102,7 @@ class ManagedInstanceUpdate(Model): _attribute_map = { 'sku': {'key': 'sku', 'type': 'Sku'}, + 'managed_instance_create_mode': {'key': 'properties.managedInstanceCreateMode', 'type': 'str'}, 'fully_qualified_domain_name': {'key': 'properties.fullyQualifiedDomainName', 'type': 'str'}, 'administrator_login': {'key': 'properties.administratorLogin', 'type': 'str'}, 'administrator_login_password': {'key': 'properties.administratorLoginPassword', 'type': 'str'}, @@ -92,14 +115,18 @@ class ManagedInstanceUpdate(Model): 'dns_zone': {'key': 'properties.dnsZone', 'type': 'str'}, 'dns_zone_partner': {'key': 'properties.dnsZonePartner', 'type': 'str'}, 'public_data_endpoint_enabled': {'key': 'properties.publicDataEndpointEnabled', 'type': 'bool'}, + 'source_managed_instance_id': {'key': 'properties.sourceManagedInstanceId', 'type': 'str'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, + 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, sku=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type: str=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, public_data_endpoint_enabled: bool=None, proxy_override=None, timezone_id: str=None, tags=None, **kwargs) -> None: + def __init__(self, *, sku=None, managed_instance_create_mode=None, administrator_login: str=None, administrator_login_password: str=None, subnet_id: str=None, license_type=None, v_cores: int=None, storage_size_in_gb: int=None, collation: str=None, dns_zone_partner: str=None, public_data_endpoint_enabled: bool=None, source_managed_instance_id: str=None, restore_point_in_time=None, proxy_override=None, timezone_id: str=None, instance_pool_id: str=None, tags=None, **kwargs) -> None: super(ManagedInstanceUpdate, self).__init__(**kwargs) self.sku = sku + self.managed_instance_create_mode = managed_instance_create_mode self.fully_qualified_domain_name = None self.administrator_login = administrator_login self.administrator_login_password = administrator_login_password @@ -112,6 +139,9 @@ def __init__(self, *, sku=None, administrator_login: str=None, administrator_log self.dns_zone = None self.dns_zone_partner = dns_zone_partner self.public_data_endpoint_enabled = public_data_endpoint_enabled + self.source_managed_instance_id = source_managed_instance_id + self.restore_point_in_time = restore_point_in_time self.proxy_override = proxy_override self.timezone_id = timezone_id + self.instance_pool_id = instance_pool_id self.tags = tags diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py index 0d80a9a31ac9..e7668f77203f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool.py @@ -26,7 +26,8 @@ class RecommendedElasticPool(ProxyResource): :vartype type: str :ivar database_edition: The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible - values include: 'Basic', 'Standard', 'Premium' + values include: 'Basic', 'Standard', 'Premium', 'GeneralPurpose', + 'BusinessCritical' :vartype database_edition: str or ~azure.mgmt.sql.models.ElasticPoolEdition :param dtu: The DTU for the recommended elastic pool. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py index 2f8a14d6abfa..75250679f962 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/recommended_elastic_pool_py3.py @@ -26,7 +26,8 @@ class RecommendedElasticPool(ProxyResource): :vartype type: str :ivar database_edition: The edition of the recommended elastic pool. The ElasticPoolEdition enumeration contains all the valid editions. Possible - values include: 'Basic', 'Standard', 'Premium' + values include: 'Basic', 'Standard', 'Premium', 'GeneralPurpose', + 'BusinessCritical' :vartype database_edition: str or ~azure.mgmt.sql.models.ElasticPoolEdition :param dtu: The DTU for the recommended elastic pool. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py index a076a11634e6..f90c8df70211 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label.py @@ -32,12 +32,17 @@ class SensitivityLabel(ProxyResource): :type information_type: str :param information_type_id: The information type ID. :type information_type_id: str + :ivar is_disabled: Is sensitivity recommendation disabled. Applicable for + recommended sensitivity label only. Specifies whether the sensitivity + recommendation on this column is disabled (dismissed) or not. + :vartype is_disabled: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'is_disabled': {'readonly': True}, } _attribute_map = { @@ -48,6 +53,7 @@ class SensitivityLabel(ProxyResource): 'label_id': {'key': 'properties.labelId', 'type': 'str'}, 'information_type': {'key': 'properties.informationType', 'type': 'str'}, 'information_type_id': {'key': 'properties.informationTypeId', 'type': 'str'}, + 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, } def __init__(self, **kwargs): @@ -56,3 +62,4 @@ def __init__(self, **kwargs): self.label_id = kwargs.get('label_id', None) self.information_type = kwargs.get('information_type', None) self.information_type_id = kwargs.get('information_type_id', None) + self.is_disabled = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py index f304363d916b..e659d9b977c8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sensitivity_label_py3.py @@ -32,12 +32,17 @@ class SensitivityLabel(ProxyResource): :type information_type: str :param information_type_id: The information type ID. :type information_type_id: str + :ivar is_disabled: Is sensitivity recommendation disabled. Applicable for + recommended sensitivity label only. Specifies whether the sensitivity + recommendation on this column is disabled (dismissed) or not. + :vartype is_disabled: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'is_disabled': {'readonly': True}, } _attribute_map = { @@ -48,6 +53,7 @@ class SensitivityLabel(ProxyResource): 'label_id': {'key': 'properties.labelId', 'type': 'str'}, 'information_type': {'key': 'properties.informationType', 'type': 'str'}, 'information_type_id': {'key': 'properties.informationTypeId', 'type': 'str'}, + 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, } def __init__(self, *, label_name: str=None, label_id: str=None, information_type: str=None, information_type_id: str=None, **kwargs) -> None: @@ -56,3 +62,4 @@ def __init__(self, *, label_name: str=None, label_id: str=None, information_type self.label_id = label_id self.information_type = information_type self.information_type_id = information_type_id + self.is_disabled = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index de1d73caf27c..4cd0679ae1c3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -85,6 +85,9 @@ class DatabaseEdition(str, Enum): data_warehouse = "DataWarehouse" system = "System" system2 = "System2" + general_purpose = "GeneralPurpose" + business_critical = "BusinessCritical" + hyperscale = "Hyperscale" class ServiceObjectiveName(str, Enum): @@ -203,6 +206,8 @@ class ElasticPoolEdition(str, Enum): basic = "Basic" standard = "Standard" premium = "Premium" + general_purpose = "GeneralPurpose" + business_critical = "BusinessCritical" class ReplicationRole(str, Enum): @@ -325,6 +330,18 @@ class IdentityType(str, Enum): system_assigned = "SystemAssigned" +class ManagedServerCreateMode(str, Enum): + + default = "Default" + point_in_time_restore = "PointInTimeRestore" + + +class ManagedInstanceLicenseType(str, Enum): + + license_included = "LicenseIncluded" + base_price = "BasePrice" + + class ManagedInstanceProxyOverride(str, Enum): proxy = "Proxy" @@ -612,6 +629,8 @@ class DatabaseStatus(str, Enum): paused = "Paused" resuming = "Resuming" scaling = "Scaling" + offline_changing_dw_performance_tiers = "OfflineChangingDwPerformanceTiers" + online_changing_dw_performance_tiers = "OnlineChangingDwPerformanceTiers" class DatabaseLicenseType(str, Enum): @@ -659,6 +678,12 @@ class InstanceFailoverGroupReplicationRole(str, Enum): secondary = "Secondary" +class InstancePoolLicenseType(str, Enum): + + license_included = "LicenseIncluded" + base_price = "BasePrice" + + class LongTermRetentionDatabaseState(str, Enum): all = "All" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 3db410ac9cd7..181bcb7694e4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -89,6 +89,7 @@ from .managed_instance_vulnerability_assessments_operations import ManagedInstanceVulnerabilityAssessmentsOperations from .server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations from .managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations +from .instance_pools_operations import InstancePoolsOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -171,4 +172,5 @@ 'ManagedInstanceVulnerabilityAssessmentsOperations', 'ServerVulnerabilityAssessmentsOperations', 'ManagedDatabaseSensitivityLabelsOperations', + 'InstancePoolsOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/instance_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/instance_pools_operations.py new file mode 100644 index 000000000000..3407dcf4ae42 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/instance_pools_operations.py @@ -0,0 +1,529 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class InstancePoolsOperations(object): + """InstancePoolsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def get( + self, resource_group_name, instance_pool_name, custom_headers=None, raw=False, **operation_config): + """Gets an instance pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The name of the instance pool to be + retrieved. + :type instance_pool_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: InstancePool or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.InstancePool or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InstancePool', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}'} + + + def _create_or_update_initial( + self, resource_group_name, instance_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'InstancePool') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InstancePool', response) + if response.status_code == 201: + deserialized = self._deserialize('InstancePool', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, instance_pool_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates an instance pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The name of the instance pool to be created + or updated. + :type instance_pool_name: str + :param parameters: The requested instance pool resource state. + :type parameters: ~azure.mgmt.sql.models.InstancePool + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns InstancePool or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.InstancePool] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.InstancePool]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + instance_pool_name=instance_pool_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('InstancePool', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}'} + + + def _delete_initial( + self, resource_group_name, instance_pool_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, instance_pool_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes an instance pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The name of the instance pool to be deleted + :type instance_pool_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + instance_pool_name=instance_pool_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}'} + + + def _update_initial( + self, resource_group_name, instance_pool_name, tags=None, custom_headers=None, raw=False, **operation_config): + parameters = models.InstancePoolUpdate(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'InstancePoolUpdate') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('InstancePool', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, instance_pool_name, tags=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Updates an instance pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The name of the instance pool to be + updated. + :type instance_pool_name: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns InstancePool or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.InstancePool] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.InstancePool]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + instance_pool_name=instance_pool_name, + tags=tags, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('InstancePool', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of instance pools in the resource group. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of InstancePool + :rtype: + ~azure.mgmt.sql.models.InstancePoolPaged[~azure.mgmt.sql.models.InstancePool] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.InstancePoolPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.InstancePoolPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of all instance pools in the subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of InstancePool + :rtype: + ~azure.mgmt.sql.models.InstancePoolPaged[~azure.mgmt.sql.models.InstancePool] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.InstancePoolPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.InstancePoolPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py index 1b03564854f8..1708e44edf86 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_database_sensitivity_labels_operations.py @@ -24,7 +24,6 @@ class ManagedDatabaseSensitivityLabelsOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". - :ivar sensitivity_label_source: The source of the sensitivity label. Constant value: "current". """ models = models @@ -35,7 +34,6 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.api_version = "2018-06-01-preview" - self.sensitivity_label_source = "current" self.config = config @@ -150,6 +148,8 @@ def create_or_update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + sensitivity_label_source = "current" + # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -159,7 +159,7 @@ def create_or_update( 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), 'tableName': self._serialize.url("table_name", table_name, 'str'), 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -232,6 +232,8 @@ def delete( :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + sensitivity_label_source = "current" + # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -241,7 +243,7 @@ def delete( 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), 'tableName': self._serialize.url("table_name", table_name, 'str'), 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -273,6 +275,147 @@ def delete( return client_raw_response delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + def disable_recommendation( + self, resource_group_name, managed_instance_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Disables sensitivity recommendations on a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + sensitivity_label_source = "recommended" + + # Construct URL + url = self.disable_recommendation.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + disable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable'} + + def enable_recommendation( + self, resource_group_name, managed_instance_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Enables sensitivity recommendations on a given column (recommendations + are enabled by default on all columns). + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + sensitivity_label_source = "recommended" + + # Construct URL + url = self.enable_recommendation.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable'} + def list_current_by_database( self, resource_group_name, managed_instance_name, database_name, filter=None, custom_headers=None, raw=False, **operation_config): """Gets the sensitivity labels of a given database. @@ -354,7 +497,7 @@ def internal_paging(next_link=None, raw=False): list_current_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels'} def list_recommended_by_database( - self, resource_group_name, managed_instance_name, database_name, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, managed_instance_name, database_name, include_disabled_recommendations=None, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): """Gets the sensitivity labels of a given database. :param resource_group_name: The name of the resource group that @@ -365,6 +508,9 @@ def list_recommended_by_database( :type managed_instance_name: str :param database_name: The name of the database. :type database_name: str + :param include_disabled_recommendations: Specifies whether to include + disabled recommendations or not. + :type include_disabled_recommendations: bool :param skip_token: :type skip_token: str :param filter: An OData filter expression that filters elements in the @@ -395,6 +541,8 @@ def internal_paging(next_link=None, raw=False): # Construct parameters query_parameters = {} + if include_disabled_recommendations is not None: + query_parameters['includeDisabledRecommendations'] = self._serialize.query("include_disabled_recommendations", include_disabled_recommendations, 'bool') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') if filter is not None: diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py index 1fee247c7c96..a81663266c9a 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py @@ -39,70 +39,6 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def list( - self, custom_headers=None, raw=False, **operation_config): - """Gets a list of all managed instances in the subscription. - - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ManagedInstance - :rtype: - ~azure.mgmt.sql.models.ManagedInstancePaged[~azure.mgmt.sql.models.ManagedInstance] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances'} - def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): """Gets a list of managed instances in a resource group. @@ -522,3 +458,139 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}'} + + def list_by_instance_pool( + self, resource_group_name, instance_pool_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of all managed instances in an instance pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The instance pool name. + :type instance_pool_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedInstance + :rtype: + ~azure.mgmt.sql.models.ManagedInstancePaged[~azure.mgmt.sql.models.ManagedInstance] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance_pool.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances'} + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of all managed instances in the subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedInstance + :rtype: + ~azure.mgmt.sql.models.ManagedInstancePaged[~azure.mgmt.sql.models.ManagedInstance] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py index 5be551f7fd12..0e5b7cae9d25 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/sensitivity_labels_operations.py @@ -24,7 +24,6 @@ class SensitivityLabelsOperations(object): :param serializer: An object model serializer. :param deserializer: An object model deserializer. :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". - :ivar sensitivity_label_source: The source of the sensitivity label. Constant value: "current". """ models = models @@ -35,7 +34,6 @@ def __init__(self, client, config, serializer, deserializer): self._serialize = serializer self._deserialize = deserializer self.api_version = "2017-03-01-preview" - self.sensitivity_label_source = "current" self.config = config @@ -120,7 +118,7 @@ def internal_paging(next_link=None, raw=False): list_current_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/currentSensitivityLabels'} def list_recommended_by_database( - self, resource_group_name, server_name, database_name, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, server_name, database_name, include_disabled_recommendations=None, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): """Gets the sensitivity labels of a given database. :param resource_group_name: The name of the resource group that @@ -131,6 +129,9 @@ def list_recommended_by_database( :type server_name: str :param database_name: The name of the database. :type database_name: str + :param include_disabled_recommendations: Specifies whether to include + disabled recommendations or not. + :type include_disabled_recommendations: bool :param skip_token: :type skip_token: str :param filter: An OData filter expression that filters elements in the @@ -161,6 +162,8 @@ def internal_paging(next_link=None, raw=False): # Construct parameters query_parameters = {} + if include_disabled_recommendations is not None: + query_parameters['includeDisabledRecommendations'] = self._serialize.query("include_disabled_recommendations", include_disabled_recommendations, 'bool') if skip_token is not None: query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') if filter is not None: @@ -203,6 +206,147 @@ def internal_paging(next_link=None, raw=False): return deserialized list_recommended_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/recommendedSensitivityLabels'} + def enable_recommendation( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Enables sensitivity recommendations on a given column (recommendations + are enabled by default on all columns). + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + sensitivity_label_source = "recommended" + + # Construct URL + url = self.enable_recommendation.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + enable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable'} + + def disable_recommendation( + self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + """Disables sensitivity recommendations on a given column. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database. + :type database_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + sensitivity_label_source = "recommended" + + # Construct URL + url = self.disable_recommendation.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), + 'tableName': self._serialize.url("table_name", table_name, 'str'), + 'columnName': self._serialize.url("column_name", column_name, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + disable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable'} + def get( self, resource_group_name, server_name, database_name, schema_name, table_name, column_name, sensitivity_label_source, custom_headers=None, raw=False, **operation_config): """Gets the sensitivity label of a given column. @@ -314,6 +458,8 @@ def create_or_update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + sensitivity_label_source = "current" + # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -323,7 +469,7 @@ def create_or_update( 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), 'tableName': self._serialize.url("table_name", table_name, 'str'), 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) @@ -396,6 +542,8 @@ def delete( :rtype: None or ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ + sensitivity_label_source = "current" + # Construct URL url = self.delete.metadata['url'] path_format_arguments = { @@ -405,7 +553,7 @@ def delete( 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), 'tableName': self._serialize.url("table_name", table_name, 'str'), 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("self.sensitivity_label_source", self.sensitivity_label_source, 'str'), + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') } url = self._client.format_url(url, **path_format_arguments) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index aae1ce917e14..02ab955e053d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -93,6 +93,7 @@ from .operations.managed_instance_vulnerability_assessments_operations import ManagedInstanceVulnerabilityAssessmentsOperations from .operations.server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations from .operations.managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations +from .operations.instance_pools_operations import InstancePoolsOperations from . import models @@ -295,6 +296,8 @@ class SqlManagementClient(SDKClient): :vartype server_vulnerability_assessments: azure.mgmt.sql.operations.ServerVulnerabilityAssessmentsOperations :ivar managed_database_sensitivity_labels: ManagedDatabaseSensitivityLabels operations :vartype managed_database_sensitivity_labels: azure.mgmt.sql.operations.ManagedDatabaseSensitivityLabelsOperations + :ivar instance_pools: InstancePools operations + :vartype instance_pools: azure.mgmt.sql.operations.InstancePoolsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -475,3 +478,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.managed_database_sensitivity_labels = ManagedDatabaseSensitivityLabelsOperations( self._client, self.config, self._serialize, self._deserialize) + self.instance_pools = InstancePoolsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/version.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/version.py index 9cb421fb381b..3697d9b71739 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/version.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/version.py @@ -9,4 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.12.0" +VERSION = "0.9.0" + From 0ff093cfffb1b02306b0cb5be6387a84433c0783 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 25 Jun 2019 13:37:52 -0700 Subject: [PATCH 2/8] [AutoPR sql/resource-manager] Add managed instances swagger to 2018-06-01-preview (#6075) * Generated from b7686a6e1f952f5232bd315382a2cb1547ff8648 Add managed instances swagger to 2018-06-01-preview - update examples + readme.md * Generated from 1b3affbe12db0534680b3a83f81c9a98b1cc3d59 Remove maintenance window setting properties from managed instance swaggers --- .../azure/mgmt/sql/models/__init__.py | 52 +++--- .../azure/mgmt/sql/models/name.py | 32 ++++ .../azure/mgmt/sql/models/name_py3.py | 32 ++++ .../sql/models/sql_management_client_enums.py | 48 +++--- .../azure/mgmt/sql/models/usage.py | 65 ++++++++ .../azure/mgmt/sql/models/usage_paged.py | 27 ++++ .../azure/mgmt/sql/models/usage_py3.py | 65 ++++++++ .../azure/mgmt/sql/operations/__init__.py | 6 +- .../managed_instances_operations.py | 148 +++++++++--------- .../mgmt/sql/operations/usages_operations.py | 116 ++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 15 +- 11 files changed, 479 insertions(+), 127 deletions(-) create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name_py3.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_paged.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_py3.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/usages_operations.py diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 837322623c9c..5312457b984e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -56,13 +56,10 @@ from .partner_info_py3 import PartnerInfo from .failover_group_py3 import FailoverGroup from .failover_group_update_py3 import FailoverGroupUpdate - from .resource_identity_py3 import ResourceIdentity - from .sku_py3 import Sku - from .managed_instance_py3 import ManagedInstance - from .managed_instance_update_py3 import ManagedInstanceUpdate from .operation_display_py3 import OperationDisplay from .operation_py3 import Operation from .server_key_py3 import ServerKey + from .resource_identity_py3 import ResourceIdentity from .server_py3 import Server from .server_update_py3 import ServerUpdate from .sync_agent_py3 import SyncAgent @@ -90,6 +87,7 @@ from .database_vulnerability_assessment_rule_baseline_py3 import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties_py3 import VulnerabilityAssessmentRecurringScansProperties from .database_vulnerability_assessment_py3 import DatabaseVulnerabilityAssessment + from .sku_py3 import Sku from .job_agent_py3 import JobAgent from .job_agent_update_py3 import JobAgentUpdate from .job_credential_py3 import JobCredential @@ -163,6 +161,10 @@ from .server_vulnerability_assessment_py3 import ServerVulnerabilityAssessment from .instance_pool_py3 import InstancePool from .instance_pool_update_py3 import InstancePoolUpdate + from .name_py3 import Name + from .usage_py3 import Usage + from .managed_instance_py3 import ManagedInstance + from .managed_instance_update_py3 import ManagedInstanceUpdate except (SyntaxError, ImportError): from .recoverable_database import RecoverableDatabase from .restorable_dropped_database import RestorableDroppedDatabase @@ -210,13 +212,10 @@ from .partner_info import PartnerInfo from .failover_group import FailoverGroup from .failover_group_update import FailoverGroupUpdate - from .resource_identity import ResourceIdentity - from .sku import Sku - from .managed_instance import ManagedInstance - from .managed_instance_update import ManagedInstanceUpdate from .operation_display import OperationDisplay from .operation import Operation from .server_key import ServerKey + from .resource_identity import ResourceIdentity from .server import Server from .server_update import ServerUpdate from .sync_agent import SyncAgent @@ -244,6 +243,7 @@ from .database_vulnerability_assessment_rule_baseline import DatabaseVulnerabilityAssessmentRuleBaseline from .vulnerability_assessment_recurring_scans_properties import VulnerabilityAssessmentRecurringScansProperties from .database_vulnerability_assessment import DatabaseVulnerabilityAssessment + from .sku import Sku from .job_agent import JobAgent from .job_agent_update import JobAgentUpdate from .job_credential import JobCredential @@ -317,6 +317,10 @@ from .server_vulnerability_assessment import ServerVulnerabilityAssessment from .instance_pool import InstancePool from .instance_pool_update import InstancePoolUpdate + from .name import Name + from .usage import Usage + from .managed_instance import ManagedInstance + from .managed_instance_update import ManagedInstanceUpdate from .recoverable_database_paged import RecoverableDatabasePaged from .restorable_dropped_database_paged import RestorableDroppedDatabasePaged from .server_paged import ServerPaged @@ -341,7 +345,6 @@ from .database_usage_paged import DatabaseUsagePaged from .encryption_protector_paged import EncryptionProtectorPaged from .failover_group_paged import FailoverGroupPaged -from .managed_instance_paged import ManagedInstancePaged from .operation_paged import OperationPaged from .server_key_paged import ServerKeyPaged from .sync_agent_paged import SyncAgentPaged @@ -383,6 +386,8 @@ from .managed_instance_vulnerability_assessment_paged import ManagedInstanceVulnerabilityAssessmentPaged from .server_vulnerability_assessment_paged import ServerVulnerabilityAssessmentPaged from .instance_pool_paged import InstancePoolPaged +from .usage_paged import UsagePaged +from .managed_instance_paged import ManagedInstancePaged from .sql_management_client_enums import ( CheckNameAvailabilityReason, ServerConnectionType, @@ -416,11 +421,8 @@ ReadWriteEndpointFailoverPolicy, ReadOnlyEndpointFailoverPolicy, FailoverGroupReplicationRole, - IdentityType, - ManagedServerCreateMode, - ManagedInstanceLicenseType, - ManagedInstanceProxyOverride, OperationOrigin, + IdentityType, SyncAgentState, SyncMemberDbType, SyncGroupLogType, @@ -461,6 +463,9 @@ VulnerabilityAssessmentScanState, InstanceFailoverGroupReplicationRole, InstancePoolLicenseType, + ManagedServerCreateMode, + ManagedInstanceLicenseType, + ManagedInstanceProxyOverride, LongTermRetentionDatabaseState, VulnerabilityAssessmentPolicyBaselineName, SensitivityLabelSource, @@ -514,13 +519,10 @@ 'PartnerInfo', 'FailoverGroup', 'FailoverGroupUpdate', - 'ResourceIdentity', - 'Sku', - 'ManagedInstance', - 'ManagedInstanceUpdate', 'OperationDisplay', 'Operation', 'ServerKey', + 'ResourceIdentity', 'Server', 'ServerUpdate', 'SyncAgent', @@ -548,6 +550,7 @@ 'DatabaseVulnerabilityAssessmentRuleBaseline', 'VulnerabilityAssessmentRecurringScansProperties', 'DatabaseVulnerabilityAssessment', + 'Sku', 'JobAgent', 'JobAgentUpdate', 'JobCredential', @@ -621,6 +624,10 @@ 'ServerVulnerabilityAssessment', 'InstancePool', 'InstancePoolUpdate', + 'Name', + 'Usage', + 'ManagedInstance', + 'ManagedInstanceUpdate', 'RecoverableDatabasePaged', 'RestorableDroppedDatabasePaged', 'ServerPaged', @@ -645,7 +652,6 @@ 'DatabaseUsagePaged', 'EncryptionProtectorPaged', 'FailoverGroupPaged', - 'ManagedInstancePaged', 'OperationPaged', 'ServerKeyPaged', 'SyncAgentPaged', @@ -687,6 +693,8 @@ 'ManagedInstanceVulnerabilityAssessmentPaged', 'ServerVulnerabilityAssessmentPaged', 'InstancePoolPaged', + 'UsagePaged', + 'ManagedInstancePaged', 'CheckNameAvailabilityReason', 'ServerConnectionType', 'SecurityAlertPolicyState', @@ -719,11 +727,8 @@ 'ReadWriteEndpointFailoverPolicy', 'ReadOnlyEndpointFailoverPolicy', 'FailoverGroupReplicationRole', - 'IdentityType', - 'ManagedServerCreateMode', - 'ManagedInstanceLicenseType', - 'ManagedInstanceProxyOverride', 'OperationOrigin', + 'IdentityType', 'SyncAgentState', 'SyncMemberDbType', 'SyncGroupLogType', @@ -764,6 +769,9 @@ 'VulnerabilityAssessmentScanState', 'InstanceFailoverGroupReplicationRole', 'InstancePoolLicenseType', + 'ManagedServerCreateMode', + 'ManagedInstanceLicenseType', + 'ManagedInstanceProxyOverride', 'LongTermRetentionDatabaseState', 'VulnerabilityAssessmentPolicyBaselineName', 'SensitivityLabelSource', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name.py new file mode 100644 index 000000000000..dda0902bb0ca --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name.py @@ -0,0 +1,32 @@ +# 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 msrest.serialization import Model + + +class Name(Model): + """ARM Usage Name. + + :param value: Usage name value + :type value: str + :param localized_value: Usage name localized value. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Name, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name_py3.py new file mode 100644 index 000000000000..d511591ba917 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/name_py3.py @@ -0,0 +1,32 @@ +# 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 msrest.serialization import Model + + +class Name(Model): + """ARM Usage Name. + + :param value: Usage name value + :type value: str + :param localized_value: Usage name localized value. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> None: + super(Name, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py index 4cd0679ae1c3..0ac10a4f69f8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/sql_management_client_enums.py @@ -325,36 +325,17 @@ class FailoverGroupReplicationRole(str, Enum): secondary = "Secondary" -class IdentityType(str, Enum): - - system_assigned = "SystemAssigned" - - -class ManagedServerCreateMode(str, Enum): - - default = "Default" - point_in_time_restore = "PointInTimeRestore" - - -class ManagedInstanceLicenseType(str, Enum): - - license_included = "LicenseIncluded" - base_price = "BasePrice" - - -class ManagedInstanceProxyOverride(str, Enum): - - proxy = "Proxy" - redirect = "Redirect" - default = "Default" - - class OperationOrigin(str, Enum): user = "user" system = "system" +class IdentityType(str, Enum): + + system_assigned = "SystemAssigned" + + class SyncAgentState(str, Enum): online = "Online" @@ -684,6 +665,25 @@ class InstancePoolLicenseType(str, Enum): base_price = "BasePrice" +class ManagedServerCreateMode(str, Enum): + + default = "Default" + point_in_time_restore = "PointInTimeRestore" + + +class ManagedInstanceLicenseType(str, Enum): + + license_included = "LicenseIncluded" + base_price = "BasePrice" + + +class ManagedInstanceProxyOverride(str, Enum): + + proxy = "Proxy" + redirect = "Redirect" + default = "Default" + + class LongTermRetentionDatabaseState(str, Enum): all = "All" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage.py new file mode 100644 index 000000000000..66557ba6dac6 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage.py @@ -0,0 +1,65 @@ +# 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 msrest.serialization import Model + + +class Usage(Model): + """ARM usage. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: ~azure.mgmt.sql.models.Name + :ivar type: Resource type. + :vartype type: str + :ivar unit: Usage unit. + :vartype unit: str + :ivar current_value: Usage current value. + :vartype current_value: int + :ivar limit: Usage limit. + :vartype limit: int + :ivar requested_limit: Usage requested limit. + :vartype requested_limit: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'unit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'limit': {'readonly': True}, + 'requested_limit': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'Name'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'requested_limit': {'key': 'requestedLimit', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(Usage, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.unit = None + self.current_value = None + self.limit = None + self.requested_limit = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_paged.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_paged.py new file mode 100644 index 000000000000..fa0ce40bacd0 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class UsagePaged(Paged): + """ + A paging container for iterating over a list of :class:`Usage ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Usage]'} + } + + def __init__(self, *args, **kwargs): + + super(UsagePaged, self).__init__(*args, **kwargs) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_py3.py new file mode 100644 index 000000000000..9841078a029e --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/usage_py3.py @@ -0,0 +1,65 @@ +# 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 msrest.serialization import Model + + +class Usage(Model): + """ARM usage. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: ~azure.mgmt.sql.models.Name + :ivar type: Resource type. + :vartype type: str + :ivar unit: Usage unit. + :vartype unit: str + :ivar current_value: Usage current value. + :vartype current_value: int + :ivar limit: Usage limit. + :vartype limit: int + :ivar requested_limit: Usage requested limit. + :vartype requested_limit: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'unit': {'readonly': True}, + 'current_value': {'readonly': True}, + 'limit': {'readonly': True}, + 'requested_limit': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'Name'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'requested_limit': {'key': 'requestedLimit', 'type': 'int'}, + } + + def __init__(self, **kwargs) -> None: + super(Usage, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.unit = None + self.current_value = None + self.limit = None + self.requested_limit = None diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index 181bcb7694e4..b5f1cf999537 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -35,7 +35,6 @@ from .database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .encryption_protectors_operations import EncryptionProtectorsOperations from .failover_groups_operations import FailoverGroupsOperations -from .managed_instances_operations import ManagedInstancesOperations from .operations import Operations from .server_keys_operations import ServerKeysOperations from .sync_agents_operations import SyncAgentsOperations @@ -90,6 +89,8 @@ from .server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations from .managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations from .instance_pools_operations import InstancePoolsOperations +from .usages_operations import UsagesOperations +from .managed_instances_operations import ManagedInstancesOperations __all__ = [ 'RecoverableDatabasesOperations', @@ -118,7 +119,6 @@ 'DatabaseAutomaticTuningOperations', 'EncryptionProtectorsOperations', 'FailoverGroupsOperations', - 'ManagedInstancesOperations', 'Operations', 'ServerKeysOperations', 'SyncAgentsOperations', @@ -173,4 +173,6 @@ 'ServerVulnerabilityAssessmentsOperations', 'ManagedDatabaseSensitivityLabelsOperations', 'InstancePoolsOperations', + 'UsagesOperations', + 'ManagedInstancesOperations', ] diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py index a81663266c9a..57cb6850802f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instances_operations.py @@ -25,7 +25,7 @@ class ManagedInstancesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for the request. Constant value: "2015-05-01-preview". + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". """ models = models @@ -35,10 +35,82 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2015-05-01-preview" + self.api_version = "2018-06-01-preview" self.config = config + def list_by_instance_pool( + self, resource_group_name, instance_pool_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of all managed instances in an instance pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The instance pool name. + :type instance_pool_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedInstance + :rtype: + ~azure.mgmt.sql.models.ManagedInstancePaged[~azure.mgmt.sql.models.ManagedInstance] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance_pool.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances'} + def list_by_resource_group( self, resource_group_name, custom_headers=None, raw=False, **operation_config): """Gets a list of managed instances in a resource group. @@ -459,78 +531,6 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}'} - def list_by_instance_pool( - self, resource_group_name, instance_pool_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of all managed instances in an instance pool. - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param instance_pool_name: The instance pool name. - :type instance_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ManagedInstance - :rtype: - ~azure.mgmt.sql.models.ManagedInstancePaged[~azure.mgmt.sql.models.ManagedInstance] - :raises: :class:`CloudError` - """ - def internal_paging(next_link=None, raw=False): - - if not next_link: - # Construct URL - url = self.list_by_instance_pool.metadata['url'] - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - deserialized = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies) - - if raw: - header_dict = {} - client_raw_response = models.ManagedInstancePaged(internal_paging, self._deserialize.dependencies, header_dict) - return client_raw_response - - return deserialized - list_by_instance_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/managedInstances'} - def list( self, custom_headers=None, raw=False, **operation_config): """Gets a list of all managed instances in the subscription. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/usages_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/usages_operations.py new file mode 100644 index 000000000000..a22920193bd0 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/usages_operations.py @@ -0,0 +1,116 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class UsagesOperations(object): + """UsagesOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2018-06-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2018-06-01-preview" + + self.config = config + + def list_by_instance_pool( + self, resource_group_name, instance_pool_name, expand_children=None, custom_headers=None, raw=False, **operation_config): + """Gets all instance pool usage metrics. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param instance_pool_name: The name of the instance pool to be + retrieved. + :type instance_pool_name: str + :param expand_children: Optional request parameter to include managed + instance usages within the instance pool. + :type expand_children: bool + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Usage + :rtype: + ~azure.mgmt.sql.models.UsagePaged[~azure.mgmt.sql.models.Usage] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance_pool.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'instancePoolName': self._serialize.url("instance_pool_name", instance_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if expand_children is not None: + query_parameters['expandChildren'] = self._serialize.query("expand_children", expand_children, 'bool') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.UsagePaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.UsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName}/usages'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 02ab955e053d..334be8304ad4 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -39,7 +39,6 @@ from .operations.database_automatic_tuning_operations import DatabaseAutomaticTuningOperations from .operations.encryption_protectors_operations import EncryptionProtectorsOperations from .operations.failover_groups_operations import FailoverGroupsOperations -from .operations.managed_instances_operations import ManagedInstancesOperations from .operations.operations import Operations from .operations.server_keys_operations import ServerKeysOperations from .operations.sync_agents_operations import SyncAgentsOperations @@ -94,6 +93,8 @@ from .operations.server_vulnerability_assessments_operations import ServerVulnerabilityAssessmentsOperations from .operations.managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations from .operations.instance_pools_operations import InstancePoolsOperations +from .operations.usages_operations import UsagesOperations +from .operations.managed_instances_operations import ManagedInstancesOperations from . import models @@ -188,8 +189,6 @@ class SqlManagementClient(SDKClient): :vartype encryption_protectors: azure.mgmt.sql.operations.EncryptionProtectorsOperations :ivar failover_groups: FailoverGroups operations :vartype failover_groups: azure.mgmt.sql.operations.FailoverGroupsOperations - :ivar managed_instances: ManagedInstances operations - :vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.sql.operations.Operations :ivar server_keys: ServerKeys operations @@ -298,6 +297,10 @@ class SqlManagementClient(SDKClient): :vartype managed_database_sensitivity_labels: azure.mgmt.sql.operations.ManagedDatabaseSensitivityLabelsOperations :ivar instance_pools: InstancePools operations :vartype instance_pools: azure.mgmt.sql.operations.InstancePoolsOperations + :ivar usages: Usages operations + :vartype usages: azure.mgmt.sql.operations.UsagesOperations + :ivar managed_instances: ManagedInstances operations + :vartype managed_instances: azure.mgmt.sql.operations.ManagedInstancesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -370,8 +373,6 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.failover_groups = FailoverGroupsOperations( self._client, self.config, self._serialize, self._deserialize) - self.managed_instances = ManagedInstancesOperations( - self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) self.server_keys = ServerKeysOperations( @@ -480,3 +481,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.instance_pools = InstancePoolsOperations( self._client, self.config, self._serialize, self._deserialize) + self.usages = UsagesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_instances = ManagedInstancesOperations( + self._client, self.config, self._serialize, self._deserialize) From 0f19b8cd9ea1da13b3a7163783ea91d4e5ed4b2e Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 25 Jun 2019 20:43:28 +0000 Subject: [PATCH 3/8] Packaging update of azure-mgmt-sql --- sdk/sql/azure-mgmt-sql/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/sql/azure-mgmt-sql/setup.py b/sdk/sql/azure-mgmt-sql/setup.py index 16c6c1db50a8..1e98e6b74a94 100644 --- a/sdk/sql/azure-mgmt-sql/setup.py +++ b/sdk/sql/azure-mgmt-sql/setup.py @@ -53,6 +53,7 @@ version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com', From cbdaa198447c4784a0a9447d72a513643f7871a5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 8 Jul 2019 17:25:03 -0700 Subject: [PATCH 4/8] [AutoPR sql/resource-manager] Failover database and elastic pool swagger changes (#5940) * Generated from ac2a0cdc13e5e483d5e774dab240cd7417daa8ea Add to read me * Generated from f12f8c2269805df77ec29896dad59c285095159b Merge upstream * Generated from 23564ccc16eb8eb3cc8acf94bb43bfcc01c44f30 Merge conflicts --- .../sql/operations/databases_operations.py | 87 +++++++++++++++++++ .../operations/elastic_pools_operations.py | 87 +++++++++++++++++++ 2 files changed, 174 insertions(+) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py index 3b4e01e8a397..82e88664ec85 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py @@ -1402,3 +1402,90 @@ def rename( client_raw_response = ClientRawResponse(None, response) return client_raw_response rename.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move'} + + + def _failover_initial( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + api_version = "2018-06-01-preview" + + # Construct URL + url = self.failover.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def failover( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Failovers a database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param database_name: The name of the database to failover. + :type database_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._failover_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/failover'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py index e7fba924b0c6..92a8309d5ba2 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/elastic_pools_operations.py @@ -646,3 +646,90 @@ def get_long_running_output(response): else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'} + + + def _failover_initial( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, **operation_config): + api_version = "2018-06-01-preview" + + # Construct URL + url = self.failover.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serverName': self._serialize.url("server_name", server_name, 'str'), + 'elasticPoolName': self._serialize.url("elastic_pool_name", elastic_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def failover( + self, resource_group_name, server_name, elastic_pool_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Failovers an elastic pool. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param server_name: The name of the server. + :type server_name: str + :param elastic_pool_name: The name of the elastic pool to failover. + :type elastic_pool_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._failover_initial( + resource_group_name=resource_group_name, + server_name=server_name, + elastic_pool_name=elastic_pool_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/failover'} From 3ec0a7351ad74561529a6f0086d3de34a86492a6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 9 Jul 2019 00:27:59 +0000 Subject: [PATCH 5/8] Packaging update of azure-mgmt-sql --- sdk/sql/azure-mgmt-sql/README.rst | 2 +- sdk/sql/azure-mgmt-sql/setup.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sdk/sql/azure-mgmt-sql/README.rst b/sdk/sql/azure-mgmt-sql/README.rst index 328c72485489..28f4f1b6be2b 100644 --- a/sdk/sql/azure-mgmt-sql/README.rst +++ b/sdk/sql/azure-mgmt-sql/README.rst @@ -6,7 +6,7 @@ This is the Microsoft Azure SQL Management Client Library. Azure Resource Manager (ARM) is the next generation of management APIs that replace the old Azure Service Management (ASM). -This package has been tested with Python 2.7, 3.4, 3.5, 3.6 and 3.7. +This package has been tested with Python 2.7, 3.5, 3.6 and 3.7. For the older Azure Service Management (ASM) libraries, see `azure-servicemanagement-legacy `__ library. diff --git a/sdk/sql/azure-mgmt-sql/setup.py b/sdk/sql/azure-mgmt-sql/setup.py index 1e98e6b74a94..98ea8a54d60c 100644 --- a/sdk/sql/azure-mgmt-sql/setup.py +++ b/sdk/sql/azure-mgmt-sql/setup.py @@ -64,7 +64,6 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', From a17bae17eda19c3d6ab1392f4ef8125e684bd78f Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 15 Jul 2019 09:19:12 -0700 Subject: [PATCH 6/8] Generated from e0489be63a969028e2325b1a0825641ecf54579c (#6266) Merge remote-tracking branch 'upstream/master' --- .../long_term_retention_backups_operations.py | 427 ++++++++++++++++++ 1 file changed, 427 insertions(+) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py index c803786f5ff3..8f236bbb52f8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/long_term_retention_backups_operations.py @@ -39,6 +39,433 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def get_by_resource_group( + self, resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + """Gets a long term retention backup. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param location_name: The location of the database. + :type location_name: str + :param long_term_retention_server_name: The name of the server + :type long_term_retention_server_name: str + :param long_term_retention_database_name: The name of the database + :type long_term_retention_database_name: str + :param backup_name: The backup name. + :type backup_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LongTermRetentionBackup or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.LongTermRetentionBackup or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LongTermRetentionBackup', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} + + + def _delete_by_resource_group_initial( + self, resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'backupName': self._serialize.url("backup_name", backup_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete_by_resource_group( + self, resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a long term retention backup. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: The name of the server + :type long_term_retention_server_name: str + :param long_term_retention_database_name: The name of the database + :type long_term_retention_database_name: str + :param backup_name: The backup name. + :type backup_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_by_resource_group_initial( + resource_group_name=resource_group_name, + location_name=location_name, + long_term_retention_server_name=long_term_retention_server_name, + long_term_retention_database_name=long_term_retention_database_name, + backup_name=backup_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'} + + def list_by_resource_group_database( + self, resource_group_name, location_name, long_term_retention_server_name, long_term_retention_database_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists all long term retention backups for a database. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: The name of the server + :type long_term_retention_server_name: str + :param long_term_retention_database_name: The name of the database + :type long_term_retention_database_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or + ~azure.mgmt.sql.models.LongTermRetentionDatabaseState + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group_database.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'longTermRetentionDatabaseName': self._serialize.url("long_term_retention_database_name", long_term_retention_database_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'} + + def list_by_resource_group_location( + self, resource_group_name, location_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given location. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param location_name: The location of the database + :type location_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or + ~azure.mgmt.sql.models.LongTermRetentionDatabaseState + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group_location.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group_location.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'} + + def list_by_resource_group_server( + self, resource_group_name, location_name, long_term_retention_server_name, only_latest_per_database=None, database_state=None, custom_headers=None, raw=False, **operation_config): + """Lists the long term retention backups for a given server. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param location_name: The location of the database + :type location_name: str + :param long_term_retention_server_name: The name of the server + :type long_term_retention_server_name: str + :param only_latest_per_database: Whether or not to only get the latest + backup for each database. + :type only_latest_per_database: bool + :param database_state: Whether to query against just live databases, + just deleted databases, or all databases. Possible values include: + 'All', 'Live', 'Deleted' + :type database_state: str or + ~azure.mgmt.sql.models.LongTermRetentionDatabaseState + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of LongTermRetentionBackup + :rtype: + ~azure.mgmt.sql.models.LongTermRetentionBackupPaged[~azure.mgmt.sql.models.LongTermRetentionBackup] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_resource_group_server.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'locationName': self._serialize.url("location_name", location_name, 'str'), + 'longTermRetentionServerName': self._serialize.url("long_term_retention_server_name", long_term_retention_server_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if only_latest_per_database is not None: + query_parameters['onlyLatestPerDatabase'] = self._serialize.query("only_latest_per_database", only_latest_per_database, 'bool') + if database_state is not None: + query_parameters['databaseState'] = self._serialize.query("database_state", database_state, 'str') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.LongTermRetentionBackupPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_resource_group_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'} + def get( self, location_name, long_term_retention_server_name, long_term_retention_database_name, backup_name, custom_headers=None, raw=False, **operation_config): """Gets a long term retention backup. From ef59c4939322ce012e47fcd4e624940ee4673eac Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 31 Jul 2019 22:37:08 -0700 Subject: [PATCH 7/8] Generated from 368b5914a375e09ef413285c932b72038a8af7e4 (#6569) fix: sql preview model validation errors - Remove empty "body" for RESPONSE_SCHEMA_NOT_IN_SPEC errors - IsAzureMonitorTargetEnabled -> isAzureMonitorTargetEnabled - "State" -> "state" - emailAccountAdmins "true" -> true - Add 202 response for RestorePoints_Create - password -> certPassword for ManagedInstanceTdeCertificates_Create and TdeCertificates_Create --- .../azure/mgmt/sql/models/database_blob_auditing_policy.py | 4 ++-- .../mgmt/sql/models/database_blob_auditing_policy_py3.py | 4 ++-- .../mgmt/sql/models/extended_database_blob_auditing_policy.py | 4 ++-- .../sql/models/extended_database_blob_auditing_policy_py3.py | 4 ++-- .../mgmt/sql/models/extended_server_blob_auditing_policy.py | 4 ++-- .../sql/models/extended_server_blob_auditing_policy_py3.py | 4 ++-- .../azure/mgmt/sql/models/server_blob_auditing_policy.py | 4 ++-- .../azure/mgmt/sql/models/server_blob_auditing_policy_py3.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py index 6db06ede30ad..a876b8f41b7e 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy.py @@ -112,8 +112,8 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py index 2acc43dae952..61a10bea2826 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/database_blob_auditing_policy_py3.py @@ -112,8 +112,8 @@ class DatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py index 48c324aa3153..60094bcebfac 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy.py @@ -113,8 +113,8 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py index 9550f279968c..d9afecba93ce 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_database_blob_auditing_policy_py3.py @@ -113,8 +113,8 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py index ac110357f4b8..a01ca19ec921 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy.py @@ -113,8 +113,8 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py index 89b96febe17d..7144342ec5ff 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/extended_server_blob_auditing_policy_py3.py @@ -113,8 +113,8 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py index 9a7bc69b8c5d..935f94a43a94 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy.py @@ -110,8 +110,8 @@ class ServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py index 120d066e6427..0e5e2afbae99 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/server_blob_auditing_policy_py3.py @@ -110,8 +110,8 @@ class ServerBlobAuditingPolicy(ProxyResource): :type is_storage_secondary_key_in_use: bool :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. - In order to send the events to Azure Monitor, specify 'State' as 'Enabled' - and 'IsAzureMonitorTargetEnabled' as true. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' + and 'isAzureMonitorTargetEnabled' as true. When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' diagnostic logs category on the database should be also created. From ca9e324c52d3184d8a148624c3d92226cffb1667 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 15 Aug 2019 11:11:15 -0700 Subject: [PATCH 8/8] Generated from 23f4c95562b46fa4d5639c5320769bc149818363 (#6630) Add managedInstaceAdministrators.json to readme file, which reprepresents AutoRest configuration file for Sql --- .../azure/mgmt/sql/models/__init__.py | 5 + .../models/managed_instance_administrator.py | 66 ++++ .../managed_instance_administrator_paged.py | 27 ++ .../managed_instance_administrator_py3.py | 66 ++++ .../azure/mgmt/sql/operations/__init__.py | 2 + ...aged_instance_administrators_operations.py | 373 ++++++++++++++++++ .../azure/mgmt/sql/sql_management_client.py | 5 + 7 files changed, 544 insertions(+) create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_paged.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_py3.py create mode 100644 sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_administrators_operations.py diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py index 5312457b984e..9d73e0ac615c 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/__init__.py @@ -119,6 +119,7 @@ from .managed_database_security_alert_policy_py3 import ManagedDatabaseSecurityAlertPolicy from .managed_server_security_alert_policy_py3 import ManagedServerSecurityAlertPolicy from .sensitivity_label_py3 import SensitivityLabel + from .managed_instance_administrator_py3 import ManagedInstanceAdministrator from .database_operation_py3 import DatabaseOperation from .elastic_pool_operation_py3 import ElasticPoolOperation from .max_size_capability_py3 import MaxSizeCapability @@ -275,6 +276,7 @@ from .managed_database_security_alert_policy import ManagedDatabaseSecurityAlertPolicy from .managed_server_security_alert_policy import ManagedServerSecurityAlertPolicy from .sensitivity_label import SensitivityLabel + from .managed_instance_administrator import ManagedInstanceAdministrator from .database_operation import DatabaseOperation from .elastic_pool_operation import ElasticPoolOperation from .max_size_capability import MaxSizeCapability @@ -375,6 +377,7 @@ from .managed_database_security_alert_policy_paged import ManagedDatabaseSecurityAlertPolicyPaged from .managed_server_security_alert_policy_paged import ManagedServerSecurityAlertPolicyPaged from .sensitivity_label_paged import SensitivityLabelPaged +from .managed_instance_administrator_paged import ManagedInstanceAdministratorPaged from .database_operation_paged import DatabaseOperationPaged from .elastic_pool_operation_paged import ElasticPoolOperationPaged from .vulnerability_assessment_scan_record_paged import VulnerabilityAssessmentScanRecordPaged @@ -582,6 +585,7 @@ 'ManagedDatabaseSecurityAlertPolicy', 'ManagedServerSecurityAlertPolicy', 'SensitivityLabel', + 'ManagedInstanceAdministrator', 'DatabaseOperation', 'ElasticPoolOperation', 'MaxSizeCapability', @@ -682,6 +686,7 @@ 'ManagedDatabaseSecurityAlertPolicyPaged', 'ManagedServerSecurityAlertPolicyPaged', 'SensitivityLabelPaged', + 'ManagedInstanceAdministratorPaged', 'DatabaseOperationPaged', 'ElasticPoolOperationPaged', 'VulnerabilityAssessmentScanRecordPaged', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator.py new file mode 100644 index 000000000000..d03ac450ccf4 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator.py @@ -0,0 +1,66 @@ +# 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 .proxy_resource import ProxyResource + + +class ManagedInstanceAdministrator(ProxyResource): + """An Azure SQL managed instance administrator. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar administrator_type: Required. Type of the managed instance + administrator. Default value: "ActiveDirectory" . + :vartype administrator_type: str + :param login: Required. Login name of the managed instance administrator. + :type login: str + :param sid: Required. SID (object ID) of the managed instance + administrator. + :type sid: str + :param tenant_id: Tenant ID of the managed instance administrator. + :type tenant_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'administrator_type': {'required': True, 'constant': True}, + 'login': {'required': True}, + 'sid': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'administrator_type': {'key': 'properties.administratorType', 'type': 'str'}, + 'login': {'key': 'properties.login', 'type': 'str'}, + 'sid': {'key': 'properties.sid', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + administrator_type = "ActiveDirectory" + + def __init__(self, **kwargs): + super(ManagedInstanceAdministrator, self).__init__(**kwargs) + self.login = kwargs.get('login', None) + self.sid = kwargs.get('sid', None) + self.tenant_id = kwargs.get('tenant_id', None) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_paged.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_paged.py new file mode 100644 index 000000000000..9879569e4299 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_paged.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class ManagedInstanceAdministratorPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedInstanceAdministrator ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedInstanceAdministrator]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedInstanceAdministratorPaged, self).__init__(*args, **kwargs) diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_py3.py new file mode 100644 index 000000000000..4cd258a1e19b --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/managed_instance_administrator_py3.py @@ -0,0 +1,66 @@ +# 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 .proxy_resource_py3 import ProxyResource + + +class ManagedInstanceAdministrator(ProxyResource): + """An Azure SQL managed instance administrator. + + 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: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar administrator_type: Required. Type of the managed instance + administrator. Default value: "ActiveDirectory" . + :vartype administrator_type: str + :param login: Required. Login name of the managed instance administrator. + :type login: str + :param sid: Required. SID (object ID) of the managed instance + administrator. + :type sid: str + :param tenant_id: Tenant ID of the managed instance administrator. + :type tenant_id: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'administrator_type': {'required': True, 'constant': True}, + 'login': {'required': True}, + 'sid': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'administrator_type': {'key': 'properties.administratorType', 'type': 'str'}, + 'login': {'key': 'properties.login', 'type': 'str'}, + 'sid': {'key': 'properties.sid', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + } + + administrator_type = "ActiveDirectory" + + def __init__(self, *, login: str, sid: str, tenant_id: str=None, **kwargs) -> None: + super(ManagedInstanceAdministrator, self).__init__(**kwargs) + self.login = login + self.sid = sid + self.tenant_id = tenant_id diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py index b5f1cf999537..ac34b9c56b59 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/__init__.py @@ -71,6 +71,7 @@ from .managed_database_security_alert_policies_operations import ManagedDatabaseSecurityAlertPoliciesOperations from .managed_server_security_alert_policies_operations import ManagedServerSecurityAlertPoliciesOperations from .sensitivity_labels_operations import SensitivityLabelsOperations +from .managed_instance_administrators_operations import ManagedInstanceAdministratorsOperations from .database_operations import DatabaseOperations from .elastic_pool_operations import ElasticPoolOperations from .capabilities_operations import CapabilitiesOperations @@ -155,6 +156,7 @@ 'ManagedDatabaseSecurityAlertPoliciesOperations', 'ManagedServerSecurityAlertPoliciesOperations', 'SensitivityLabelsOperations', + 'ManagedInstanceAdministratorsOperations', 'DatabaseOperations', 'ElasticPoolOperations', 'CapabilitiesOperations', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_administrators_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_administrators_operations.py new file mode 100644 index 000000000000..c229d4cfa723 --- /dev/null +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/managed_instance_administrators_operations.py @@ -0,0 +1,373 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedInstanceAdministratorsOperations(object): + """ManagedInstanceAdministratorsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for the request. Constant value: "2017-03-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-03-01-preview" + + self.config = config + + def list_by_instance( + self, resource_group_name, managed_instance_name, custom_headers=None, raw=False, **operation_config): + """Gets a list of managed instance administrators. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedInstanceAdministrator + :rtype: + ~azure.mgmt.sql.models.ManagedInstanceAdministratorPaged[~azure.mgmt.sql.models.ManagedInstanceAdministrator] + :raises: :class:`CloudError` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_by_instance.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + deserialized = models.ManagedInstanceAdministratorPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.ManagedInstanceAdministratorPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_by_instance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators'} + + def get( + self, resource_group_name, managed_instance_name, administrator_name, custom_headers=None, raw=False, **operation_config): + """Gets a managed instance administrator. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param administrator_name: The administrator name. + :type administrator_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedInstanceAdministrator or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.sql.models.ManagedInstanceAdministrator or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'administratorName': self._serialize.url("administrator_name", administrator_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedInstanceAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}'} + + + def _create_or_update_initial( + self, resource_group_name, managed_instance_name, administrator_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'administratorName': self._serialize.url("administrator_name", administrator_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedInstanceAdministrator') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedInstanceAdministrator', response) + if response.status_code == 201: + deserialized = self._deserialize('ManagedInstanceAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, managed_instance_name, administrator_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Creates or updates a managed instance administrator. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param administrator_name: The requested administrator name. + :type administrator_name: str + :param parameters: The requested administrator parameters. + :type parameters: ~azure.mgmt.sql.models.ManagedInstanceAdministrator + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + ManagedInstanceAdministrator or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.sql.models.ManagedInstanceAdministrator] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.sql.models.ManagedInstanceAdministrator]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + administrator_name=administrator_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedInstanceAdministrator', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}'} + + + def _delete_initial( + self, resource_group_name, managed_instance_name, administrator_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'managedInstanceName': self._serialize.url("managed_instance_name", managed_instance_name, 'str'), + 'administratorName': self._serialize.url("administrator_name", administrator_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, managed_instance_name, administrator_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a managed instance administrator. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param managed_instance_name: The name of the managed instance. + :type managed_instance_name: str + :param administrator_name: The administrator name. + :type administrator_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + managed_instance_name=managed_instance_name, + administrator_name=administrator_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/administrators/{administratorName}'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py index 334be8304ad4..1f8f558100c8 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/sql_management_client.py @@ -75,6 +75,7 @@ from .operations.managed_database_security_alert_policies_operations import ManagedDatabaseSecurityAlertPoliciesOperations from .operations.managed_server_security_alert_policies_operations import ManagedServerSecurityAlertPoliciesOperations from .operations.sensitivity_labels_operations import SensitivityLabelsOperations +from .operations.managed_instance_administrators_operations import ManagedInstanceAdministratorsOperations from .operations.database_operations import DatabaseOperations from .operations.elastic_pool_operations import ElasticPoolOperations from .operations.capabilities_operations import CapabilitiesOperations @@ -261,6 +262,8 @@ class SqlManagementClient(SDKClient): :vartype managed_server_security_alert_policies: azure.mgmt.sql.operations.ManagedServerSecurityAlertPoliciesOperations :ivar sensitivity_labels: SensitivityLabels operations :vartype sensitivity_labels: azure.mgmt.sql.operations.SensitivityLabelsOperations + :ivar managed_instance_administrators: ManagedInstanceAdministrators operations + :vartype managed_instance_administrators: azure.mgmt.sql.operations.ManagedInstanceAdministratorsOperations :ivar database_operations: DatabaseOperations operations :vartype database_operations: azure.mgmt.sql.operations.DatabaseOperations :ivar elastic_pool_operations: ElasticPoolOperations operations @@ -445,6 +448,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.sensitivity_labels = SensitivityLabelsOperations( self._client, self.config, self._serialize, self._deserialize) + self.managed_instance_administrators = ManagedInstanceAdministratorsOperations( + self._client, self.config, self._serialize, self._deserialize) self.database_operations = DatabaseOperations( self._client, self.config, self._serialize, self._deserialize) self.elastic_pool_operations = ElasticPoolOperations(