diff --git a/sdk/sql/azure-mgmt-sql/_meta.json b/sdk/sql/azure-mgmt-sql/_meta.json index 0b51a784ca49..7978ee7f0ac0 100644 --- a/sdk/sql/azure-mgmt-sql/_meta.json +++ b/sdk/sql/azure-mgmt-sql/_meta.json @@ -1,11 +1,11 @@ { - "commit": "987a8f38ab2a8359d085e149be042267a9ecc66f", + "commit": "b46590e7eaf1cead01b18fa28b57f149be10029b", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/sql/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/sql/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/sql/resource-manager/readme.md" } \ No newline at end of file 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 11b5bda18193..524ef1003b37 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 @@ -431,6 +431,9 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :ivar server_connection_policies: ServerConnectionPoliciesOperations operations :vartype server_connection_policies: azure.mgmt.sql.operations.ServerConnectionPoliciesOperations + :ivar distributed_availability_groups: DistributedAvailabilityGroupsOperations operations + :vartype distributed_availability_groups: + azure.mgmt.sql.operations.DistributedAvailabilityGroupsOperations :ivar server_trust_certificates: ServerTrustCertificatesOperations operations :vartype server_trust_certificates: azure.mgmt.sql.operations.ServerTrustCertificatesOperations :ivar endpoint_certificates: EndpointCertificatesOperations operations @@ -596,9 +599,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :vartype servers: azure.mgmt.sql.operations.ServersOperations :ivar replication_links: ReplicationLinksOperations operations :vartype replication_links: azure.mgmt.sql.operations.ReplicationLinksOperations - :ivar distributed_availability_groups: DistributedAvailabilityGroupsOperations operations - :vartype distributed_availability_groups: - azure.mgmt.sql.operations.DistributedAvailabilityGroupsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription ID that identifies an Azure subscription. Required. @@ -885,6 +885,9 @@ def __init__( self.server_connection_policies = ServerConnectionPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.distributed_availability_groups = DistributedAvailabilityGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.server_trust_certificates = ServerTrustCertificatesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -1046,9 +1049,6 @@ def __init__( self.replication_links = ReplicationLinksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.distributed_availability_groups = DistributedAvailabilityGroupsOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. 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 2068c1b3af56..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 = "4.0.0b20" +VERSION = "0.9.0" diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py index 058d03827a59..8e24eb5cacd9 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/_sql_management_client.py @@ -435,6 +435,9 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :ivar server_connection_policies: ServerConnectionPoliciesOperations operations :vartype server_connection_policies: azure.mgmt.sql.aio.operations.ServerConnectionPoliciesOperations + :ivar distributed_availability_groups: DistributedAvailabilityGroupsOperations operations + :vartype distributed_availability_groups: + azure.mgmt.sql.aio.operations.DistributedAvailabilityGroupsOperations :ivar server_trust_certificates: ServerTrustCertificatesOperations operations :vartype server_trust_certificates: azure.mgmt.sql.aio.operations.ServerTrustCertificatesOperations @@ -602,9 +605,6 @@ class SqlManagementClient: # pylint: disable=client-accepts-api-version-keyword :vartype servers: azure.mgmt.sql.aio.operations.ServersOperations :ivar replication_links: ReplicationLinksOperations operations :vartype replication_links: azure.mgmt.sql.aio.operations.ReplicationLinksOperations - :ivar distributed_availability_groups: DistributedAvailabilityGroupsOperations operations - :vartype distributed_availability_groups: - azure.mgmt.sql.aio.operations.DistributedAvailabilityGroupsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription ID that identifies an Azure subscription. Required. @@ -891,6 +891,9 @@ def __init__( self.server_connection_policies = ServerConnectionPoliciesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.distributed_availability_groups = DistributedAvailabilityGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.server_trust_certificates = ServerTrustCertificatesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -1052,9 +1055,6 @@ def __init__( self.replication_links = ReplicationLinksOperations( self._client, self._config, self._serialize, self._deserialize ) - self.distributed_availability_groups = DistributedAvailabilityGroupsOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py index a5bb9e006269..3c1a4b9c5172 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/__init__.py @@ -116,6 +116,7 @@ from ._long_term_retention_managed_instance_backups_operations import LongTermRetentionManagedInstanceBackupsOperations from ._restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations +from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations from ._server_trust_certificates_operations import ServerTrustCertificatesOperations from ._endpoint_certificates_operations import EndpointCertificatesOperations from ._managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations @@ -185,7 +186,6 @@ from ._managed_instances_operations import ManagedInstancesOperations from ._servers_operations import ServersOperations from ._replication_links_operations import ReplicationLinksOperations -from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -288,6 +288,7 @@ "LongTermRetentionManagedInstanceBackupsOperations", "RestorableDroppedManagedDatabasesOperations", "ServerConnectionPoliciesOperations", + "DistributedAvailabilityGroupsOperations", "ServerTrustCertificatesOperations", "EndpointCertificatesOperations", "ManagedDatabaseSensitivityLabelsOperations", @@ -341,7 +342,6 @@ "ManagedInstancesOperations", "ServersOperations", "ReplicationLinksOperations", - "DistributedAvailabilityGroupsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py index 65480382e1f8..d90d108a9d95 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/aio/operations/_distributed_availability_groups_operations.py @@ -34,10 +34,8 @@ from ...operations._distributed_availability_groups_operations import ( build_create_or_update_request, build_delete_request, - build_failover_request, build_get_request, build_list_by_instance_request, - build_set_role_request, build_update_request, ) @@ -88,7 +86,7 @@ def list_by_instance( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[_models.DistributedAvailabilityGroupsListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -136,8 +134,7 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) return pipeline_response @@ -175,7 +172,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) _request = build_get_request( @@ -198,8 +195,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("DistributedAvailabilityGroup", pipeline_response.http_response) @@ -227,7 +223,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -267,8 +263,7 @@ async def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -368,7 +363,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -431,7 +426,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -459,8 +454,7 @@ async def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -493,7 +487,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -550,7 +544,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -590,8 +584,7 @@ async def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -691,7 +684,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -735,422 +728,3 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller[_models.DistributedAvailabilityGroup]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - async def _failover_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupsFailoverRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DistributedAvailabilityGroupsFailoverRequest") - - _request = build_failover_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: _models.DistributedAvailabilityGroupsFailoverRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DistributedAvailabilityGroup]: - """Performs requested failover type in this distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group failover request parameters. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupsFailoverRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DistributedAvailabilityGroup]: - """Performs requested failover type in this distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group failover request parameters. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupsFailoverRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DistributedAvailabilityGroup]: - """Performs requested failover type in this distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group failover request parameters. Is either a - DistributedAvailabilityGroupsFailoverRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupsFailoverRequest or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._failover_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DistributedAvailabilityGroup", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DistributedAvailabilityGroup].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DistributedAvailabilityGroup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _set_role_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupSetRole, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DistributedAvailabilityGroupSetRole") - - _request = build_set_role_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_set_role( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: _models.DistributedAvailabilityGroupSetRole, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DistributedAvailabilityGroup]: - """Sets the role for managed instance in a distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group set role request parameters. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupSetRole - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_set_role( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.DistributedAvailabilityGroup]: - """Sets the role for managed instance in a distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group set role request parameters. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_set_role( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupSetRole, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.DistributedAvailabilityGroup]: - """Sets the role for managed instance in a distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group set role request parameters. Is either a - DistributedAvailabilityGroupSetRole type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupSetRole or IO[bytes] - :return: An instance of AsyncLROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._set_role_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DistributedAvailabilityGroup", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.DistributedAvailabilityGroup].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.DistributedAvailabilityGroup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) 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 1b89fb810ad7..0137688191e3 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 @@ -17,7 +17,6 @@ from ._models_py3 import Baseline from ._models_py3 import BaselineAdjustedResult from ._models_py3 import BenchmarkReference -from ._models_py3 import CertificateInfo from ._models_py3 import ChangeLongTermRetentionBackupAccessTierParameters from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse @@ -67,9 +66,6 @@ from ._models_py3 import DeletedServer from ._models_py3 import DeletedServerListResult from ._models_py3 import DistributedAvailabilityGroup -from ._models_py3 import DistributedAvailabilityGroupDatabase -from ._models_py3 import DistributedAvailabilityGroupSetRole -from ._models_py3 import DistributedAvailabilityGroupsFailoverRequest from ._models_py3 import DistributedAvailabilityGroupsListResult from ._models_py3 import EditionCapability from ._models_py3 import ElasticPool @@ -477,8 +473,6 @@ from ._sql_management_client_enums import ExternalGovernanceStatus from ._sql_management_client_enums import FailoverGroupDatabasesSecondaryType from ._sql_management_client_enums import FailoverGroupReplicationRole -from ._sql_management_client_enums import FailoverModeType -from ._sql_management_client_enums import FailoverType from ._sql_management_client_enums import FreeLimitExhaustionBehavior from ._sql_management_client_enums import FreemiumType from ._sql_management_client_enums import GeoBackupPolicyName @@ -489,7 +483,6 @@ from ._sql_management_client_enums import ImplementationMethod from ._sql_management_client_enums import InstanceFailoverGroupReplicationRole from ._sql_management_client_enums import InstancePoolLicenseType -from ._sql_management_client_enums import InstanceRole from ._sql_management_client_enums import IsRetryable from ._sql_management_client_enums import JobAgentState from ._sql_management_client_enums import JobExecutionLifecycle @@ -501,7 +494,6 @@ from ._sql_management_client_enums import JobTargetType from ._sql_management_client_enums import LedgerDigestUploadsName from ._sql_management_client_enums import LedgerDigestUploadsState -from ._sql_management_client_enums import LinkRole from ._sql_management_client_enums import LogSizeUnit from ._sql_management_client_enums import LongTermRetentionPolicyName from ._sql_management_client_enums import ManagedDatabaseCreateMode @@ -538,16 +530,13 @@ from ._sql_management_client_enums import RecommendedActionCurrentState from ._sql_management_client_enums import RecommendedActionInitiatedBy from ._sql_management_client_enums import RecommendedSensitivityLabelUpdateKind -from ._sql_management_client_enums import ReplicaConnectedState -from ._sql_management_client_enums import ReplicaSynchronizationHealth from ._sql_management_client_enums import ReplicaType from ._sql_management_client_enums import ReplicationLinkType -from ._sql_management_client_enums import ReplicationModeType +from ._sql_management_client_enums import ReplicationMode from ._sql_management_client_enums import ReplicationRole from ._sql_management_client_enums import ReplicationState from ._sql_management_client_enums import RestoreDetailsName from ._sql_management_client_enums import RestorePointType -from ._sql_management_client_enums import RoleChangeType from ._sql_management_client_enums import RuleSeverity from ._sql_management_client_enums import RuleStatus from ._sql_management_client_enums import RuleType @@ -558,7 +547,6 @@ from ._sql_management_client_enums import SecurityAlertPolicyState from ._sql_management_client_enums import SecurityAlertsPolicyState from ._sql_management_client_enums import SecurityEventType -from ._sql_management_client_enums import SeedingModeType from ._sql_management_client_enums import SensitivityLabelRank from ._sql_management_client_enums import SensitivityLabelSource from ._sql_management_client_enums import SensitivityLabelUpdateKind @@ -613,7 +601,6 @@ "Baseline", "BaselineAdjustedResult", "BenchmarkReference", - "CertificateInfo", "ChangeLongTermRetentionBackupAccessTierParameters", "CheckNameAvailabilityRequest", "CheckNameAvailabilityResponse", @@ -663,9 +650,6 @@ "DeletedServer", "DeletedServerListResult", "DistributedAvailabilityGroup", - "DistributedAvailabilityGroupDatabase", - "DistributedAvailabilityGroupSetRole", - "DistributedAvailabilityGroupsFailoverRequest", "DistributedAvailabilityGroupsListResult", "EditionCapability", "ElasticPool", @@ -1072,8 +1056,6 @@ "ExternalGovernanceStatus", "FailoverGroupDatabasesSecondaryType", "FailoverGroupReplicationRole", - "FailoverModeType", - "FailoverType", "FreeLimitExhaustionBehavior", "FreemiumType", "GeoBackupPolicyName", @@ -1084,7 +1066,6 @@ "ImplementationMethod", "InstanceFailoverGroupReplicationRole", "InstancePoolLicenseType", - "InstanceRole", "IsRetryable", "JobAgentState", "JobExecutionLifecycle", @@ -1096,7 +1077,6 @@ "JobTargetType", "LedgerDigestUploadsName", "LedgerDigestUploadsState", - "LinkRole", "LogSizeUnit", "LongTermRetentionPolicyName", "ManagedDatabaseCreateMode", @@ -1133,16 +1113,13 @@ "RecommendedActionCurrentState", "RecommendedActionInitiatedBy", "RecommendedSensitivityLabelUpdateKind", - "ReplicaConnectedState", - "ReplicaSynchronizationHealth", "ReplicaType", "ReplicationLinkType", - "ReplicationModeType", + "ReplicationMode", "ReplicationRole", "ReplicationState", "RestoreDetailsName", "RestorePointType", - "RoleChangeType", "RuleSeverity", "RuleStatus", "RuleType", @@ -1153,7 +1130,6 @@ "SecurityAlertPolicyState", "SecurityAlertsPolicyState", "SecurityEventType", - "SeedingModeType", "SensitivityLabelRank", "SensitivityLabelSource", "SensitivityLabelUpdateKind", 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 d7ffcf8b85ed..23ddb6a0f209 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 @@ -528,34 +528,6 @@ def __init__(self, **kwargs: Any) -> None: self.reference = None -class CertificateInfo(_serialization.Model): - """Certificate information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar certificate_name: The certificate name. - :vartype certificate_name: str - :ivar expiry_date: The certificate expiry date. - :vartype expiry_date: ~datetime.datetime - """ - - _validation = { - "certificate_name": {"readonly": True}, - "expiry_date": {"readonly": True}, - } - - _attribute_map = { - "certificate_name": {"key": "certificateName", "type": "str"}, - "expiry_date": {"key": "expiryDate", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.certificate_name = None - self.expiry_date = None - - class ChangeLongTermRetentionBackupAccessTierParameters(_serialization.Model): # pylint: disable=name-too-long """Contains the information necessary to change long term retention backup access tier and related operation mode. @@ -4111,309 +4083,90 @@ class DistributedAvailabilityGroup(ProxyResource): # pylint: disable=too-many-i :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar distributed_availability_group_name: Name of the distributed availability group. - :vartype distributed_availability_group_name: str - :ivar distributed_availability_group_id: ID of the distributed availability group. + :ivar target_database: The name of the target database. + :vartype target_database: str + :ivar source_endpoint: The source endpoint. + :vartype source_endpoint: str + :ivar primary_availability_group_name: The primary availability group name. + :vartype primary_availability_group_name: str + :ivar secondary_availability_group_name: The secondary availability group name. + :vartype secondary_availability_group_name: str + :ivar replication_mode: The replication mode of a distributed availability group. Parameter + will be ignored during link creation. Known values are: "Async", "Sync", and "Async". + :vartype replication_mode: str or ~azure.mgmt.sql.models.ReplicationMode + :ivar distributed_availability_group_id: The distributed availability group id. :vartype distributed_availability_group_id: str - :ivar replication_mode: Replication mode of the link. Known values are: "Async", "Sync", and - "Async". - :vartype replication_mode: str or ~azure.mgmt.sql.models.ReplicationModeType - :ivar partner_link_role: SQL server side link role. Known values are: "Primary" and - "Secondary". - :vartype partner_link_role: str or ~azure.mgmt.sql.models.LinkRole - :ivar partner_availability_group_name: SQL server side availability group name. - :vartype partner_availability_group_name: str - :ivar partner_endpoint: SQL server side endpoint - IP or DNS resolvable name. - :vartype partner_endpoint: str - :ivar instance_link_role: Managed instance side link role. Known values are: "Primary" and - "Secondary". - :vartype instance_link_role: str or ~azure.mgmt.sql.models.LinkRole - :ivar instance_availability_group_name: Managed instance side availability group name. - :vartype instance_availability_group_name: str - :ivar failover_mode: The link failover mode - can be Manual if intended to be used for two-way - failover with a supported SQL Server, or None for one-way failover to Azure. Known values are: - "None" and "Manual". - :vartype failover_mode: str or ~azure.mgmt.sql.models.FailoverModeType - :ivar seeding_mode: Database seeding mode – can be Automatic (default), or Manual for supported - scenarios. Known values are: "Automatic" and "Manual". - :vartype seeding_mode: str or ~azure.mgmt.sql.models.SeedingModeType - :ivar databases: Databases in the distributed availability group. - :vartype databases: list[~azure.mgmt.sql.models.DistributedAvailabilityGroupDatabase] + :ivar source_replica_id: The source replica id. + :vartype source_replica_id: str + :ivar target_replica_id: The target replica id. + :vartype target_replica_id: str + :ivar link_state: The link state. + :vartype link_state: str + :ivar last_hardened_lsn: The last hardened lsn. + :vartype last_hardened_lsn: str """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "distributed_availability_group_name": {"readonly": True}, "distributed_availability_group_id": {"readonly": True}, - "partner_link_role": {"readonly": True}, + "source_replica_id": {"readonly": True}, + "target_replica_id": {"readonly": True}, + "link_state": {"readonly": True}, + "last_hardened_lsn": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "distributed_availability_group_name": {"key": "properties.distributedAvailabilityGroupName", "type": "str"}, - "distributed_availability_group_id": {"key": "properties.distributedAvailabilityGroupId", "type": "str"}, + "target_database": {"key": "properties.targetDatabase", "type": "str"}, + "source_endpoint": {"key": "properties.sourceEndpoint", "type": "str"}, + "primary_availability_group_name": {"key": "properties.primaryAvailabilityGroupName", "type": "str"}, + "secondary_availability_group_name": {"key": "properties.secondaryAvailabilityGroupName", "type": "str"}, "replication_mode": {"key": "properties.replicationMode", "type": "str"}, - "partner_link_role": {"key": "properties.partnerLinkRole", "type": "str"}, - "partner_availability_group_name": {"key": "properties.partnerAvailabilityGroupName", "type": "str"}, - "partner_endpoint": {"key": "properties.partnerEndpoint", "type": "str"}, - "instance_link_role": {"key": "properties.instanceLinkRole", "type": "str"}, - "instance_availability_group_name": {"key": "properties.instanceAvailabilityGroupName", "type": "str"}, - "failover_mode": {"key": "properties.failoverMode", "type": "str"}, - "seeding_mode": {"key": "properties.seedingMode", "type": "str"}, - "databases": {"key": "properties.databases", "type": "[DistributedAvailabilityGroupDatabase]"}, + "distributed_availability_group_id": {"key": "properties.distributedAvailabilityGroupId", "type": "str"}, + "source_replica_id": {"key": "properties.sourceReplicaId", "type": "str"}, + "target_replica_id": {"key": "properties.targetReplicaId", "type": "str"}, + "link_state": {"key": "properties.linkState", "type": "str"}, + "last_hardened_lsn": {"key": "properties.lastHardenedLsn", "type": "str"}, } def __init__( self, *, - replication_mode: Optional[Union[str, "_models.ReplicationModeType"]] = None, - partner_availability_group_name: Optional[str] = None, - partner_endpoint: Optional[str] = None, - instance_link_role: Optional[Union[str, "_models.LinkRole"]] = None, - instance_availability_group_name: Optional[str] = None, - failover_mode: Optional[Union[str, "_models.FailoverModeType"]] = None, - seeding_mode: Optional[Union[str, "_models.SeedingModeType"]] = None, - databases: Optional[List["_models.DistributedAvailabilityGroupDatabase"]] = None, + target_database: Optional[str] = None, + source_endpoint: Optional[str] = None, + primary_availability_group_name: Optional[str] = None, + secondary_availability_group_name: Optional[str] = None, + replication_mode: Optional[Union[str, "_models.ReplicationMode"]] = None, **kwargs: Any ) -> None: """ - :keyword replication_mode: Replication mode of the link. Known values are: "Async", "Sync", and - "Async". - :paramtype replication_mode: str or ~azure.mgmt.sql.models.ReplicationModeType - :keyword partner_availability_group_name: SQL server side availability group name. - :paramtype partner_availability_group_name: str - :keyword partner_endpoint: SQL server side endpoint - IP or DNS resolvable name. - :paramtype partner_endpoint: str - :keyword instance_link_role: Managed instance side link role. Known values are: "Primary" and - "Secondary". - :paramtype instance_link_role: str or ~azure.mgmt.sql.models.LinkRole - :keyword instance_availability_group_name: Managed instance side availability group name. - :paramtype instance_availability_group_name: str - :keyword failover_mode: The link failover mode - can be Manual if intended to be used for - two-way failover with a supported SQL Server, or None for one-way failover to Azure. Known - values are: "None" and "Manual". - :paramtype failover_mode: str or ~azure.mgmt.sql.models.FailoverModeType - :keyword seeding_mode: Database seeding mode – can be Automatic (default), or Manual for - supported scenarios. Known values are: "Automatic" and "Manual". - :paramtype seeding_mode: str or ~azure.mgmt.sql.models.SeedingModeType - :keyword databases: Databases in the distributed availability group. - :paramtype databases: list[~azure.mgmt.sql.models.DistributedAvailabilityGroupDatabase] - """ - super().__init__(**kwargs) - self.distributed_availability_group_name = None - self.distributed_availability_group_id = None + :keyword target_database: The name of the target database. + :paramtype target_database: str + :keyword source_endpoint: The source endpoint. + :paramtype source_endpoint: str + :keyword primary_availability_group_name: The primary availability group name. + :paramtype primary_availability_group_name: str + :keyword secondary_availability_group_name: The secondary availability group name. + :paramtype secondary_availability_group_name: str + :keyword replication_mode: The replication mode of a distributed availability group. Parameter + will be ignored during link creation. Known values are: "Async", "Sync", and "Async". + :paramtype replication_mode: str or ~azure.mgmt.sql.models.ReplicationMode + """ + super().__init__(**kwargs) + self.target_database = target_database + self.source_endpoint = source_endpoint + self.primary_availability_group_name = primary_availability_group_name + self.secondary_availability_group_name = secondary_availability_group_name self.replication_mode = replication_mode - self.partner_link_role = None - self.partner_availability_group_name = partner_availability_group_name - self.partner_endpoint = partner_endpoint - self.instance_link_role = instance_link_role - self.instance_availability_group_name = instance_availability_group_name - self.failover_mode = failover_mode - self.seeding_mode = seeding_mode - self.databases = databases - - -class DistributedAvailabilityGroupDatabase(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Database specific information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar database_name: The name of the database in link. - :vartype database_name: str - :ivar instance_replica_id: Managed instance replica id. - :vartype instance_replica_id: str - :ivar partner_replica_id: SQL server replica id. - :vartype partner_replica_id: str - :ivar replica_state: Current link state. - :vartype replica_state: str - :ivar seeding_progress: Seeding progress. - :vartype seeding_progress: str - :ivar synchronization_health: Link health state. Known values are: "NOT_HEALTHY", - "PARTIALLY_HEALTHY", and "HEALTHY". - :vartype synchronization_health: str or ~azure.mgmt.sql.models.ReplicaSynchronizationHealth - :ivar connected_state: Link connected state. Known values are: "DISCONNECTED" and "CONNECTED". - :vartype connected_state: str or ~azure.mgmt.sql.models.ReplicaConnectedState - :ivar last_received_lsn: Last received LSN. - :vartype last_received_lsn: str - :ivar last_received_time: Last received LSN time. - :vartype last_received_time: ~datetime.datetime - :ivar last_sent_lsn: Last sent LSN. - :vartype last_sent_lsn: str - :ivar last_sent_time: Last sent LSN time. - :vartype last_sent_time: ~datetime.datetime - :ivar last_commit_lsn: Last commit LSN. - :vartype last_commit_lsn: str - :ivar last_commit_time: Last commit LSN time. - :vartype last_commit_time: ~datetime.datetime - :ivar last_hardened_lsn: Last hardened LSN. - :vartype last_hardened_lsn: str - :ivar last_hardened_time: Last hardened LSN time. - :vartype last_hardened_time: ~datetime.datetime - :ivar last_backup_lsn: Last backup LSN. - :vartype last_backup_lsn: str - :ivar last_backup_time: Last backup LSN time. - :vartype last_backup_time: ~datetime.datetime - :ivar most_recent_link_error: The most recent link connection error description. - :vartype most_recent_link_error: str - :ivar partner_auth_cert_validity: SQL server certificate validity. - :vartype partner_auth_cert_validity: ~azure.mgmt.sql.models.CertificateInfo - :ivar instance_send_replication_lag_seconds: Replication lag when Managed Instance link side is - primary. - :vartype instance_send_replication_lag_seconds: int - :ivar instance_redo_replication_lag_seconds: Redo lag when Managed Instance link side is - primary. - :vartype instance_redo_replication_lag_seconds: int - """ - - _validation = { - "instance_replica_id": {"readonly": True}, - "partner_replica_id": {"readonly": True}, - "replica_state": {"readonly": True}, - "seeding_progress": {"readonly": True}, - "synchronization_health": {"readonly": True}, - "connected_state": {"readonly": True}, - "last_received_lsn": {"readonly": True}, - "last_received_time": {"readonly": True}, - "last_sent_lsn": {"readonly": True}, - "last_sent_time": {"readonly": True}, - "last_commit_lsn": {"readonly": True}, - "last_commit_time": {"readonly": True}, - "last_hardened_lsn": {"readonly": True}, - "last_hardened_time": {"readonly": True}, - "last_backup_lsn": {"readonly": True}, - "last_backup_time": {"readonly": True}, - "most_recent_link_error": {"readonly": True}, - "partner_auth_cert_validity": {"readonly": True}, - "instance_send_replication_lag_seconds": {"readonly": True}, - "instance_redo_replication_lag_seconds": {"readonly": True}, - } - - _attribute_map = { - "database_name": {"key": "databaseName", "type": "str"}, - "instance_replica_id": {"key": "instanceReplicaId", "type": "str"}, - "partner_replica_id": {"key": "partnerReplicaId", "type": "str"}, - "replica_state": {"key": "replicaState", "type": "str"}, - "seeding_progress": {"key": "seedingProgress", "type": "str"}, - "synchronization_health": {"key": "synchronizationHealth", "type": "str"}, - "connected_state": {"key": "connectedState", "type": "str"}, - "last_received_lsn": {"key": "lastReceivedLsn", "type": "str"}, - "last_received_time": {"key": "lastReceivedTime", "type": "iso-8601"}, - "last_sent_lsn": {"key": "lastSentLsn", "type": "str"}, - "last_sent_time": {"key": "lastSentTime", "type": "iso-8601"}, - "last_commit_lsn": {"key": "lastCommitLsn", "type": "str"}, - "last_commit_time": {"key": "lastCommitTime", "type": "iso-8601"}, - "last_hardened_lsn": {"key": "lastHardenedLsn", "type": "str"}, - "last_hardened_time": {"key": "lastHardenedTime", "type": "iso-8601"}, - "last_backup_lsn": {"key": "lastBackupLsn", "type": "str"}, - "last_backup_time": {"key": "lastBackupTime", "type": "iso-8601"}, - "most_recent_link_error": {"key": "mostRecentLinkError", "type": "str"}, - "partner_auth_cert_validity": {"key": "partnerAuthCertValidity", "type": "CertificateInfo"}, - "instance_send_replication_lag_seconds": {"key": "instanceSendReplicationLagSeconds", "type": "int"}, - "instance_redo_replication_lag_seconds": {"key": "instanceRedoReplicationLagSeconds", "type": "int"}, - } - - def __init__(self, *, database_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword database_name: The name of the database in link. - :paramtype database_name: str - """ - super().__init__(**kwargs) - self.database_name = database_name - self.instance_replica_id = None - self.partner_replica_id = None - self.replica_state = None - self.seeding_progress = None - self.synchronization_health = None - self.connected_state = None - self.last_received_lsn = None - self.last_received_time = None - self.last_sent_lsn = None - self.last_sent_time = None - self.last_commit_lsn = None - self.last_commit_time = None + self.distributed_availability_group_id = None + self.source_replica_id = None + self.target_replica_id = None + self.link_state = None self.last_hardened_lsn = None - self.last_hardened_time = None - self.last_backup_lsn = None - self.last_backup_time = None - self.most_recent_link_error = None - self.partner_auth_cert_validity = None - self.instance_send_replication_lag_seconds = None - self.instance_redo_replication_lag_seconds = None - - -class DistributedAvailabilityGroupSetRole(_serialization.Model): - """Distributed availability group failover request. - - All required parameters must be populated in order to send to server. - - :ivar instance_role: New role of managed instance in a distributed availability group, can be - Primary or Secondary. Required. Known values are: "Primary" and "Secondary". - :vartype instance_role: str or ~azure.mgmt.sql.models.InstanceRole - :ivar role_change_type: The type of the role change, can be Planned or Forced. Required. Known - values are: "Forced" and "Planned". - :vartype role_change_type: str or ~azure.mgmt.sql.models.RoleChangeType - """ - - _validation = { - "instance_role": {"required": True}, - "role_change_type": {"required": True}, - } - - _attribute_map = { - "instance_role": {"key": "instanceRole", "type": "str"}, - "role_change_type": {"key": "roleChangeType", "type": "str"}, - } - - def __init__( - self, - *, - instance_role: Union[str, "_models.InstanceRole"], - role_change_type: Union[str, "_models.RoleChangeType"], - **kwargs: Any - ) -> None: - """ - :keyword instance_role: New role of managed instance in a distributed availability group, can - be Primary or Secondary. Required. Known values are: "Primary" and "Secondary". - :paramtype instance_role: str or ~azure.mgmt.sql.models.InstanceRole - :keyword role_change_type: The type of the role change, can be Planned or Forced. Required. - Known values are: "Forced" and "Planned". - :paramtype role_change_type: str or ~azure.mgmt.sql.models.RoleChangeType - """ - super().__init__(**kwargs) - self.instance_role = instance_role - self.role_change_type = role_change_type - - -class DistributedAvailabilityGroupsFailoverRequest(_serialization.Model): # pylint: disable=name-too-long - """Distributed availability group failover. - - All required parameters must be populated in order to send to server. - - :ivar failover_type: The failover type, can be ForcedAllowDataLoss or Planned. Required. Known - values are: "ForcedAllowDataLoss" and "Planned". - :vartype failover_type: str or ~azure.mgmt.sql.models.FailoverType - """ - - _validation = { - "failover_type": {"required": True}, - } - - _attribute_map = { - "failover_type": {"key": "failoverType", "type": "str"}, - } - - def __init__(self, *, failover_type: Union[str, "_models.FailoverType"], **kwargs: Any) -> None: - """ - :keyword failover_type: The failover type, can be ForcedAllowDataLoss or Planned. Required. - Known values are: "ForcedAllowDataLoss" and "Planned". - :paramtype failover_type: str or ~azure.mgmt.sql.models.FailoverType - """ - super().__init__(**kwargs) - self.failover_type = failover_type class DistributedAvailabilityGroupsListResult(_serialization.Model): 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 b14dee5e0746..19c4a7c86efe 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 @@ -518,22 +518,6 @@ class FailoverGroupReplicationRole(str, Enum, metaclass=CaseInsensitiveEnumMeta) SECONDARY = "Secondary" -class FailoverModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The link failover mode - can be Manual if intended to be used for two-way failover with a - supported SQL Server, or None for one-way failover to Azure. - """ - - NONE = "None" - MANUAL = "Manual" - - -class FailoverType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The failover type, can be ForcedAllowDataLoss or Planned.""" - - FORCED_ALLOW_DATA_LOSS = "ForcedAllowDataLoss" - PLANNED = "Planned" - - class FreeLimitExhaustionBehavior(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the behavior when monthly free limits are exhausted for the free database. @@ -623,13 +607,6 @@ class InstancePoolLicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): BASE_PRICE = "BasePrice" -class InstanceRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """New role of managed instance in a distributed availability group, can be Primary or Secondary.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - class IsRetryable(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No. @@ -719,13 +696,6 @@ class LedgerDigestUploadsState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" -class LinkRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SQL server side link role.""" - - PRIMARY = "Primary" - SECONDARY = "Secondary" - - class LogSizeUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The units that the limit is expressed in.""" @@ -1056,21 +1026,6 @@ class RecommendedSensitivityLabelUpdateKind(str, Enum, metaclass=CaseInsensitive DISABLE = "disable" -class ReplicaConnectedState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Link connected state.""" - - DISCONNECTED = "DISCONNECTED" - CONNECTED = "CONNECTED" - - -class ReplicaSynchronizationHealth(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Link health state.""" - - NOT_HEALTHY = "NOT_HEALTHY" - PARTIALLY_HEALTHY = "PARTIALLY_HEALTHY" - HEALTHY = "HEALTHY" - - class ReplicationLinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Link type (GEO, NAMED, STANDBY). Update operation does not support NAMED.""" @@ -1079,8 +1034,10 @@ class ReplicationLinkType(str, Enum, metaclass=CaseInsensitiveEnumMeta): STANDBY = "STANDBY" -class ReplicationModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Replication mode of the link.""" +class ReplicationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The replication mode of a distributed availability group. Parameter will be ignored during link + creation. + """ ASYNC = "Async" SYNC = "Sync" @@ -1126,13 +1083,6 @@ class RestorePointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISCRETE = "DISCRETE" -class RoleChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the role change, can be Planned or Forced.""" - - FORCED = "Forced" - PLANNED = "Planned" - - class RuleSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Vulnerability Assessment rule severity.""" @@ -1218,13 +1168,6 @@ class SecurityEventType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SQL_INJECTION_EXPLOIT = "SqlInjectionExploit" -class SeedingModeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Database seeding mode – can be Automatic (default), or Manual for supported scenarios.""" - - AUTOMATIC = "Automatic" - MANUAL = "Manual" - - class SensitivityLabelRank(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SensitivityLabelRank.""" 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 a5bb9e006269..3c1a4b9c5172 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 @@ -116,6 +116,7 @@ from ._long_term_retention_managed_instance_backups_operations import LongTermRetentionManagedInstanceBackupsOperations from ._restorable_dropped_managed_databases_operations import RestorableDroppedManagedDatabasesOperations from ._server_connection_policies_operations import ServerConnectionPoliciesOperations +from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations from ._server_trust_certificates_operations import ServerTrustCertificatesOperations from ._endpoint_certificates_operations import EndpointCertificatesOperations from ._managed_database_sensitivity_labels_operations import ManagedDatabaseSensitivityLabelsOperations @@ -185,7 +186,6 @@ from ._managed_instances_operations import ManagedInstancesOperations from ._servers_operations import ServersOperations from ._replication_links_operations import ReplicationLinksOperations -from ._distributed_availability_groups_operations import DistributedAvailabilityGroupsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -288,6 +288,7 @@ "LongTermRetentionManagedInstanceBackupsOperations", "RestorableDroppedManagedDatabasesOperations", "ServerConnectionPoliciesOperations", + "DistributedAvailabilityGroupsOperations", "ServerTrustCertificatesOperations", "EndpointCertificatesOperations", "ManagedDatabaseSensitivityLabelsOperations", @@ -341,7 +342,6 @@ "ManagedInstancesOperations", "ServersOperations", "ReplicationLinksOperations", - "DistributedAvailabilityGroupsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py index 7f3482eb516a..7544e82c40c5 100644 --- a/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_distributed_availability_groups_operations.py @@ -49,7 +49,7 @@ def build_list_by_instance_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +84,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +122,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -160,12 +160,9 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - accept = _headers.pop("Accept", "application/json") - + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) # Construct URL _url = kwargs.pop( "template_url", @@ -185,10 +182,7 @@ def build_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) def build_update_request( @@ -201,7 +195,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -232,100 +226,6 @@ def build_update_request( return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_failover_request( - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/failover", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "managedInstanceName": _SERIALIZER.url( - "managed_instance_name", - managed_instance_name, - "str", - max_length=63, - min_length=1, - pattern=r"^[a-z0-9]+(?:-[a-z0-9]+)*$", - ), - "distributedAvailabilityGroupName": _SERIALIZER.url( - "distributed_availability_group_name", - distributed_availability_group_name, - "str", - max_length=128, - min_length=1, - pattern=r"^[#a-zA-Z_][\w@#$]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_set_role_request( - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/setRole", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "managedInstanceName": _SERIALIZER.url("managed_instance_name", managed_instance_name, "str"), - "distributedAvailabilityGroupName": _SERIALIZER.url( - "distributed_availability_group_name", distributed_availability_group_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - class DistributedAvailabilityGroupsOperations: """ .. warning:: @@ -364,7 +264,7 @@ def list_by_instance( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[_models.DistributedAvailabilityGroupsListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -412,8 +312,7 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) return pipeline_response @@ -451,7 +350,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) _request = build_get_request( @@ -474,8 +373,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize("DistributedAvailabilityGroup", pipeline_response.http_response) @@ -503,7 +401,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -543,8 +441,7 @@ def _create_or_update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -644,7 +541,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -707,7 +604,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -735,8 +632,7 @@ def _delete_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -769,7 +665,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -826,7 +722,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -866,8 +762,7 @@ def _update_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) @@ -967,7 +862,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2021-11-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1011,422 +906,3 @@ def get_long_running_output(pipeline_response): return LROPoller[_models.DistributedAvailabilityGroup]( self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - - def _failover_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupsFailoverRequest, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DistributedAvailabilityGroupsFailoverRequest") - - _request = build_failover_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: _models.DistributedAvailabilityGroupsFailoverRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DistributedAvailabilityGroup]: - """Performs requested failover type in this distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group failover request parameters. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupsFailoverRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DistributedAvailabilityGroup]: - """Performs requested failover type in this distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group failover request parameters. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_failover( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupsFailoverRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DistributedAvailabilityGroup]: - """Performs requested failover type in this distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group failover request parameters. Is either a - DistributedAvailabilityGroupsFailoverRequest type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupsFailoverRequest or - IO[bytes] - :return: An instance of LROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._failover_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DistributedAvailabilityGroup", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DistributedAvailabilityGroup].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DistributedAvailabilityGroup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _set_role_initial( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupSetRole, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "DistributedAvailabilityGroupSetRole") - - _request = build_set_role_request( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_set_role( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: _models.DistributedAvailabilityGroupSetRole, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DistributedAvailabilityGroup]: - """Sets the role for managed instance in a distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group set role request parameters. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupSetRole - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_set_role( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.DistributedAvailabilityGroup]: - """Sets the role for managed instance in a distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group set role request parameters. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_set_role( - self, - resource_group_name: str, - managed_instance_name: str, - distributed_availability_group_name: str, - parameters: Union[_models.DistributedAvailabilityGroupSetRole, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.DistributedAvailabilityGroup]: - """Sets the role for managed instance in a distributed availability 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. Required. - :type resource_group_name: str - :param managed_instance_name: The name of the managed instance. Required. - :type managed_instance_name: str - :param distributed_availability_group_name: The distributed availability group name. Required. - :type distributed_availability_group_name: str - :param parameters: The distributed availability group set role request parameters. Is either a - DistributedAvailabilityGroupSetRole type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.sql.models.DistributedAvailabilityGroupSetRole or IO[bytes] - :return: An instance of LROPoller that returns either DistributedAvailabilityGroup or the - result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.sql.models.DistributedAvailabilityGroup] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DistributedAvailabilityGroup] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._set_role_initial( - resource_group_name=resource_group_name, - managed_instance_name=managed_instance_name, - distributed_availability_group_name=distributed_availability_group_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DistributedAvailabilityGroup", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.DistributedAvailabilityGroup].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.DistributedAvailabilityGroup]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create_min.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create.py similarity index 80% rename from sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create_min.py rename to sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create.py index 8d68965d0195..eaaab62f4d19 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create_min.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-sql # USAGE - python distributed_availability_groups_create_min.py + python distributed_availability_groups_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -36,16 +36,16 @@ def main(): distributed_availability_group_name="dag", parameters={ "properties": { - "databases": [{"databaseName": "testdb"}], - "instanceAvailabilityGroupName": "testcl", - "partnerAvailabilityGroupName": "BoxLocalAg1", - "partnerEndpoint": "TCP://SERVER:7022", + "primaryAvailabilityGroupName": "BoxLocalAg1", + "secondaryAvailabilityGroupName": "testcl", + "sourceEndpoint": "TCP://SERVER:7022", + "targetDatabase": "testdb", } }, ).result() print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsCreateMin.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create_max.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create_max.py deleted file mode 100644 index be967c1f7b67..000000000000 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_create_max.py +++ /dev/null @@ -1,54 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.sql import SqlManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-sql -# USAGE - python distributed_availability_groups_create_max.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = SqlManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.distributed_availability_groups.begin_create_or_update( - resource_group_name="testrg", - managed_instance_name="testcl", - distributed_availability_group_name="dag", - parameters={ - "properties": { - "databases": [{"databaseName": "testdb"}], - "failoverMode": "None", - "instanceAvailabilityGroupName": "testcl", - "instanceLinkRole": "Primary", - "partnerAvailabilityGroupName": "BoxLocalAg1", - "partnerEndpoint": "TCP://SERVER:7022", - "seedingMode": "Automatic", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsCreateMax.json -if __name__ == "__main__": - main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_delete.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_delete.py index 6b1b9baa83fa..ba3e4beb412f 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_delete.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_delete.py @@ -27,7 +27,7 @@ def main(): client = SqlManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="f2669dff-5f08-45dd-b857-b2a60b72cdc9", ) client.distributed_availability_groups.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsDelete.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_failover.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_failover.py deleted file mode 100644 index c4de78c5231b..000000000000 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_failover.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.sql import SqlManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-sql -# USAGE - python distributed_availability_groups_failover.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = SqlManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.distributed_availability_groups.begin_failover( - resource_group_name="testrg", - managed_instance_name="testcl", - distributed_availability_group_name="dag", - parameters={"failoverType": "ForcedAllowDataLoss"}, - ).result() - print(response) - - -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsFailover.json -if __name__ == "__main__": - main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_get.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_get.py index bd3f94df18f0..8b4f0c38b1e8 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_get.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_get.py @@ -27,7 +27,7 @@ def main(): client = SqlManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="f2669dff-5f08-45dd-b857-b2a60b72cdc9", ) response = client.distributed_availability_groups.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsGet.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_list_by_instance.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_list_by_instance.py index 46fcf2d932fb..6a72d6419afd 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_list_by_instance.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_list_by_instance.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_set_role.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_set_role.py deleted file mode 100644 index a6276f470215..000000000000 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_set_role.py +++ /dev/null @@ -1,44 +0,0 @@ -# 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 azure.identity import DefaultAzureCredential - -from azure.mgmt.sql import SqlManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-sql -# USAGE - python distributed_availability_groups_set_role.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = SqlManagementClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", - ) - - response = client.distributed_availability_groups.begin_set_role( - resource_group_name="testrg", - managed_instance_name="testcl", - distributed_availability_group_name="dag", - parameters={"instanceRole": "Primary", "roleChangeType": "Forced"}, - ).result() - print(response) - - -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsSetRole.json -if __name__ == "__main__": - main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_update.py b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_update.py index 3baf46ac1950..94e94309b10d 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_update.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/distributed_availability_groups_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsUpdate.json +# x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy.py b/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy.py index 354c103f13e9..97c24c1ad254 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.sql import SqlManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,8 +21,6 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = SqlManagementClient( credential=DefaultAzureCredential(), @@ -31,15 +28,15 @@ def main(): ) response = client.managed_backup_short_term_retention_policies.begin_update( - resource_group_name="resourceGroup", - managed_instance_name="testsvr", - database_name="testdb", - policy_name="default", - parameters={"properties": {"retentionDays": 14}}, + resource_group_name='resourceGroup', + managed_instance_name='testsvr', + database_name='testdb', + policy_name='default', + parameters={'properties': {'retentionDays': 14}}, ).result() print(response) - # x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json if __name__ == "__main__": main() + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy_restorable_dropped.py b/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy_restorable_dropped.py index e1ff6aea4e76..540bcea13e47 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy_restorable_dropped.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/update_managed_short_term_retention_policy_restorable_dropped.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.sql import SqlManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,8 +21,6 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = SqlManagementClient( credential=DefaultAzureCredential(), @@ -31,15 +28,15 @@ def main(): ) response = client.managed_restorable_dropped_database_backup_short_term_retention_policies.begin_update( - resource_group_name="resourceGroup", - managed_instance_name="testsvr", - restorable_dropped_database_id="testdb,131403269876900000", - policy_name="default", - parameters={"properties": {"retentionDays": 14}}, + resource_group_name='resourceGroup', + managed_instance_name='testsvr', + restorable_dropped_database_id='testdb,131403269876900000', + policy_name='default', + parameters={'properties': {'retentionDays': 14}}, ).result() print(response) - # x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json if __name__ == "__main__": main() + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_samples/update_short_term_retention_policy.py b/sdk/sql/azure-mgmt-sql/generated_samples/update_short_term_retention_policy.py index 4b6a803bdf9b..81c97fe71a54 100644 --- a/sdk/sql/azure-mgmt-sql/generated_samples/update_short_term_retention_policy.py +++ b/sdk/sql/azure-mgmt-sql/generated_samples/update_short_term_retention_policy.py @@ -9,7 +9,6 @@ from azure.identity import DefaultAzureCredential from azure.mgmt.sql import SqlManagementClient - """ # PREREQUISITES pip install azure-identity @@ -22,8 +21,6 @@ AZURE_CLIENT_SECRET. For more info about how to get the value, please see: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal """ - - def main(): client = SqlManagementClient( credential=DefaultAzureCredential(), @@ -31,15 +28,15 @@ def main(): ) response = client.backup_short_term_retention_policies.begin_update( - resource_group_name="resourceGroup", - server_name="testsvr", - database_name="testdb", - policy_name="default", - parameters={"properties": {"diffBackupIntervalInHours": 24, "retentionDays": 7}}, + resource_group_name='resourceGroup', + server_name='testsvr', + database_name='testdb', + policy_name='default', + parameters={'properties': {'diffBackupIntervalInHours': 24, 'retentionDays': 7}}, ).result() print(response) - # x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json if __name__ == "__main__": main() + main() diff --git a/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations.py b/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations.py index 5e35f4e8872e..ee1b19863442 100644 --- a/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations.py +++ b/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations.py @@ -24,7 +24,7 @@ def test_list_by_instance(self, resource_group): response = self.client.distributed_availability_groups.list_by_instance( resource_group_name=resource_group.name, managed_instance_name="str", - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, managed_instance_name="str", distributed_availability_group_name="str", - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) # please add some check logic here by yourself @@ -51,46 +51,21 @@ def test_begin_create_or_update(self, resource_group): managed_instance_name="str", distributed_availability_group_name="str", parameters={ - "databases": [ - { - "connectedState": "str", - "databaseName": "str", - "instanceRedoReplicationLagSeconds": 0, - "instanceReplicaId": "str", - "instanceSendReplicationLagSeconds": 0, - "lastBackupLsn": "str", - "lastBackupTime": "2020-02-20 00:00:00", - "lastCommitLsn": "str", - "lastCommitTime": "2020-02-20 00:00:00", - "lastHardenedLsn": "str", - "lastHardenedTime": "2020-02-20 00:00:00", - "lastReceivedLsn": "str", - "lastReceivedTime": "2020-02-20 00:00:00", - "lastSentLsn": "str", - "lastSentTime": "2020-02-20 00:00:00", - "mostRecentLinkError": "str", - "partnerAuthCertValidity": {"certificateName": "str", "expiryDate": "2020-02-20 00:00:00"}, - "partnerReplicaId": "str", - "replicaState": "str", - "seedingProgress": "str", - "synchronizationHealth": "str", - } - ], "distributedAvailabilityGroupId": "str", - "distributedAvailabilityGroupName": "str", - "failoverMode": "str", "id": "str", - "instanceAvailabilityGroupName": "str", - "instanceLinkRole": "str", + "lastHardenedLsn": "str", + "linkState": "str", "name": "str", - "partnerAvailabilityGroupName": "str", - "partnerEndpoint": "str", - "partnerLinkRole": "str", + "primaryAvailabilityGroupName": "str", "replicationMode": "str", - "seedingMode": "str", + "secondaryAvailabilityGroupName": "str", + "sourceEndpoint": "str", + "sourceReplicaId": "str", + "targetDatabase": "str", + "targetReplicaId": "str", "type": "str", }, - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -103,7 +78,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, managed_instance_name="str", distributed_availability_group_name="str", - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -117,74 +92,21 @@ def test_begin_update(self, resource_group): managed_instance_name="str", distributed_availability_group_name="str", parameters={ - "databases": [ - { - "connectedState": "str", - "databaseName": "str", - "instanceRedoReplicationLagSeconds": 0, - "instanceReplicaId": "str", - "instanceSendReplicationLagSeconds": 0, - "lastBackupLsn": "str", - "lastBackupTime": "2020-02-20 00:00:00", - "lastCommitLsn": "str", - "lastCommitTime": "2020-02-20 00:00:00", - "lastHardenedLsn": "str", - "lastHardenedTime": "2020-02-20 00:00:00", - "lastReceivedLsn": "str", - "lastReceivedTime": "2020-02-20 00:00:00", - "lastSentLsn": "str", - "lastSentTime": "2020-02-20 00:00:00", - "mostRecentLinkError": "str", - "partnerAuthCertValidity": {"certificateName": "str", "expiryDate": "2020-02-20 00:00:00"}, - "partnerReplicaId": "str", - "replicaState": "str", - "seedingProgress": "str", - "synchronizationHealth": "str", - } - ], "distributedAvailabilityGroupId": "str", - "distributedAvailabilityGroupName": "str", - "failoverMode": "str", "id": "str", - "instanceAvailabilityGroupName": "str", - "instanceLinkRole": "str", + "lastHardenedLsn": "str", + "linkState": "str", "name": "str", - "partnerAvailabilityGroupName": "str", - "partnerEndpoint": "str", - "partnerLinkRole": "str", + "primaryAvailabilityGroupName": "str", "replicationMode": "str", - "seedingMode": "str", + "secondaryAvailabilityGroupName": "str", + "sourceEndpoint": "str", + "sourceReplicaId": "str", + "targetDatabase": "str", + "targetReplicaId": "str", "type": "str", }, - api_version="2023-08-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_failover(self, resource_group): - response = self.client.distributed_availability_groups.begin_failover( - resource_group_name=resource_group.name, - managed_instance_name="str", - distributed_availability_group_name="str", - parameters={"failoverType": "str"}, - api_version="2023-08-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_set_role(self, resource_group): - response = self.client.distributed_availability_groups.begin_set_role( - resource_group_name=resource_group.name, - managed_instance_name="str", - distributed_availability_group_name="str", - parameters={"instanceRole": "str", "roleChangeType": "str"}, - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations_async.py b/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations_async.py index 9429711cf38e..f6a075746429 100644 --- a/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations_async.py +++ b/sdk/sql/azure-mgmt-sql/generated_tests/test_sql_management_distributed_availability_groups_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_instance(self, resource_group): response = self.client.distributed_availability_groups.list_by_instance( resource_group_name=resource_group.name, managed_instance_name="str", - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, managed_instance_name="str", distributed_availability_group_name="str", - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) # please add some check logic here by yourself @@ -53,46 +53,21 @@ async def test_begin_create_or_update(self, resource_group): managed_instance_name="str", distributed_availability_group_name="str", parameters={ - "databases": [ - { - "connectedState": "str", - "databaseName": "str", - "instanceRedoReplicationLagSeconds": 0, - "instanceReplicaId": "str", - "instanceSendReplicationLagSeconds": 0, - "lastBackupLsn": "str", - "lastBackupTime": "2020-02-20 00:00:00", - "lastCommitLsn": "str", - "lastCommitTime": "2020-02-20 00:00:00", - "lastHardenedLsn": "str", - "lastHardenedTime": "2020-02-20 00:00:00", - "lastReceivedLsn": "str", - "lastReceivedTime": "2020-02-20 00:00:00", - "lastSentLsn": "str", - "lastSentTime": "2020-02-20 00:00:00", - "mostRecentLinkError": "str", - "partnerAuthCertValidity": {"certificateName": "str", "expiryDate": "2020-02-20 00:00:00"}, - "partnerReplicaId": "str", - "replicaState": "str", - "seedingProgress": "str", - "synchronizationHealth": "str", - } - ], "distributedAvailabilityGroupId": "str", - "distributedAvailabilityGroupName": "str", - "failoverMode": "str", "id": "str", - "instanceAvailabilityGroupName": "str", - "instanceLinkRole": "str", + "lastHardenedLsn": "str", + "linkState": "str", "name": "str", - "partnerAvailabilityGroupName": "str", - "partnerEndpoint": "str", - "partnerLinkRole": "str", + "primaryAvailabilityGroupName": "str", "replicationMode": "str", - "seedingMode": "str", + "secondaryAvailabilityGroupName": "str", + "sourceEndpoint": "str", + "sourceReplicaId": "str", + "targetDatabase": "str", + "targetReplicaId": "str", "type": "str", }, - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -107,7 +82,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, managed_instance_name="str", distributed_availability_group_name="str", - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -123,78 +98,21 @@ async def test_begin_update(self, resource_group): managed_instance_name="str", distributed_availability_group_name="str", parameters={ - "databases": [ - { - "connectedState": "str", - "databaseName": "str", - "instanceRedoReplicationLagSeconds": 0, - "instanceReplicaId": "str", - "instanceSendReplicationLagSeconds": 0, - "lastBackupLsn": "str", - "lastBackupTime": "2020-02-20 00:00:00", - "lastCommitLsn": "str", - "lastCommitTime": "2020-02-20 00:00:00", - "lastHardenedLsn": "str", - "lastHardenedTime": "2020-02-20 00:00:00", - "lastReceivedLsn": "str", - "lastReceivedTime": "2020-02-20 00:00:00", - "lastSentLsn": "str", - "lastSentTime": "2020-02-20 00:00:00", - "mostRecentLinkError": "str", - "partnerAuthCertValidity": {"certificateName": "str", "expiryDate": "2020-02-20 00:00:00"}, - "partnerReplicaId": "str", - "replicaState": "str", - "seedingProgress": "str", - "synchronizationHealth": "str", - } - ], "distributedAvailabilityGroupId": "str", - "distributedAvailabilityGroupName": "str", - "failoverMode": "str", "id": "str", - "instanceAvailabilityGroupName": "str", - "instanceLinkRole": "str", + "lastHardenedLsn": "str", + "linkState": "str", "name": "str", - "partnerAvailabilityGroupName": "str", - "partnerEndpoint": "str", - "partnerLinkRole": "str", + "primaryAvailabilityGroupName": "str", "replicationMode": "str", - "seedingMode": "str", + "secondaryAvailabilityGroupName": "str", + "sourceEndpoint": "str", + "sourceReplicaId": "str", + "targetDatabase": "str", + "targetReplicaId": "str", "type": "str", }, - api_version="2023-08-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_failover(self, resource_group): - response = await ( - await self.client.distributed_availability_groups.begin_failover( - resource_group_name=resource_group.name, - managed_instance_name="str", - distributed_availability_group_name="str", - parameters={"failoverType": "str"}, - api_version="2023-08-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_set_role(self, resource_group): - response = await ( - await self.client.distributed_availability_groups.begin_set_role( - resource_group_name=resource_group.name, - managed_instance_name="str", - distributed_availability_group_name="str", - parameters={"instanceRole": "str", "roleChangeType": "str"}, - api_version="2023-08-01-preview", + api_version="2021-11-01-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/sql/azure-mgmt-sql/setup.py b/sdk/sql/azure-mgmt-sql/setup.py index 689f782aa52a..121407266bf9 100644 --- a/sdk/sql/azure-mgmt-sql/setup.py +++ b/sdk/sql/azure-mgmt-sql/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' 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") - ), + 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)