From 3e7be555b34cdc34c11d6fa54d2d69fde5aea888 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 14 May 2020 07:35:45 +0000 Subject: [PATCH] Generated from 5ba703162c35b655a6f855725dad524cf1d4e49a Update swagger specs for Managed Instance - Add optional parameter maintenance configuration id. --- .../azure/mgmt/sql/models/__init__.py | 7 ++ .../azure/mgmt/sql/models/_models.py | 91 +++++++++++++--- .../azure/mgmt/sql/models/_models_py3.py | 95 ++++++++++++++--- .../azure/mgmt/sql/models/_paged_models.py | 26 +++++ ...abase_blob_auditing_policies_operations.py | 78 ++++++++++++++ ...erver_blob_auditing_policies_operations.py | 74 +++++++++++++ .../_replication_links_operations.py | 100 ++++++++++++++++++ sdk/sql/azure-mgmt-sql/setup.py | 4 +- 8 files changed, 448 insertions(+), 27 deletions(-) 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 e72bde3586c6..dffd67378330 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 @@ -177,6 +177,7 @@ from ._models_py3 import TrackedResource from ._models_py3 import TransparentDataEncryption from ._models_py3 import TransparentDataEncryptionActivity + from ._models_py3 import UnlinkParameters from ._models_py3 import Usage from ._models_py3 import VirtualCluster from ._models_py3 import VirtualClusterUpdate @@ -354,6 +355,7 @@ from ._models import TrackedResource from ._models import TransparentDataEncryption from ._models import TransparentDataEncryptionActivity + from ._models import UnlinkParameters from ._models import Usage from ._models import VirtualCluster from ._models import VirtualClusterUpdate @@ -375,6 +377,8 @@ from ._paged_models import ElasticPoolOperationPaged from ._paged_models import ElasticPoolPaged from ._paged_models import EncryptionProtectorPaged +from ._paged_models import ExtendedDatabaseBlobAuditingPolicyPaged +from ._paged_models import ExtendedServerBlobAuditingPolicyPaged from ._paged_models import FailoverGroupPaged from ._paged_models import FirewallRulePaged from ._paged_models import GeoBackupPolicyPaged @@ -705,6 +709,7 @@ 'TrackedResource', 'TransparentDataEncryption', 'TransparentDataEncryptionActivity', + 'UnlinkParameters', 'Usage', 'VirtualCluster', 'VirtualClusterUpdate', @@ -748,6 +753,8 @@ 'SubscriptionUsagePaged', 'VirtualClusterPaged', 'VirtualNetworkRulePaged', + 'ExtendedDatabaseBlobAuditingPolicyPaged', + 'ExtendedServerBlobAuditingPolicyPaged', 'ServerBlobAuditingPolicyPaged', 'DatabaseBlobAuditingPolicyPaged', 'DatabaseVulnerabilityAssessmentPaged', diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py index 153ccd9289e9..798a9903d81d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models.py @@ -597,8 +597,10 @@ class Database(TrackedResource): which means the replicas of this database will be spread across multiple availability zones. :type zone_redundant: bool - :param license_type: The license type to apply for this database. Possible - values include: 'LicenseIncluded', 'BasePrice' + :param license_type: The license type to apply for this database. + `LicenseIncluded` if you need a license, or `BasePrice` if you have a + license and are eligible for the Azure Hybrid Benefit. Possible values + include: 'LicenseIncluded', 'BasePrice' :type license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType :ivar max_log_size_bytes: The max log size for this database. :vartype max_log_size_bytes: long @@ -802,8 +804,17 @@ class DatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -1233,8 +1244,10 @@ class DatabaseUpdate(Model): which means the replicas of this database will be spread across multiple availability zones. :type zone_redundant: bool - :param license_type: The license type to apply for this database. Possible - values include: 'LicenseIncluded', 'BasePrice' + :param license_type: The license type to apply for this database. + `LicenseIncluded` if you need a license, or `BasePrice` if you have a + license and are eligible for the Azure Hybrid Benefit. Possible values + include: 'LicenseIncluded', 'BasePrice' :type license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType :ivar max_log_size_bytes: The max log size for this database. :vartype max_log_size_bytes: long @@ -2671,8 +2684,17 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -2831,8 +2853,17 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -5125,6 +5156,9 @@ class ManagedInstance(TrackedResource): :param instance_pool_id: The Id of the instance pool this managed server belongs to. :type instance_pool_id: str + :param maintenance_configuration_id: Specifies maintenance configuration + id to apply to this managed instance. + :type maintenance_configuration_id: str :param minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' :type minimal_tls_version: str @@ -5166,6 +5200,7 @@ class ManagedInstance(TrackedResource): 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, + 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, } @@ -5191,6 +5226,7 @@ def __init__(self, **kwargs): 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.maintenance_configuration_id = kwargs.get('maintenance_configuration_id', None) self.minimal_tls_version = kwargs.get('minimal_tls_version', None) @@ -5766,6 +5802,9 @@ class ManagedInstanceUpdate(Model): :param instance_pool_id: The Id of the instance pool this managed server belongs to. :type instance_pool_id: str + :param maintenance_configuration_id: Specifies maintenance configuration + id to apply to this managed instance. + :type maintenance_configuration_id: str :param minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' :type minimal_tls_version: str @@ -5799,6 +5838,7 @@ class ManagedInstanceUpdate(Model): 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, + 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -5824,6 +5864,7 @@ def __init__(self, **kwargs): 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.maintenance_configuration_id = kwargs.get('maintenance_configuration_id', None) self.minimal_tls_version = kwargs.get('minimal_tls_version', None) self.tags = kwargs.get('tags', None) @@ -7778,8 +7819,17 @@ class ServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -9609,6 +9659,23 @@ def __init__(self, **kwargs): self.percent_complete = None +class UnlinkParameters(Model): + """Represents the parameters for Unlink Replication Link request. + + :param forced_termination: Determines whether link will be terminated in a + forced or a friendly way. + :type forced_termination: bool + """ + + _attribute_map = { + 'forced_termination': {'key': 'forcedTermination', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(UnlinkParameters, self).__init__(**kwargs) + self.forced_termination = kwargs.get('forced_termination', None) + + class Usage(Model): """ARM usage. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py index 70e81e62ae62..2c1099b255e1 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_models_py3.py @@ -597,8 +597,10 @@ class Database(TrackedResource): which means the replicas of this database will be spread across multiple availability zones. :type zone_redundant: bool - :param license_type: The license type to apply for this database. Possible - values include: 'LicenseIncluded', 'BasePrice' + :param license_type: The license type to apply for this database. + `LicenseIncluded` if you need a license, or `BasePrice` if you have a + license and are eligible for the Azure Hybrid Benefit. Possible values + include: 'LicenseIncluded', 'BasePrice' :type license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType :ivar max_log_size_bytes: The max log size for this database. :vartype max_log_size_bytes: long @@ -802,8 +804,17 @@ class DatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -1233,8 +1244,10 @@ class DatabaseUpdate(Model): which means the replicas of this database will be spread across multiple availability zones. :type zone_redundant: bool - :param license_type: The license type to apply for this database. Possible - values include: 'LicenseIncluded', 'BasePrice' + :param license_type: The license type to apply for this database. + `LicenseIncluded` if you need a license, or `BasePrice` if you have a + license and are eligible for the Azure Hybrid Benefit. Possible values + include: 'LicenseIncluded', 'BasePrice' :type license_type: str or ~azure.mgmt.sql.models.DatabaseLicenseType :ivar max_log_size_bytes: The max log size for this database. :vartype max_log_size_bytes: long @@ -2671,8 +2684,17 @@ class ExtendedDatabaseBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -2831,8 +2853,17 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -5125,6 +5156,9 @@ class ManagedInstance(TrackedResource): :param instance_pool_id: The Id of the instance pool this managed server belongs to. :type instance_pool_id: str + :param maintenance_configuration_id: Specifies maintenance configuration + id to apply to this managed instance. + :type maintenance_configuration_id: str :param minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' :type minimal_tls_version: str @@ -5166,10 +5200,11 @@ class ManagedInstance(TrackedResource): 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, + 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, } - 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, minimal_tls_version: 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, maintenance_configuration_id: str=None, minimal_tls_version: str=None, **kwargs) -> None: super(ManagedInstance, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.sku = sku @@ -5191,6 +5226,7 @@ def __init__(self, *, location: str, tags=None, identity=None, sku=None, managed self.proxy_override = proxy_override self.timezone_id = timezone_id self.instance_pool_id = instance_pool_id + self.maintenance_configuration_id = maintenance_configuration_id self.minimal_tls_version = minimal_tls_version @@ -5766,6 +5802,9 @@ class ManagedInstanceUpdate(Model): :param instance_pool_id: The Id of the instance pool this managed server belongs to. :type instance_pool_id: str + :param maintenance_configuration_id: Specifies maintenance configuration + id to apply to this managed instance. + :type maintenance_configuration_id: str :param minimal_tls_version: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' :type minimal_tls_version: str @@ -5799,11 +5838,12 @@ class ManagedInstanceUpdate(Model): 'proxy_override': {'key': 'properties.proxyOverride', 'type': 'str'}, 'timezone_id': {'key': 'properties.timezoneId', 'type': 'str'}, 'instance_pool_id': {'key': 'properties.instancePoolId', 'type': 'str'}, + 'maintenance_configuration_id': {'key': 'properties.maintenanceConfigurationId', 'type': 'str'}, 'minimal_tls_version': {'key': 'properties.minimalTlsVersion', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } - 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, minimal_tls_version: 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, maintenance_configuration_id: str=None, minimal_tls_version: str=None, tags=None, **kwargs) -> None: super(ManagedInstanceUpdate, self).__init__(**kwargs) self.sku = sku self.managed_instance_create_mode = managed_instance_create_mode @@ -5824,6 +5864,7 @@ def __init__(self, *, sku=None, managed_instance_create_mode=None, administrator self.proxy_override = proxy_override self.timezone_id = timezone_id self.instance_pool_id = instance_pool_id + self.maintenance_configuration_id = maintenance_configuration_id self.minimal_tls_version = minimal_tls_version self.tags = tags @@ -7778,8 +7819,17 @@ class ServerBlobAuditingPolicy(ProxyResource): storageEndpoint or isAzureMonitorTargetEnabled is required. :type storage_endpoint: str :param storage_account_access_key: Specifies the identifier key of the - auditing storage account. If state is Enabled and storageEndpoint is - specified, storageAccountAccessKey is required. + auditing storage account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed + identity to access the storage. + Prerequisites for using managed identity authentication: + 1. Assign SQL Server a system-assigned managed identity in Azure Active + Directory (AAD). + 2. Grant SQL Server identity access to the storage account by adding + 'Storage Blob Data Contributor' RBAC role to the server identity. + For more information, see [Auditing to storage using Managed Identity + authentication](https://go.microsoft.com/fwlink/?linkid=2114355) :type storage_account_access_key: str :param retention_days: Specifies the number of days to keep in the audit logs in the storage account. @@ -9609,6 +9659,23 @@ def __init__(self, **kwargs) -> None: self.percent_complete = None +class UnlinkParameters(Model): + """Represents the parameters for Unlink Replication Link request. + + :param forced_termination: Determines whether link will be terminated in a + forced or a friendly way. + :type forced_termination: bool + """ + + _attribute_map = { + 'forced_termination': {'key': 'forcedTermination', 'type': 'bool'}, + } + + def __init__(self, *, forced_termination: bool=None, **kwargs) -> None: + super(UnlinkParameters, self).__init__(**kwargs) + self.forced_termination = forced_termination + + class Usage(Model): """ARM usage. diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py index a4d68805b28f..62dcecdff07f 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/models/_paged_models.py @@ -454,6 +454,32 @@ class VirtualNetworkRulePaged(Paged): def __init__(self, *args, **kwargs): super(VirtualNetworkRulePaged, self).__init__(*args, **kwargs) +class ExtendedDatabaseBlobAuditingPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ExtendedDatabaseBlobAuditingPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ExtendedDatabaseBlobAuditingPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ExtendedDatabaseBlobAuditingPolicyPaged, self).__init__(*args, **kwargs) +class ExtendedServerBlobAuditingPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ExtendedServerBlobAuditingPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ExtendedServerBlobAuditingPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ExtendedServerBlobAuditingPolicyPaged, self).__init__(*args, **kwargs) class ServerBlobAuditingPolicyPaged(Paged): """ A paging container for iterating over a list of :class:`ServerBlobAuditingPolicy ` object diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py index ea9c9d8d7aaf..8603d99a6acd 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_database_blob_auditing_policies_operations.py @@ -185,3 +185,81 @@ def create_or_update( return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + def list_by_database( + self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): + """Lists extended auditing settings of 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. + :type database_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 + ExtendedDatabaseBlobAuditingPolicy + :rtype: + ~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicyPaged[~azure.mgmt.sql.models.ExtendedDatabaseBlobAuditingPolicy] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database.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("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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.ExtendedDatabaseBlobAuditingPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/extendedAuditingSettings'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py index dff8fac62031..728bf1c26c9d 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_extended_server_blob_auditing_policies_operations.py @@ -212,3 +212,77 @@ def get_long_running_output(response): 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/servers/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}'} + + def list_by_server( + self, resource_group_name, server_name, custom_headers=None, raw=False, **operation_config): + """Lists extended auditing settings of a 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 server_name: The name of the server. + :type server_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 ExtendedServerBlobAuditingPolicy + :rtype: + ~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicyPaged[~azure.mgmt.sql.models.ExtendedServerBlobAuditingPolicy] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_server.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'), + '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) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + 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 + header_dict = None + if raw: + header_dict = {} + deserialized = models.ExtendedServerBlobAuditingPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_server.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/extendedAuditingSettings'} diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py index bebd9d62e04d..7cb1cad8ec04 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_replication_links_operations.py @@ -354,6 +354,106 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) failover_allow_data_loss.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss'} + + def _unlink_initial( + self, resource_group_name, server_name, database_name, link_id, forced_termination=None, custom_headers=None, raw=False, **operation_config): + parameters = models.UnlinkParameters(forced_termination=forced_termination) + + # Construct URL + url = self.unlink.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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'), + 'linkId': self._serialize.url("link_id", link_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['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, 'UnlinkParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [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 unlink( + self, resource_group_name, server_name, database_name, link_id, forced_termination=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes a database replication link in forced or friendly way. + + :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 that has the + replication link to be failed over. + :type database_name: str + :param link_id: The ID of the replication link to be failed over. + :type link_id: str + :param forced_termination: Determines whether link will be terminated + in a forced or a friendly way. + :type forced_termination: bool + :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._unlink_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + link_id=link_id, + forced_termination=forced_termination, + 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) + unlink.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/unlink'} + def list_by_database( self, resource_group_name, server_name, database_name, custom_headers=None, raw=False, **operation_config): """Lists a database's replication links. diff --git a/sdk/sql/azure-mgmt-sql/setup.py b/sdk/sql/azure-mgmt-sql/setup.py index e6b06f525bc1..97474e8ab13e 100644 --- a/sdk/sql/azure-mgmt-sql/setup.py +++ b/sdk/sql/azure-mgmt-sql/setup.py @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)