diff --git a/sdk/sql/azure-mgmt-sql/_meta.json b/sdk/sql/azure-mgmt-sql/_meta.json index 05c8c8d78316..d54a0fa15601 100644 --- a/sdk/sql/azure-mgmt-sql/_meta.json +++ b/sdk/sql/azure-mgmt-sql/_meta.json @@ -4,7 +4,7 @@ "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "cc268fe6b328f3857edb3ec9bce796e7ffc11f85", + "commit": "c29af6df941b1c00ab2ae645fb5048c9ca78ac00", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/sql/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/sql/resource-manager/readme.md" 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 42cbaea39a1c..c78e629b6f08 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.0.1" +VERSION = "0.9.0" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py index f68bf89ad335..91146f456188 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_ledger_digest_uploads_operations.py @@ -12,7 +12,9 @@ from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models @@ -108,7 +110,7 @@ async def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, server_name: str, @@ -117,25 +119,6 @@ async def create_or_update( parameters: "_models.LedgerDigestUploads", **kwargs: Any ) -> Optional["_models.LedgerDigestUploads"]: - """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger - instance. - - :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 ledger_digest_uploads: - :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName - :param parameters: - :type parameters: ~azure.mgmt.sql.models.LedgerDigestUploads - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LedgerDigestUploads, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LedgerDigestUploads or None - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LedgerDigestUploads"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -146,7 +129,7 @@ async def create_or_update( accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -184,7 +167,90 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + server_name: str, + database_name: str, + ledger_digest_uploads: Union[str, "_models.LedgerDigestUploadsName"], + parameters: "_models.LedgerDigestUploads", + **kwargs: Any + ) -> AsyncLROPoller["_models.LedgerDigestUploads"]: + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :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 ledger_digest_uploads: + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName + :param parameters: + :type parameters: ~azure.mgmt.sql.models.LedgerDigestUploads + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LedgerDigestUploads or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.LedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LedgerDigestUploads"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LedgerDigestUploads', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'ledgerDigestUploads': self._serialize.url("ledger_digest_uploads", ledger_digest_uploads, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore def list_by_database( self, @@ -265,7 +331,7 @@ async def get_next(next_link=None): ) list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads'} # type: ignore - async def disable( + async def _disable_initial( self, resource_group_name: str, server_name: str, @@ -273,23 +339,6 @@ async def disable( ledger_digest_uploads: Union[str, "_models.LedgerDigestUploadsName"], **kwargs: Any ) -> Optional["_models.LedgerDigestUploads"]: - """Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger - instance. - - :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 ledger_digest_uploads: - :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LedgerDigestUploads, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LedgerDigestUploads or None - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LedgerDigestUploads"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -299,7 +348,7 @@ async def disable( accept = "application/json" # Construct URL - url = self.disable.metadata['url'] # type: ignore + url = self._disable_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -333,4 +382,83 @@ async def disable( return cls(pipeline_response, deserialized, {}) return deserialized - disable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable'} # type: ignore + _disable_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable'} # type: ignore + + async def begin_disable( + self, + resource_group_name: str, + server_name: str, + database_name: str, + ledger_digest_uploads: Union[str, "_models.LedgerDigestUploadsName"], + **kwargs: Any + ) -> AsyncLROPoller["_models.LedgerDigestUploads"]: + """Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :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 ledger_digest_uploads: + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LedgerDigestUploads or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.LedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LedgerDigestUploads"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._disable_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LedgerDigestUploads', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'ledgerDigestUploads': self._serialize.url("ledger_digest_uploads", ledger_digest_uploads, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable'} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py index 55e5422d21dc..3bfa09c9a56b 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_managed_server_security_alert_policies_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, managed_instance_name: str, - security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], **kwargs: Any ) -> "_models.ManagedServerSecurityAlertPolicy": """Get a managed server's threat detection policy. @@ -58,7 +58,7 @@ async def get( :param managed_instance_name: The name of the managed instance. :type managed_instance_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedServerSecurityAlertPolicy, or the result of cls(response) :rtype: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy @@ -110,7 +110,7 @@ async def _create_or_update_initial( self, resource_group_name: str, managed_instance_name: str, - security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], parameters: "_models.ManagedServerSecurityAlertPolicy", **kwargs: Any ) -> Optional["_models.ManagedServerSecurityAlertPolicy"]: @@ -167,7 +167,7 @@ async def begin_create_or_update( self, resource_group_name: str, managed_instance_name: str, - security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], parameters: "_models.ManagedServerSecurityAlertPolicy", **kwargs: Any ) -> AsyncLROPoller["_models.ManagedServerSecurityAlertPolicy"]: @@ -179,7 +179,7 @@ async def begin_create_or_update( :param managed_instance_name: The name of the managed instance. :type managed_instance_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :param parameters: The managed server security alert policy. :type parameters: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py index 991d0be5e5c8..8086f41e9c49 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_server_security_alert_policies_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, server_name: str, - security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], **kwargs: Any ) -> "_models.ServerSecurityAlertPolicy": """Get a server's security alert policy. @@ -58,7 +58,7 @@ async def get( :param server_name: The name of the server. :type server_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy, or the result of cls(response) :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy @@ -110,7 +110,7 @@ async def _create_or_update_initial( self, resource_group_name: str, server_name: str, - security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], parameters: "_models.ServerSecurityAlertPolicy", **kwargs: Any ) -> Optional["_models.ServerSecurityAlertPolicy"]: @@ -167,7 +167,7 @@ async def begin_create_or_update( self, resource_group_name: str, server_name: str, - security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], parameters: "_models.ServerSecurityAlertPolicy", **kwargs: Any ) -> AsyncLROPoller["_models.ServerSecurityAlertPolicy"]: @@ -179,7 +179,7 @@ async def begin_create_or_update( :param server_name: The name of the server. :type server_name: str :param security_alert_policy_name: The name of the threat detection policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :param parameters: The server security alert policy. :type parameters: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py index 2a714c6b13da..baf1c890de62 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_sync_groups_operations.py @@ -325,7 +325,7 @@ def list_logs( sync_group_name: str, start_time: str, end_time: str, - type: Union[str, "_models.Enum77"], + type: Union[str, "_models.Enum76"], continuation_token_parameter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.SyncGroupLogListResult"]: @@ -345,7 +345,7 @@ def list_logs( :param end_time: Get logs generated before this time. :type end_time: str :param type: The types of logs to retrieve. - :type type: str or ~azure.mgmt.sql.models.Enum77 + :type type: str or ~azure.mgmt.sql.models.Enum76 :param continuation_token_parameter: The continuation token for this operation. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response 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 db89bafe250b..e39ac4483ba9 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 @@ -728,7 +728,7 @@ ElasticPoolLicenseType, ElasticPoolState, EncryptionProtectorName, - Enum77, + Enum76, FailoverGroupReplicationRole, GeoBackupPolicyName, GeoBackupPolicyState, @@ -789,7 +789,6 @@ SampleName, SecondaryType, SecurityAlertPolicyName, - SecurityAlertPolicyNameAutoGenerated, SecurityAlertPolicyState, SecurityAlertsPolicyState, SecurityEventType, @@ -1209,7 +1208,7 @@ 'ElasticPoolLicenseType', 'ElasticPoolState', 'EncryptionProtectorName', - 'Enum77', + 'Enum76', 'FailoverGroupReplicationRole', 'GeoBackupPolicyName', 'GeoBackupPolicyState', @@ -1270,7 +1269,6 @@ 'SampleName', 'SecondaryType', 'SecurityAlertPolicyName', - 'SecurityAlertPolicyNameAutoGenerated', 'SecurityAlertPolicyState', 'SecurityAlertsPolicyState', 'SecurityEventType', 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 a9a95e2d3790..45e9b5d9add5 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 @@ -411,7 +411,7 @@ class EncryptionProtectorName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum CURRENT = "current" -class Enum77(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum76(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALL = "All" ERROR = "Error" @@ -903,10 +903,6 @@ class SecondaryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class SecurityAlertPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - DEFAULT = "default" - -class SecurityAlertPolicyNameAutoGenerated(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - DEFAULT = "Default" class SecurityAlertPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py index db8e2947abab..3f74b2164b24 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_ledger_digest_uploads_operations.py @@ -12,7 +12,9 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models @@ -113,7 +115,7 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore - def create_or_update( + def _create_or_update_initial( self, resource_group_name, # type: str server_name, # type: str @@ -123,25 +125,6 @@ def create_or_update( **kwargs # type: Any ): # type: (...) -> Optional["_models.LedgerDigestUploads"] - """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger - instance. - - :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 ledger_digest_uploads: - :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName - :param parameters: - :type parameters: ~azure.mgmt.sql.models.LedgerDigestUploads - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LedgerDigestUploads, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LedgerDigestUploads or None - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LedgerDigestUploads"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -152,7 +135,7 @@ def create_or_update( accept = "application/json" # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore + url = self._create_or_update_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -190,7 +173,91 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + server_name, # type: str + database_name, # type: str + ledger_digest_uploads, # type: Union[str, "_models.LedgerDigestUploadsName"] + parameters, # type: "_models.LedgerDigestUploads" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LedgerDigestUploads"] + """Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :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 ledger_digest_uploads: + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName + :param parameters: + :type parameters: ~azure.mgmt.sql.models.LedgerDigestUploads + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LedgerDigestUploads or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.LedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LedgerDigestUploads"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LedgerDigestUploads', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'ledgerDigestUploads': self._serialize.url("ledger_digest_uploads", ledger_digest_uploads, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}'} # type: ignore def list_by_database( self, @@ -272,7 +339,7 @@ def get_next(next_link=None): ) list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads'} # type: ignore - def disable( + def _disable_initial( self, resource_group_name, # type: str server_name, # type: str @@ -281,23 +348,6 @@ def disable( **kwargs # type: Any ): # type: (...) -> Optional["_models.LedgerDigestUploads"] - """Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger - instance. - - :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 ledger_digest_uploads: - :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LedgerDigestUploads, or the result of cls(response) - :rtype: ~azure.mgmt.sql.models.LedgerDigestUploads or None - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LedgerDigestUploads"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -307,7 +357,7 @@ def disable( accept = "application/json" # Construct URL - url = self.disable.metadata['url'] # type: ignore + url = self._disable_initial.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'serverName': self._serialize.url("server_name", server_name, 'str'), @@ -341,4 +391,84 @@ def disable( return cls(pipeline_response, deserialized, {}) return deserialized - disable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable'} # type: ignore + _disable_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable'} # type: ignore + + def begin_disable( + self, + resource_group_name, # type: str + server_name, # type: str + database_name, # type: str + ledger_digest_uploads, # type: Union[str, "_models.LedgerDigestUploadsName"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LedgerDigestUploads"] + """Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger + instance. + + :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 ledger_digest_uploads: + :type ledger_digest_uploads: str or ~azure.mgmt.sql.models.LedgerDigestUploadsName + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LedgerDigestUploads or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.LedgerDigestUploads] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LedgerDigestUploads"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._disable_initial( + resource_group_name=resource_group_name, + server_name=server_name, + database_name=database_name, + ledger_digest_uploads=ledger_digest_uploads, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LedgerDigestUploads', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + 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'), + 'ledgerDigestUploads': self._serialize.url("ledger_digest_uploads", ledger_digest_uploads, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable'} # type: ignore diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py index aef6ed163ac5..429162531975 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_managed_server_security_alert_policies_operations.py @@ -51,7 +51,7 @@ def get( self, resource_group_name, # type: str managed_instance_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] + security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] **kwargs # type: Any ): # type: (...) -> "_models.ManagedServerSecurityAlertPolicy" @@ -63,7 +63,7 @@ def get( :param managed_instance_name: The name of the managed instance. :type managed_instance_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedServerSecurityAlertPolicy, or the result of cls(response) :rtype: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy @@ -115,7 +115,7 @@ def _create_or_update_initial( self, resource_group_name, # type: str managed_instance_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] + security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] parameters, # type: "_models.ManagedServerSecurityAlertPolicy" **kwargs # type: Any ): @@ -173,7 +173,7 @@ def begin_create_or_update( self, resource_group_name, # type: str managed_instance_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] + security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] parameters, # type: "_models.ManagedServerSecurityAlertPolicy" **kwargs # type: Any ): @@ -186,7 +186,7 @@ def begin_create_or_update( :param managed_instance_name: The name of the managed instance. :type managed_instance_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :param parameters: The managed server security alert policy. :type parameters: ~azure.mgmt.sql.models.ManagedServerSecurityAlertPolicy :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py index 34ca09e756df..3534bc825bf3 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_server_security_alert_policies_operations.py @@ -51,7 +51,7 @@ def get( self, resource_group_name, # type: str server_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] + security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] **kwargs # type: Any ): # type: (...) -> "_models.ServerSecurityAlertPolicy" @@ -63,7 +63,7 @@ def get( :param server_name: The name of the server. :type server_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy, or the result of cls(response) :rtype: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy @@ -115,7 +115,7 @@ def _create_or_update_initial( self, resource_group_name, # type: str server_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] + security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] parameters, # type: "_models.ServerSecurityAlertPolicy" **kwargs # type: Any ): @@ -173,7 +173,7 @@ def begin_create_or_update( self, resource_group_name, # type: str server_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] + security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] parameters, # type: "_models.ServerSecurityAlertPolicy" **kwargs # type: Any ): @@ -186,7 +186,7 @@ def begin_create_or_update( :param server_name: The name of the server. :type server_name: str :param security_alert_policy_name: The name of the threat detection policy. - :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or ~azure.mgmt.sql.models.SecurityAlertPolicyName :param parameters: The server security alert policy. :type parameters: ~azure.mgmt.sql.models.ServerSecurityAlertPolicy :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py index a3256265690f..8ddf39e4a151 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_sync_groups_operations.py @@ -333,7 +333,7 @@ def list_logs( sync_group_name, # type: str start_time, # type: str end_time, # type: str - type, # type: Union[str, "_models.Enum77"] + type, # type: Union[str, "_models.Enum76"] continuation_token_parameter=None, # type: Optional[str] **kwargs # type: Any ): @@ -354,7 +354,7 @@ def list_logs( :param end_time: Get logs generated before this time. :type end_time: str :param type: The types of logs to retrieve. - :type type: str or ~azure.mgmt.sql.models.Enum77 + :type type: str or ~azure.mgmt.sql.models.Enum76 :param continuation_token_parameter: The continuation token for this operation. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response