diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json index f285b3b3d35a..4f8da15647e4 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json @@ -1,11 +1,11 @@ { - "commit": "be6cd9ccfcb6ba08c1c206627026eabfbff31fc1", + "commit": "5be6df67b616e1cade6cb7a2087c80dc266223c0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.0", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/azurearcdata/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/azurearcdata/resource-manager/readme.md --generate-sample=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.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/azurearcdata/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py index 2968503221e6..7f130c3c8996 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py @@ -18,9 +18,11 @@ from .operations import ( ActiveDirectoryConnectorsOperations, DataControllersOperations, + FailoverGroupsOperations, Operations, PostgresInstancesOperations, SqlManagedInstancesOperations, + SqlServerDatabasesOperations, SqlServerInstancesOperations, ) @@ -29,7 +31,7 @@ from azure.core.credentials import TokenCredential -class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-version-keyword +class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. @@ -38,6 +40,8 @@ class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-versio :ivar sql_managed_instances: SqlManagedInstancesOperations operations :vartype sql_managed_instances: azure.mgmt.azurearcdata.operations.SqlManagedInstancesOperations + :ivar failover_groups: FailoverGroupsOperations operations + :vartype failover_groups: azure.mgmt.azurearcdata.operations.FailoverGroupsOperations :ivar sql_server_instances: SqlServerInstancesOperations operations :vartype sql_server_instances: azure.mgmt.azurearcdata.operations.SqlServerInstancesOperations :ivar data_controllers: DataControllersOperations operations @@ -47,13 +51,15 @@ class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-versio azure.mgmt.azurearcdata.operations.ActiveDirectoryConnectorsOperations :ivar postgres_instances: PostgresInstancesOperations operations :vartype postgres_instances: azure.mgmt.azurearcdata.operations.PostgresInstancesOperations + :ivar sql_server_databases: SqlServerDatabasesOperations operations + :vartype sql_server_databases: azure.mgmt.azurearcdata.operations.SqlServerDatabasesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the Azure subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -80,6 +86,7 @@ def __init__( self.sql_managed_instances = SqlManagedInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.failover_groups = FailoverGroupsOperations(self._client, self._config, self._serialize, self._deserialize) self.sql_server_instances = SqlServerInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -92,6 +99,9 @@ def __init__( self.postgres_instances = PostgresInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.sql_server_databases = SqlServerDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -122,5 +132,5 @@ def __enter__(self) -> "AzureArcDataManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py index d50ca5314a38..085ef0498f60 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py @@ -35,14 +35,14 @@ class AzureArcDataManagementClientConfiguration(Configuration): # pylint: disab :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the Azure subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AzureArcDataManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop("api_version", "2023-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_serialization.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_serialization.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py index e32dc6ec4218..6f230afed6d7 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.1.1b1" diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py index 36f94989212b..2fe4bb6c10b6 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py @@ -18,9 +18,11 @@ from .operations import ( ActiveDirectoryConnectorsOperations, DataControllersOperations, + FailoverGroupsOperations, Operations, PostgresInstancesOperations, SqlManagedInstancesOperations, + SqlServerDatabasesOperations, SqlServerInstancesOperations, ) @@ -29,7 +31,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-version-keyword +class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. @@ -38,6 +40,8 @@ class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-versio :ivar sql_managed_instances: SqlManagedInstancesOperations operations :vartype sql_managed_instances: azure.mgmt.azurearcdata.aio.operations.SqlManagedInstancesOperations + :ivar failover_groups: FailoverGroupsOperations operations + :vartype failover_groups: azure.mgmt.azurearcdata.aio.operations.FailoverGroupsOperations :ivar sql_server_instances: SqlServerInstancesOperations operations :vartype sql_server_instances: azure.mgmt.azurearcdata.aio.operations.SqlServerInstancesOperations @@ -48,13 +52,16 @@ class AzureArcDataManagementClient: # pylint: disable=client-accepts-api-versio azure.mgmt.azurearcdata.aio.operations.ActiveDirectoryConnectorsOperations :ivar postgres_instances: PostgresInstancesOperations operations :vartype postgres_instances: azure.mgmt.azurearcdata.aio.operations.PostgresInstancesOperations + :ivar sql_server_databases: SqlServerDatabasesOperations operations + :vartype sql_server_databases: + azure.mgmt.azurearcdata.aio.operations.SqlServerDatabasesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the Azure subscription. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -81,6 +88,7 @@ def __init__( self.sql_managed_instances = SqlManagedInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.failover_groups = FailoverGroupsOperations(self._client, self._config, self._serialize, self._deserialize) self.sql_server_instances = SqlServerInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -93,6 +101,9 @@ def __init__( self.postgres_instances = PostgresInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.sql_server_databases = SqlServerDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -123,5 +134,5 @@ async def __aenter__(self) -> "AzureArcDataManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py index 5d04c84f178a..acd2fafc273c 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py @@ -35,14 +35,14 @@ class AzureArcDataManagementClientConfiguration(Configuration): # pylint: disab :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the Azure subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-01-15-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AzureArcDataManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-03-01-preview"] = kwargs.pop("api_version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop("api_version", "2023-01-15-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py index 86245dd95097..da476c846a5c 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py @@ -8,10 +8,12 @@ from ._operations import Operations from ._sql_managed_instances_operations import SqlManagedInstancesOperations +from ._failover_groups_operations import FailoverGroupsOperations from ._sql_server_instances_operations import SqlServerInstancesOperations from ._data_controllers_operations import DataControllersOperations from ._active_directory_connectors_operations import ActiveDirectoryConnectorsOperations from ._postgres_instances_operations import PostgresInstancesOperations +from ._sql_server_databases_operations import SqlServerDatabasesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -20,10 +22,12 @@ __all__ = [ "Operations", "SqlManagedInstancesOperations", + "FailoverGroupsOperations", "SqlServerInstancesOperations", "DataControllersOperations", "ActiveDirectoryConnectorsOperations", "PostgresInstancesOperations", + "SqlServerDatabasesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py index 0572c8d99806..d897336acc0f 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py @@ -87,7 +87,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ActiveDirectoryConnectorListResult] = kwargs.pop("cls", None) @@ -180,7 +180,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -335,8 +335,8 @@ async def begin_create( :param active_directory_connector_name: The name of the Active Directory connector instance. Required. :type active_directory_connector_name: str - :param active_directory_connector_resource: desc. Is either a model type or a IO type. - Required. + :param active_directory_connector_resource: desc. Is either a ActiveDirectoryConnectorResource + type or a IO type. Required. :type active_directory_connector_resource: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -359,7 +359,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -424,7 +424,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -488,7 +488,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -560,7 +560,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py index 15667f01a721..1a4cca1b7928 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py @@ -83,7 +83,7 @@ def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DataCont _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) @@ -173,7 +173,7 @@ def list_in_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterabl _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) @@ -264,7 +264,7 @@ async def _put_data_controller_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -405,7 +405,8 @@ async def begin_put_data_controller( :type resource_group_name: str :param data_controller_name: The name of the data controller. Required. :type data_controller_name: str - :param data_controller_resource: desc. Is either a model type or a IO type. Required. + :param data_controller_resource: desc. Is either a DataControllerResource type or a IO type. + Required. :type data_controller_resource: ~azure.mgmt.azurearcdata.models.DataControllerResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -427,7 +428,7 @@ async def begin_put_data_controller( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -491,7 +492,7 @@ async def _delete_data_controller_initial( # pylint: disable=inconsistent-retur _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -551,7 +552,7 @@ async def begin_delete_data_controller( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -619,7 +620,7 @@ async def get_data_controller( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataControllerResource] = kwargs.pop("cls", None) @@ -676,7 +677,7 @@ async def _patch_data_controller_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -815,8 +816,8 @@ async def begin_patch_data_controller( :type resource_group_name: str :param data_controller_name: The name of the data controller. Required. :type data_controller_name: str - :param data_controller_resource: The update data controller resource. Is either a model type or - a IO type. Required. + :param data_controller_resource: The update data controller resource. Is either a + DataControllerUpdate type or a IO type. Required. :type data_controller_resource: ~azure.mgmt.azurearcdata.models.DataControllerUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -838,7 +839,7 @@ async def begin_patch_data_controller( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_failover_groups_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_failover_groups_operations.py new file mode 100644 index 000000000000..1fc970b6932e --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_failover_groups_operations.py @@ -0,0 +1,594 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._failover_groups_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FailoverGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurearcdata.aio.AzureArcDataManagementClient`'s + :attr:`failover_groups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, sql_managed_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FailoverGroupResource"]: + """List the failover groups associated with the given sql managed instance. + + List the failover groups associated with the given sql managed instance. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FailoverGroupResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FailoverGroupListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FailoverGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + 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) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups" + } + + async def _create_initial( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: Union[_models.FailoverGroupResource, IO], + **kwargs: Any + ) -> _models.FailoverGroupResource: + error_map = { + 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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FailoverGroupResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_group_resource, (IO, bytes)): + _content = failover_group_resource + else: + _json = self._serialize.body(failover_group_resource, "FailoverGroupResource") + + request = build_create_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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) + + if response.status_code == 200: + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + @overload + async def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: _models.FailoverGroupResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FailoverGroupResource]: + """Creates or replaces a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :param failover_group_resource: desc. Required. + :type failover_group_resource: ~azure.mgmt.azurearcdata.models.FailoverGroupResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FailoverGroupResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FailoverGroupResource]: + """Creates or replaces a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :param failover_group_resource: desc. Required. + :type failover_group_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FailoverGroupResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: Union[_models.FailoverGroupResource, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.FailoverGroupResource]: + """Creates or replaces a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :param failover_group_resource: desc. Is either a FailoverGroupResource type or a IO type. + Required. + :type failover_group_resource: ~azure.mgmt.azurearcdata.models.FailoverGroupResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FailoverGroupResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FailoverGroupResource] = 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._create_initial( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + failover_group_resource=failover_group_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sql_managed_instance_name: str, failover_group_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, sql_managed_instance_name: str, failover_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + 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) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, sql_managed_instance_name: str, failover_group_name: str, **kwargs: Any + ) -> _models.FailoverGroupResource: + """Retrieves a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FailoverGroupResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.FailoverGroupResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FailoverGroupResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py index 8fe91a4c361c..b4b73fc41efe 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py index a344352c7389..0ae12f663f9c 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py @@ -82,7 +82,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.PostgresInstance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) @@ -171,7 +171,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) @@ -270,7 +270,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PostgresInstance] = kwargs.pop("cls", None) @@ -327,7 +327,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -466,7 +466,8 @@ async def begin_create( :type resource_group_name: str :param postgres_instance_name: Name of Postgres Instance. Required. :type postgres_instance_name: str - :param resource: The postgres instance. Is either a model type or a IO type. Required. + :param resource: The postgres instance. Is either a PostgresInstance type or a IO type. + Required. :type resource: ~azure.mgmt.azurearcdata.models.PostgresInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -487,7 +488,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -551,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -611,7 +612,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -721,7 +722,8 @@ async def update( :type resource_group_name: str :param postgres_instance_name: Name of Postgres Instance. Required. :type postgres_instance_name: str - :param parameters: The Postgres Instance. Is either a model type or a IO type. Required. + :param parameters: The Postgres Instance. Is either a PostgresInstanceUpdate type or a IO type. + Required. :type parameters: ~azure.mgmt.azurearcdata.models.PostgresInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -742,7 +744,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py index 929405aa8d10..280fd3cd4ffe 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py @@ -82,7 +82,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SqlManagedInstance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) @@ -171,7 +171,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) @@ -270,7 +270,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlManagedInstance] = kwargs.pop("cls", None) @@ -327,7 +327,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -467,7 +467,7 @@ async def begin_create( :param sql_managed_instance_name: Name of SQL Managed Instance. Required. :type sql_managed_instance_name: str :param sql_managed_instance: The SQL Managed Instance to be created or updated. Is either a - model type or a IO type. Required. + SqlManagedInstance type or a IO type. Required. :type sql_managed_instance: ~azure.mgmt.azurearcdata.models.SqlManagedInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -488,7 +488,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -552,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -612,7 +612,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -722,7 +722,8 @@ async def update( :type resource_group_name: str :param sql_managed_instance_name: Name of SQL Managed Instance. Required. :type sql_managed_instance_name: str - :param parameters: The SQL Managed Instance. Is either a model type or a IO type. Required. + :param parameters: The SQL Managed Instance. Is either a SqlManagedInstanceUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -743,7 +744,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_databases_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_databases_operations.py new file mode 100644 index 000000000000..d66e5213a646 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_databases_operations.py @@ -0,0 +1,596 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sql_server_databases_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SqlServerDatabasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurearcdata.aio.AzureArcDataManagementClient`'s + :attr:`sql_server_databases` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def create( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_resource: _models.SqlServerDatabaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Creates or replaces an Arc Sql Server Database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_resource: The request body for database resource. Required. + :type sql_server_database_resource: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Creates or replaces an Arc Sql Server Database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_resource: The request body for database resource. Required. + :type sql_server_database_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_resource: Union[_models.SqlServerDatabaseResource, IO], + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Creates or replaces an Arc Sql Server Database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_resource: The request body for database resource. Is either a + SqlServerDatabaseResource type or a IO type. Required. + :type sql_server_database_resource: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlServerDatabaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sql_server_database_resource, (IO, bytes)): + _content = sql_server_database_resource + else: + _json = self._serialize.body(sql_server_database_resource, "SqlServerDatabaseResource") + + request = build_create_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("SqlServerDatabaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sql_server_instance_name: str, database_name: str, **kwargs: Any + ) -> None: + """Deletes an Arc Sql Server database resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, sql_server_instance_name: str, database_name: str, **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Retrieves an Arc Sql Server database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SqlServerDatabaseResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("SqlServerDatabaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @overload + async def update( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_update: _models.SqlServerDatabaseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Updates an existing database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_update: The requested database resource state. Required. + :type sql_server_database_update: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_update: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Updates an existing database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_update: The requested database resource state. Required. + :type sql_server_database_update: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_update: Union[_models.SqlServerDatabaseUpdate, IO], + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Updates an existing database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_update: The requested database resource state. Is either a + SqlServerDatabaseUpdate type or a IO type. Required. + :type sql_server_database_update: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlServerDatabaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sql_server_database_update, (IO, bytes)): + _content = sql_server_database_update + else: + _json = self._serialize.body(sql_server_database_update, "SqlServerDatabaseUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("SqlServerDatabaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sql_server_instance_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SqlServerDatabaseResource"]: + """List the databases associated with the given Arc Sql Server. + + List the databases associated with the given Arc Sql Server. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlServerDatabaseResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ArcSqlServerDatabaseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ArcSqlServerDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + 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) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases" + } diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py index 34c79c8c6cd8..843a4b2784a0 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py @@ -82,7 +82,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.SqlServerInstance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) @@ -171,7 +171,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) @@ -270,7 +270,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlServerInstance] = kwargs.pop("cls", None) @@ -327,7 +327,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -466,8 +466,8 @@ async def begin_create( :type resource_group_name: str :param sql_server_instance_name: Name of SQL Server Instance. Required. :type sql_server_instance_name: str - :param sql_server_instance: The SQL Server Instance to be created or updated. Is either a model - type or a IO type. Required. + :param sql_server_instance: The SQL Server Instance to be created or updated. Is either a + SqlServerInstance type or a IO type. Required. :type sql_server_instance: ~azure.mgmt.azurearcdata.models.SqlServerInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -488,7 +488,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -552,7 +552,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -612,7 +612,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -722,7 +722,8 @@ async def update( :type resource_group_name: str :param sql_server_instance_name: Name of SQL Server Instance. Required. :type sql_server_instance_name: str - :param parameters: The SQL Server Instance. Is either a model type or a IO type. Required. + :param parameters: The SQL Server Instance. Is either a SqlServerInstanceUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.azurearcdata.models.SqlServerInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -743,7 +744,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py index 1b63e4fb2b7e..2efede4819ba 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import AGReplicas from ._models_py3 import ActiveDirectoryConnectorDNSDetails from ._models_py3 import ActiveDirectoryConnectorDomainDetails from ._models_py3 import ActiveDirectoryConnectorListResult @@ -16,6 +17,7 @@ from ._models_py3 import ActiveDirectoryDomainController from ._models_py3 import ActiveDirectoryDomainControllers from ._models_py3 import ActiveDirectoryInformation +from ._models_py3 import ArcSqlServerDatabaseListResult from ._models_py3 import BasicLoginInformation from ._models_py3 import CommonSku from ._models_py3 import DataControllerProperties @@ -24,6 +26,11 @@ from ._models_py3 import ErrorResponse from ._models_py3 import ErrorResponseBody from ._models_py3 import ExtendedLocation +from ._models_py3 import FailoverGroupListResult +from ._models_py3 import FailoverGroupProperties +from ._models_py3 import FailoverGroupResource +from ._models_py3 import FailoverGroupSpec +from ._models_py3 import FailoverGroupStatus from ._models_py3 import K8SResourceRequirements from ._models_py3 import K8SScheduling from ._models_py3 import K8SSchedulingOptions @@ -48,6 +55,11 @@ from ._models_py3 import SqlManagedInstanceProperties from ._models_py3 import SqlManagedInstanceSku from ._models_py3 import SqlManagedInstanceUpdate +from ._models_py3 import SqlServerDatabaseResource +from ._models_py3 import SqlServerDatabaseResourceProperties +from ._models_py3 import SqlServerDatabaseResourcePropertiesBackupInformation +from ._models_py3 import SqlServerDatabaseResourcePropertiesDatabaseOptions +from ._models_py3 import SqlServerDatabaseUpdate from ._models_py3 import SqlServerInstance from ._models_py3 import SqlServerInstanceListResult from ._models_py3 import SqlServerInstanceProperties @@ -62,19 +74,26 @@ from ._azure_arc_data_management_client_enums import ArcSqlServerLicenseType from ._azure_arc_data_management_client_enums import ConnectionStatus from ._azure_arc_data_management_client_enums import CreatedByType +from ._azure_arc_data_management_client_enums import DatabaseState from ._azure_arc_data_management_client_enums import DefenderStatus from ._azure_arc_data_management_client_enums import EditionType from ._azure_arc_data_management_client_enums import ExtendedLocationTypes +from ._azure_arc_data_management_client_enums import FailoverGroupPartnerSyncMode from ._azure_arc_data_management_client_enums import HostType from ._azure_arc_data_management_client_enums import Infrastructure +from ._azure_arc_data_management_client_enums import InstanceFailoverGroupRole from ._azure_arc_data_management_client_enums import OperationOrigin +from ._azure_arc_data_management_client_enums import ProvisioningState +from ._azure_arc_data_management_client_enums import RecoveryMode from ._azure_arc_data_management_client_enums import SqlManagedInstanceSkuTier from ._azure_arc_data_management_client_enums import SqlVersion +from ._azure_arc_data_management_client_enums import State from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AGReplicas", "ActiveDirectoryConnectorDNSDetails", "ActiveDirectoryConnectorDomainDetails", "ActiveDirectoryConnectorListResult", @@ -85,6 +104,7 @@ "ActiveDirectoryDomainController", "ActiveDirectoryDomainControllers", "ActiveDirectoryInformation", + "ArcSqlServerDatabaseListResult", "BasicLoginInformation", "CommonSku", "DataControllerProperties", @@ -93,6 +113,11 @@ "ErrorResponse", "ErrorResponseBody", "ExtendedLocation", + "FailoverGroupListResult", + "FailoverGroupProperties", + "FailoverGroupResource", + "FailoverGroupSpec", + "FailoverGroupStatus", "K8SResourceRequirements", "K8SScheduling", "K8SSchedulingOptions", @@ -117,6 +142,11 @@ "SqlManagedInstanceProperties", "SqlManagedInstanceSku", "SqlManagedInstanceUpdate", + "SqlServerDatabaseResource", + "SqlServerDatabaseResourceProperties", + "SqlServerDatabaseResourcePropertiesBackupInformation", + "SqlServerDatabaseResourcePropertiesDatabaseOptions", + "SqlServerDatabaseUpdate", "SqlServerInstance", "SqlServerInstanceListResult", "SqlServerInstanceProperties", @@ -130,14 +160,20 @@ "ArcSqlServerLicenseType", "ConnectionStatus", "CreatedByType", + "DatabaseState", "DefenderStatus", "EditionType", "ExtendedLocationTypes", + "FailoverGroupPartnerSyncMode", "HostType", "Infrastructure", + "InstanceFailoverGroupRole", "OperationOrigin", + "ProvisioningState", + "RecoveryMode", "SqlManagedInstanceSkuTier", "SqlVersion", + "State", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py index 8133d9dc267d..c64afb38b7ef 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py @@ -55,6 +55,20 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class DatabaseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the database.""" + + ONLINE = "Online" + RESTORING = "Restoring" + RECOVERING = "Recovering" + RECOVERY_PENDING = "RecoveryPending" + SUSPECT = "Suspect" + EMERGENCY = "Emergency" + OFFLINE = "Offline" + COPYING = "Copying" + OFFLINE_SECONDARY = "OfflineSecondary" + + class DefenderStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of Azure Defender.""" @@ -72,6 +86,7 @@ class EditionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): WEB = "Web" DEVELOPER = "Developer" EXPRESS = "Express" + BUSINESS_INTELLIGENCE = "Business Intelligence" class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -80,6 +95,13 @@ class ExtendedLocationTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): CUSTOM_LOCATION = "CustomLocation" +class FailoverGroupPartnerSyncMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The partner sync mode of the SQL managed instance.""" + + ASYNC = "async" + SYNC = "sync" + + class HostType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of host for Azure Arc SQL Server.""" @@ -109,6 +131,15 @@ class Infrastructure(str, Enum, metaclass=CaseInsensitiveEnumMeta): OTHER = "other" +class InstanceFailoverGroupRole(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The role of the SQL managed instance in this failover group.""" + + PRIMARY = "primary" + SECONDARY = "secondary" + FORCE_PRIMARY_ALLOW_DATA_LOSS = "force-primary-allow-data-loss" + FORCE_SECONDARY = "force-secondary" + + class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The intended executor of the operation.""" @@ -116,6 +147,23 @@ class OperationOrigin(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM = "system" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the failover group resource.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + ACCEPTED = "Accepted" + + +class RecoveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the database.""" + + FULL = "Full" + BULK_LOGGED = "Bulk-logged" + SIMPLE = "Simple" + + class SqlManagedInstanceSkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The pricing tier for the instance.""" @@ -133,3 +181,11 @@ class SqlVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): SQL_SERVER2019 = "SQL Server 2019" SQL_SERVER2022 = "SQL Server 2022" UNKNOWN = "Unknown" + + +class State(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The state of the failover group custom resource.""" + + WAITING = "Waiting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py index 6b59ffc45dca..67ab371c7fbd 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py @@ -63,8 +63,8 @@ def __init__( domain_name: Optional[str] = None, replicas: int = 1, prefer_k8_s_dns_for_ptr_lookups: bool = True, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain_name: DNS domain name for which DNS lookups should be forwarded to the Active Directory DNS servers. @@ -101,13 +101,12 @@ class ActiveDirectoryConnectorDomainDetails(_serialization.Model): :ivar ou_distinguished_name: The distinguished name of the Active Directory Organizational Unit. :vartype ou_distinguished_name: str - :ivar domain_controllers: null. Required. + :ivar domain_controllers: null. :vartype domain_controllers: ~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainControllers """ _validation = { "realm": {"required": True}, - "domain_controllers": {"required": True}, } _attribute_map = { @@ -122,12 +121,12 @@ def __init__( self, *, realm: str, - domain_controllers: "_models.ActiveDirectoryDomainControllers", netbios_domain_name: Optional[str] = None, service_account_provisioning: Union[str, "_models.AccountProvisioningMode"] = "manual", ou_distinguished_name: Optional[str] = None, - **kwargs - ): + domain_controllers: Optional["_models.ActiveDirectoryDomainControllers"] = None, + **kwargs: Any + ) -> None: """ :keyword realm: Name (uppercase) of the Active Directory domain that this AD connector will be associated with. Required. @@ -141,7 +140,7 @@ def __init__( :keyword ou_distinguished_name: The distinguished name of the Active Directory Organizational Unit. :paramtype ou_distinguished_name: str - :keyword domain_controllers: null. Required. + :keyword domain_controllers: null. :paramtype domain_controllers: ~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainControllers """ super().__init__(**kwargs) @@ -173,7 +172,7 @@ class ActiveDirectoryConnectorListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -220,8 +219,8 @@ def __init__( spec: "_models.ActiveDirectoryConnectorSpec", domain_service_account_login_information: Optional["_models.BasicLoginInformation"] = None, status: Optional["_models.ActiveDirectoryConnectorStatus"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain_service_account_login_information: Username and password for domain service account authentication. @@ -271,7 +270,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -281,7 +280,8 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -312,7 +312,7 @@ class ProxyResource(Resource): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -355,7 +355,7 @@ class ActiveDirectoryConnectorResource(ProxyResource): "properties": {"key": "properties", "type": "ActiveDirectoryConnectorProperties"}, } - def __init__(self, *, properties: "_models.ActiveDirectoryConnectorProperties", **kwargs): + def __init__(self, *, properties: "_models.ActiveDirectoryConnectorProperties", **kwargs: Any) -> None: """ :keyword properties: null. Required. :paramtype properties: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorProperties @@ -391,8 +391,8 @@ def __init__( *, active_directory: "_models.ActiveDirectoryConnectorDomainDetails", dns: "_models.ActiveDirectoryConnectorDNSDetails", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword active_directory: null. Required. :paramtype active_directory: @@ -434,8 +434,8 @@ def __init__( last_update_time: Optional[str] = None, observed_generation: Optional[int] = None, state: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -472,7 +472,7 @@ class ActiveDirectoryDomainController(_serialization.Model): "hostname": {"key": "hostname", "type": "str"}, } - def __init__(self, *, hostname: str, **kwargs): + def __init__(self, *, hostname: str, **kwargs: Any) -> None: """ :keyword hostname: Fully-qualified domain name of a domain controller in the AD domain. Required. @@ -483,7 +483,8 @@ def __init__(self, *, hostname: str, **kwargs): class ActiveDirectoryDomainControllers(_serialization.Model): - """Details about the Active Directory domain controllers associated with this AD connector instance. + """Details about the Active Directory domain controllers associated with this AD connector + instance. :ivar primary_domain_controller: Information about the Primary Domain Controller (PDC) in the AD domain. @@ -507,8 +508,8 @@ def __init__( *, primary_domain_controller: Optional["_models.ActiveDirectoryDomainController"] = None, secondary_domain_controllers: Optional[List["_models.ActiveDirectoryDomainController"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_domain_controller: Information about the Primary Domain Controller (PDC) in the AD domain. @@ -535,7 +536,7 @@ class ActiveDirectoryInformation(_serialization.Model): "keytab_information": {"key": "keytabInformation", "type": "KeytabInformation"}, } - def __init__(self, *, keytab_information: Optional["_models.KeytabInformation"] = None, **kwargs): + def __init__(self, *, keytab_information: Optional["_models.KeytabInformation"] = None, **kwargs: Any) -> None: """ :keyword keytab_information: Keytab information that is used for the Sql Managed Instance when Active Directory authentication is used. @@ -545,6 +546,101 @@ def __init__(self, *, keytab_information: Optional["_models.KeytabInformation"] self.keytab_information = keytab_information +class AGReplicas(_serialization.Model): + """The information about each failover group replica. + + :ivar health_state: The health state of the replica. + :vartype health_state: str + :ivar replica_name: The replica name. + :vartype replica_name: str + :ivar role: The role of the replica. + :vartype role: str + :ivar connected_state: The connected state of the replica. + :vartype connected_state: str + :ivar synchronization_state: The synchronization state of the availability group replicas. + :vartype synchronization_state: str + :ivar availability_mode: The availability mode of the replica. + :vartype availability_mode: str + :ivar secondary_role_allow_connections: The secondary role allowed connections. + :vartype secondary_role_allow_connections: str + """ + + _attribute_map = { + "health_state": {"key": "healthState", "type": "str"}, + "replica_name": {"key": "replicaName", "type": "str"}, + "role": {"key": "role", "type": "str"}, + "connected_state": {"key": "connectedState", "type": "str"}, + "synchronization_state": {"key": "synchronizationState", "type": "str"}, + "availability_mode": {"key": "availabilityMode", "type": "str"}, + "secondary_role_allow_connections": {"key": "secondaryRoleAllowConnections", "type": "str"}, + } + + def __init__( + self, + *, + health_state: Optional[str] = None, + replica_name: Optional[str] = None, + role: Optional[str] = None, + connected_state: Optional[str] = None, + synchronization_state: Optional[str] = None, + availability_mode: Optional[str] = None, + secondary_role_allow_connections: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword health_state: The health state of the replica. + :paramtype health_state: str + :keyword replica_name: The replica name. + :paramtype replica_name: str + :keyword role: The role of the replica. + :paramtype role: str + :keyword connected_state: The connected state of the replica. + :paramtype connected_state: str + :keyword synchronization_state: The synchronization state of the availability group replicas. + :paramtype synchronization_state: str + :keyword availability_mode: The availability mode of the replica. + :paramtype availability_mode: str + :keyword secondary_role_allow_connections: The secondary role allowed connections. + :paramtype secondary_role_allow_connections: str + """ + super().__init__(**kwargs) + self.health_state = health_state + self.replica_name = replica_name + self.role = role + self.connected_state = connected_state + self.synchronization_state = synchronization_state + self.availability_mode = availability_mode + self.secondary_role_allow_connections = secondary_role_allow_connections + + +class ArcSqlServerDatabaseListResult(_serialization.Model): + """A list of Arc Sql Server database. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of Arc Sql Server database. + :vartype value: list[~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[SqlServerDatabaseResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + class BasicLoginInformation(_serialization.Model): """Username and password for basic login authentication. @@ -559,7 +655,7 @@ class BasicLoginInformation(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword username: Login username. :paramtype username: str @@ -612,8 +708,8 @@ def __init__( size: Optional[str] = None, family: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the SKU. It is typically a letter+number code. Required. :paramtype name: str @@ -715,8 +811,8 @@ def __init__( upload_service_principal: Optional["_models.UploadServicePrincipal"] = None, cluster_id: Optional[str] = None, extension_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword infrastructure: The infrastructure the data controller is running on. Known values are: "azure", "gcp", "aws", "alibaba", "onpremises", and "other". @@ -770,7 +866,8 @@ def __init__( class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. @@ -810,7 +907,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -877,8 +974,8 @@ def __init__( properties: "_models.DataControllerProperties", tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -913,8 +1010,8 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.DataControllerProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -937,7 +1034,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorResponseBody"}, } - def __init__(self, *, error: Optional["_models.ErrorResponseBody"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorResponseBody"] = None, **kwargs: Any) -> None: """ :keyword error: null. :paramtype error: ~azure.mgmt.azurearcdata.models.ErrorResponseBody @@ -976,8 +1073,8 @@ def __init__( message: Optional[str] = None, target: Optional[str] = None, details: Optional[List["_models.ErrorResponseBody"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. @@ -1017,8 +1114,8 @@ def __init__( *, name: Optional[str] = None, type: Optional[Union[str, "_models.ExtendedLocationTypes"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the extended location. :paramtype name: str @@ -1030,6 +1127,312 @@ def __init__( self.type = type +class FailoverGroupListResult(_serialization.Model): + """A list of failover groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of failover group results. + :vartype value: list[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[FailoverGroupResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class FailoverGroupProperties(_serialization.Model): + """The properties of a failover group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar provisioning_state: The provisioning state of the failover group resource. Known values + are: "Succeeded", "Failed", "Canceled", and "Accepted". + :vartype provisioning_state: str or ~azure.mgmt.azurearcdata.models.ProvisioningState + :ivar partner_managed_instance_id: The resource ID of the partner SQL managed instance. + Required. + :vartype partner_managed_instance_id: str + :ivar spec: The specifications of the failover group resource. Required. + :vartype spec: ~azure.mgmt.azurearcdata.models.FailoverGroupSpec + :ivar status: The status of the failover group custom resource. + :vartype status: ~azure.mgmt.azurearcdata.models.FailoverGroupStatus + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "partner_managed_instance_id": {"required": True}, + "spec": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "partner_managed_instance_id": {"key": "partnerManagedInstanceId", "type": "str"}, + "spec": {"key": "spec", "type": "FailoverGroupSpec"}, + "status": {"key": "status", "type": "FailoverGroupStatus"}, + } + + def __init__( + self, + *, + partner_managed_instance_id: str, + spec: "_models.FailoverGroupSpec", + additional_properties: Optional[Dict[str, Any]] = None, + status: Optional["_models.FailoverGroupStatus"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword partner_managed_instance_id: The resource ID of the partner SQL managed instance. + Required. + :paramtype partner_managed_instance_id: str + :keyword spec: The specifications of the failover group resource. Required. + :paramtype spec: ~azure.mgmt.azurearcdata.models.FailoverGroupSpec + :keyword status: The status of the failover group custom resource. + :paramtype status: ~azure.mgmt.azurearcdata.models.FailoverGroupStatus + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.provisioning_state = None + self.partner_managed_instance_id = partner_managed_instance_id + self.spec = spec + self.status = status + + +class FailoverGroupResource(ProxyResource): + """A failover group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurearcdata.models.SystemData + :ivar properties: null. Required. + :vartype properties: ~azure.mgmt.azurearcdata.models.FailoverGroupProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "properties": {"key": "properties", "type": "FailoverGroupProperties"}, + } + + def __init__(self, *, properties: "_models.FailoverGroupProperties", **kwargs: Any) -> None: + """ + :keyword properties: null. Required. + :paramtype properties: ~azure.mgmt.azurearcdata.models.FailoverGroupProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class FailoverGroupSpec(_serialization.Model): + """The specifications of the failover group resource. + + All required parameters must be populated in order to send to Azure. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar shared_name: The shared name of the failover group for this SQL managed instance. Both + SQL managed instance and its partner have to use the same shared name. + :vartype shared_name: str + :ivar source_mi: The name of the SQL managed instance with this failover group role. + :vartype source_mi: str + :ivar partner_mi: The name of the partner SQL managed instance. + :vartype partner_mi: str + :ivar partner_mirroring_url: The mirroring endpoint URL of the partner SQL managed instance. + :vartype partner_mirroring_url: str + :ivar partner_mirroring_cert: The mirroring endpoint public certificate for the partner SQL + managed instance. Only PEM format is supported. + :vartype partner_mirroring_cert: str + :ivar partner_sync_mode: The partner sync mode of the SQL managed instance. Known values are: + "async" and "sync". + :vartype partner_sync_mode: str or ~azure.mgmt.azurearcdata.models.FailoverGroupPartnerSyncMode + :ivar role: The role of the SQL managed instance in this failover group. Required. Known values + are: "primary", "secondary", "force-primary-allow-data-loss", and "force-secondary". + :vartype role: str or ~azure.mgmt.azurearcdata.models.InstanceFailoverGroupRole + """ + + _validation = { + "role": {"required": True}, + } + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "shared_name": {"key": "sharedName", "type": "str"}, + "source_mi": {"key": "sourceMI", "type": "str"}, + "partner_mi": {"key": "partnerMI", "type": "str"}, + "partner_mirroring_url": {"key": "partnerMirroringURL", "type": "str"}, + "partner_mirroring_cert": {"key": "partnerMirroringCert", "type": "str"}, + "partner_sync_mode": {"key": "partnerSyncMode", "type": "str"}, + "role": {"key": "role", "type": "str"}, + } + + def __init__( + self, + *, + role: Union[str, "_models.InstanceFailoverGroupRole"], + additional_properties: Optional[Dict[str, Any]] = None, + shared_name: Optional[str] = None, + source_mi: Optional[str] = None, + partner_mi: Optional[str] = None, + partner_mirroring_url: Optional[str] = None, + partner_mirroring_cert: Optional[str] = None, + partner_sync_mode: Union[str, "_models.FailoverGroupPartnerSyncMode"] = "async", + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword shared_name: The shared name of the failover group for this SQL managed instance. Both + SQL managed instance and its partner have to use the same shared name. + :paramtype shared_name: str + :keyword source_mi: The name of the SQL managed instance with this failover group role. + :paramtype source_mi: str + :keyword partner_mi: The name of the partner SQL managed instance. + :paramtype partner_mi: str + :keyword partner_mirroring_url: The mirroring endpoint URL of the partner SQL managed instance. + :paramtype partner_mirroring_url: str + :keyword partner_mirroring_cert: The mirroring endpoint public certificate for the partner SQL + managed instance. Only PEM format is supported. + :paramtype partner_mirroring_cert: str + :keyword partner_sync_mode: The partner sync mode of the SQL managed instance. Known values + are: "async" and "sync". + :paramtype partner_sync_mode: str or + ~azure.mgmt.azurearcdata.models.FailoverGroupPartnerSyncMode + :keyword role: The role of the SQL managed instance in this failover group. Required. Known + values are: "primary", "secondary", "force-primary-allow-data-loss", and "force-secondary". + :paramtype role: str or ~azure.mgmt.azurearcdata.models.InstanceFailoverGroupRole + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.shared_name = shared_name + self.source_mi = source_mi + self.partner_mi = partner_mi + self.partner_mirroring_url = partner_mirroring_url + self.partner_mirroring_cert = partner_mirroring_cert + self.partner_sync_mode = partner_sync_mode + self.role = role + + +class FailoverGroupStatus(_serialization.Model): + """The status of the Kubernetes custom resource. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar last_update_time: The time that the custom resource was last updated. + :vartype last_update_time: ~datetime.datetime + :ivar observed_generation: The version of the replicaSet associated with the failover group + custom resource. + :vartype observed_generation: int + :ivar state: The state of the failover group custom resource. Known values are: "Waiting", + "Succeeded", and "Failed". + :vartype state: str or ~azure.mgmt.azurearcdata.models.State + :ivar results: The message in case of a failure in the failover group. + :vartype results: str + :ivar role: The role of the managed instance in the failover group. Known values are: + "primary", "secondary", "force-primary-allow-data-loss", and "force-secondary". + :vartype role: str or ~azure.mgmt.azurearcdata.models.InstanceFailoverGroupRole + :ivar replicas: A list of failover group replicas. + :vartype replicas: list[~azure.mgmt.azurearcdata.models.AGReplicas] + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "last_update_time": {"key": "lastUpdateTime", "type": "iso-8601"}, + "observed_generation": {"key": "observedGeneration", "type": "int"}, + "state": {"key": "state", "type": "str"}, + "results": {"key": "results", "type": "str"}, + "role": {"key": "role", "type": "str"}, + "replicas": {"key": "replicas", "type": "[AGReplicas]"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + last_update_time: Optional[datetime.datetime] = None, + observed_generation: Optional[int] = None, + state: Optional[Union[str, "_models.State"]] = None, + results: Optional[str] = None, + role: Optional[Union[str, "_models.InstanceFailoverGroupRole"]] = None, + replicas: Optional[List["_models.AGReplicas"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword last_update_time: The time that the custom resource was last updated. + :paramtype last_update_time: ~datetime.datetime + :keyword observed_generation: The version of the replicaSet associated with the failover group + custom resource. + :paramtype observed_generation: int + :keyword state: The state of the failover group custom resource. Known values are: "Waiting", + "Succeeded", and "Failed". + :paramtype state: str or ~azure.mgmt.azurearcdata.models.State + :keyword results: The message in case of a failure in the failover group. + :paramtype results: str + :keyword role: The role of the managed instance in the failover group. Known values are: + "primary", "secondary", "force-primary-allow-data-loss", and "force-secondary". + :paramtype role: str or ~azure.mgmt.azurearcdata.models.InstanceFailoverGroupRole + :keyword replicas: A list of failover group replicas. + :paramtype replicas: list[~azure.mgmt.azurearcdata.models.AGReplicas] + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.last_update_time = last_update_time + self.observed_generation = observed_generation + self.state = state + self.results = results + self.role = role + self.replicas = replicas + + class K8SResourceRequirements(_serialization.Model): """The kubernetes resource limits and requests used to restrict or reserve resource usage. @@ -1060,8 +1463,8 @@ def __init__( additional_properties: Optional[Dict[str, JSON]] = None, requests: Optional[Dict[str, str]] = None, limits: Optional[Dict[str, str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1104,8 +1507,8 @@ def __init__( *, additional_properties: Optional[Dict[str, JSON]] = None, default: Optional["_models.K8SSchedulingOptions"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1120,7 +1523,8 @@ def __init__( class K8SSchedulingOptions(_serialization.Model): - """The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the database service. + """The kubernetes scheduling options. It describes restrictions used to help Kubernetes select + appropriate nodes to host the database service. :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1140,8 +1544,8 @@ def __init__( *, additional_properties: Optional[Dict[str, JSON]] = None, resources: Optional["_models.K8SResourceRequirements"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1166,7 +1570,7 @@ class KeytabInformation(_serialization.Model): "keytab": {"key": "keytab", "type": "str"}, } - def __init__(self, *, keytab: Optional[str] = None, **kwargs): + def __init__(self, *, keytab: Optional[str] = None, **kwargs: Any) -> None: """ :keyword keytab: A base64-encoded keytab. :paramtype keytab: str @@ -1189,7 +1593,7 @@ class LogAnalyticsWorkspaceConfig(_serialization.Model): "primary_key": {"key": "primaryKey", "type": "str"}, } - def __init__(self, *, workspace_id: Optional[str] = None, primary_key: Optional[str] = None, **kwargs): + def __init__(self, *, workspace_id: Optional[str] = None, primary_key: Optional[str] = None, **kwargs: Any) -> None: """ :keyword workspace_id: Azure Log Analytics workspace ID. :paramtype workspace_id: str @@ -1233,8 +1637,8 @@ def __init__( id: str, # pylint: disable=redefined-builtin public_signing_key: str, signing_certificate_thumbprint: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: A globally unique ID identifying the associated Kubernetes cluster. Required. :paramtype id: str @@ -1287,7 +1691,7 @@ class Operation(_serialization.Model): "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, name: str, display: "_models.OperationDisplay", is_data_action: bool, **kwargs): + def __init__(self, *, name: str, display: "_models.OperationDisplay", is_data_action: bool, **kwargs: Any) -> None: """ :keyword name: The name of the operation being performed on this particular object. Required. :paramtype name: str @@ -1335,7 +1739,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs): + def __init__(self, *, provider: str, resource: str, operation: str, description: str, **kwargs: Any) -> None: """ :keyword provider: The localized friendly form of the resource provider name. Required. :paramtype provider: str @@ -1375,7 +1779,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1401,8 +1805,8 @@ def __init__( *, value: Optional[List["_models.DataControllerResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: Array of results. :paramtype value: list[~azure.mgmt.azurearcdata.models.DataControllerResource] @@ -1473,8 +1877,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, sku: Optional["_models.PostgresInstanceSku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1514,7 +1918,7 @@ class PostgresInstanceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1562,8 +1966,8 @@ def __init__( basic_login_information: Optional["_models.BasicLoginInformation"] = None, k8_s_raw: Optional[JSON] = None, last_uploaded_date: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_controller_id: The data controller id. :paramtype data_controller_id: str @@ -1632,8 +2036,8 @@ def __init__( family: Optional[str] = None, capacity: Optional[int] = None, tier: Literal["Hyperscale"] = "Hyperscale", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: The name of the SKU. It is typically a letter+number code. Required. :paramtype name: str @@ -1676,8 +2080,8 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.PostgresInstanceProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1748,8 +2152,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, extended_location: Optional["_models.ExtendedLocation"] = None, sku: Optional["_models.SqlManagedInstanceSku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -1773,7 +2177,7 @@ class SqlManagedInstanceK8SRaw(_serialization.Model): :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :vartype additional_properties: dict[str, JSON] + :vartype additional_properties: dict[str, any] :ivar spec: The kubernetes spec information. :vartype spec: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceK8SSpec """ @@ -1786,14 +2190,14 @@ class SqlManagedInstanceK8SRaw(_serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, spec: Optional["_models.SqlManagedInstanceK8SSpec"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword spec: The kubernetes spec information. :paramtype spec: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceK8SSpec """ @@ -1829,8 +2233,8 @@ def __init__( additional_properties: Optional[Dict[str, JSON]] = None, scheduling: Optional["_models.K8SScheduling"] = None, replicas: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1870,7 +2274,7 @@ class SqlManagedInstanceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -1948,8 +2352,8 @@ def __init__( license_type: Union[str, "_models.ArcSqlManagedInstanceLicenseType"] = "BasePrice", cluster_id: Optional[str] = None, extension_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword data_controller_id: null. :paramtype data_controller_id: str @@ -2043,8 +2447,8 @@ def __init__( size: Optional[str] = None, family: Optional[str] = None, capacity: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tier: The pricing tier for the instance. Known values are: "GeneralPurpose" and "BusinessCritical". @@ -2079,7 +2483,7 @@ class SqlManagedInstanceUpdate(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2088,6 +2492,320 @@ def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): self.tags = tags +class SqlServerDatabaseResource(TrackedResource): + """Arc Sql Server database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurearcdata.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties of Arc Sql Server database. Required. + :vartype properties: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "SqlServerDatabaseResourceProperties"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.SqlServerDatabaseResourceProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword properties: Properties of Arc Sql Server database. Required. + :paramtype properties: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourceProperties + """ + super().__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class SqlServerDatabaseResourceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The properties of Arc Sql Server database resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar collation_name: Collation of the database. + :vartype collation_name: str + :ivar database_creation_date: Creation date of the database. + :vartype database_creation_date: ~datetime.datetime + :ivar compatibility_level: Compatibility level of the database. + :vartype compatibility_level: int + :ivar size_mb: Size of the database. + :vartype size_mb: float + :ivar space_available_mb: Space left of the database. + :vartype space_available_mb: float + :ivar state: State of the database. Known values are: "Online", "Restoring", "Recovering", + "RecoveryPending", "Suspect", "Emergency", "Offline", "Copying", and "OfflineSecondary". + :vartype state: str or ~azure.mgmt.azurearcdata.models.DatabaseState + :ivar is_read_only: Whether the database is read only or not. + :vartype is_read_only: bool + :ivar recovery_mode: Status of the database. Known values are: "Full", "Bulk-logged", and + "Simple". + :vartype recovery_mode: str or ~azure.mgmt.azurearcdata.models.RecoveryMode + :ivar database_options: List of features that are enabled for the database. + :vartype database_options: + ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions + :ivar backup_information: + :vartype backup_information: + ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation + :ivar provisioning_state: The provisioning state of the Arc-enabled SQL Server database + resource. + :vartype provisioning_state: str + """ + + _validation = { + "compatibility_level": {"maximum": 200, "minimum": 80}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "collation_name": {"key": "collationName", "type": "str"}, + "database_creation_date": {"key": "databaseCreationDate", "type": "iso-8601"}, + "compatibility_level": {"key": "compatibilityLevel", "type": "int"}, + "size_mb": {"key": "sizeMB", "type": "float"}, + "space_available_mb": {"key": "spaceAvailableMB", "type": "float"}, + "state": {"key": "state", "type": "str"}, + "is_read_only": {"key": "isReadOnly", "type": "bool"}, + "recovery_mode": {"key": "recoveryMode", "type": "str"}, + "database_options": {"key": "databaseOptions", "type": "SqlServerDatabaseResourcePropertiesDatabaseOptions"}, + "backup_information": { + "key": "backupInformation", + "type": "SqlServerDatabaseResourcePropertiesBackupInformation", + }, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + collation_name: Optional[str] = None, + database_creation_date: Optional[datetime.datetime] = None, + compatibility_level: Optional[int] = None, + size_mb: Optional[float] = None, + space_available_mb: Optional[float] = None, + state: Optional[Union[str, "_models.DatabaseState"]] = None, + is_read_only: Optional[bool] = None, + recovery_mode: Optional[Union[str, "_models.RecoveryMode"]] = None, + database_options: Optional["_models.SqlServerDatabaseResourcePropertiesDatabaseOptions"] = None, + backup_information: Optional["_models.SqlServerDatabaseResourcePropertiesBackupInformation"] = None, + **kwargs: Any + ) -> None: + """ + :keyword collation_name: Collation of the database. + :paramtype collation_name: str + :keyword database_creation_date: Creation date of the database. + :paramtype database_creation_date: ~datetime.datetime + :keyword compatibility_level: Compatibility level of the database. + :paramtype compatibility_level: int + :keyword size_mb: Size of the database. + :paramtype size_mb: float + :keyword space_available_mb: Space left of the database. + :paramtype space_available_mb: float + :keyword state: State of the database. Known values are: "Online", "Restoring", "Recovering", + "RecoveryPending", "Suspect", "Emergency", "Offline", "Copying", and "OfflineSecondary". + :paramtype state: str or ~azure.mgmt.azurearcdata.models.DatabaseState + :keyword is_read_only: Whether the database is read only or not. + :paramtype is_read_only: bool + :keyword recovery_mode: Status of the database. Known values are: "Full", "Bulk-logged", and + "Simple". + :paramtype recovery_mode: str or ~azure.mgmt.azurearcdata.models.RecoveryMode + :keyword database_options: List of features that are enabled for the database. + :paramtype database_options: + ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourcePropertiesDatabaseOptions + :keyword backup_information: + :paramtype backup_information: + ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourcePropertiesBackupInformation + """ + super().__init__(**kwargs) + self.collation_name = collation_name + self.database_creation_date = database_creation_date + self.compatibility_level = compatibility_level + self.size_mb = size_mb + self.space_available_mb = space_available_mb + self.state = state + self.is_read_only = is_read_only + self.recovery_mode = recovery_mode + self.database_options = database_options + self.backup_information = backup_information + self.provisioning_state = None + + +class SqlServerDatabaseResourcePropertiesBackupInformation(_serialization.Model): + """SqlServerDatabaseResourcePropertiesBackupInformation. + + :ivar last_full_backup: Date time of last full backup. + :vartype last_full_backup: ~datetime.datetime + :ivar last_log_backup: Date time of last log backup. + :vartype last_log_backup: ~datetime.datetime + """ + + _attribute_map = { + "last_full_backup": {"key": "lastFullBackup", "type": "iso-8601"}, + "last_log_backup": {"key": "lastLogBackup", "type": "iso-8601"}, + } + + def __init__( + self, + *, + last_full_backup: Optional[datetime.datetime] = None, + last_log_backup: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword last_full_backup: Date time of last full backup. + :paramtype last_full_backup: ~datetime.datetime + :keyword last_log_backup: Date time of last log backup. + :paramtype last_log_backup: ~datetime.datetime + """ + super().__init__(**kwargs) + self.last_full_backup = last_full_backup + self.last_log_backup = last_log_backup + + +class SqlServerDatabaseResourcePropertiesDatabaseOptions(_serialization.Model): + """List of features that are enabled for the database. + + :ivar is_auto_close_on: + :vartype is_auto_close_on: bool + :ivar is_auto_shrink_on: + :vartype is_auto_shrink_on: bool + :ivar is_auto_create_stats_on: + :vartype is_auto_create_stats_on: bool + :ivar is_auto_update_stats_on: + :vartype is_auto_update_stats_on: bool + :ivar is_remote_data_archive_enabled: + :vartype is_remote_data_archive_enabled: bool + :ivar is_memory_optimization_enabled: + :vartype is_memory_optimization_enabled: bool + :ivar is_encrypted: + :vartype is_encrypted: bool + :ivar is_trustworthy_on: + :vartype is_trustworthy_on: bool + """ + + _attribute_map = { + "is_auto_close_on": {"key": "isAutoCloseOn", "type": "bool"}, + "is_auto_shrink_on": {"key": "isAutoShrinkOn", "type": "bool"}, + "is_auto_create_stats_on": {"key": "isAutoCreateStatsOn", "type": "bool"}, + "is_auto_update_stats_on": {"key": "isAutoUpdateStatsOn", "type": "bool"}, + "is_remote_data_archive_enabled": {"key": "isRemoteDataArchiveEnabled", "type": "bool"}, + "is_memory_optimization_enabled": {"key": "isMemoryOptimizationEnabled", "type": "bool"}, + "is_encrypted": {"key": "isEncrypted", "type": "bool"}, + "is_trustworthy_on": {"key": "isTrustworthyOn", "type": "bool"}, + } + + def __init__( + self, + *, + is_auto_close_on: Optional[bool] = None, + is_auto_shrink_on: Optional[bool] = None, + is_auto_create_stats_on: Optional[bool] = None, + is_auto_update_stats_on: Optional[bool] = None, + is_remote_data_archive_enabled: Optional[bool] = None, + is_memory_optimization_enabled: Optional[bool] = None, + is_encrypted: Optional[bool] = None, + is_trustworthy_on: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword is_auto_close_on: + :paramtype is_auto_close_on: bool + :keyword is_auto_shrink_on: + :paramtype is_auto_shrink_on: bool + :keyword is_auto_create_stats_on: + :paramtype is_auto_create_stats_on: bool + :keyword is_auto_update_stats_on: + :paramtype is_auto_update_stats_on: bool + :keyword is_remote_data_archive_enabled: + :paramtype is_remote_data_archive_enabled: bool + :keyword is_memory_optimization_enabled: + :paramtype is_memory_optimization_enabled: bool + :keyword is_encrypted: + :paramtype is_encrypted: bool + :keyword is_trustworthy_on: + :paramtype is_trustworthy_on: bool + """ + super().__init__(**kwargs) + self.is_auto_close_on = is_auto_close_on + self.is_auto_shrink_on = is_auto_shrink_on + self.is_auto_create_stats_on = is_auto_create_stats_on + self.is_auto_update_stats_on = is_auto_update_stats_on + self.is_remote_data_archive_enabled = is_remote_data_archive_enabled + self.is_memory_optimization_enabled = is_memory_optimization_enabled + self.is_encrypted = is_encrypted + self.is_trustworthy_on = is_trustworthy_on + + +class SqlServerDatabaseUpdate(_serialization.Model): + """An update to database resource. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The data controller's properties. + :vartype properties: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourceProperties + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "properties": {"key": "properties", "type": "SqlServerDatabaseResourceProperties"}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SqlServerDatabaseResourceProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The data controller's properties. + :paramtype properties: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResourceProperties + """ + super().__init__(**kwargs) + self.tags = tags + self.properties = properties + + class SqlServerInstance(TrackedResource): """A SqlServerInstance. @@ -2138,8 +2856,8 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.SqlServerInstanceProperties"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2173,7 +2891,7 @@ class SqlServerInstanceListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None @@ -2191,7 +2909,7 @@ class SqlServerInstanceProperties(_serialization.Model): # pylint: disable=too- Server 2016", "SQL Server 2017", "SQL Server 2019", "SQL Server 2022", and "Unknown". :vartype version: str or ~azure.mgmt.azurearcdata.models.SqlVersion :ivar edition: SQL Server edition. Known values are: "Evaluation", "Enterprise", "Standard", - "Web", "Developer", and "Express". + "Web", "Developer", "Express", and "Business Intelligence". :vartype edition: str or ~azure.mgmt.azurearcdata.models.EditionType :ivar container_resource_id: ARM Resource id of the container resource (Azure Arc for Servers). Required. @@ -2200,6 +2918,9 @@ class SqlServerInstanceProperties(_serialization.Model): # pylint: disable=too- :vartype create_time: str :ivar v_core: The number of logical processors used by the SQL Server instance. :vartype v_core: str + :ivar cores: The number of total cores of the Operating System Environment (OSE) hosting the + SQL Server instance. + :vartype cores: str :ivar status: The cloud connectivity status. Required. Known values are: "Connected", "Disconnected", "Registered", and "Unknown". :vartype status: str or ~azure.mgmt.azurearcdata.models.ConnectionStatus @@ -2248,6 +2969,7 @@ class SqlServerInstanceProperties(_serialization.Model): # pylint: disable=too- "container_resource_id": {"key": "containerResourceId", "type": "str"}, "create_time": {"key": "createTime", "type": "str"}, "v_core": {"key": "vCore", "type": "str"}, + "cores": {"key": "cores", "type": "str"}, "status": {"key": "status", "type": "str"}, "patch_level": {"key": "patchLevel", "type": "str"}, "collation": {"key": "collation", "type": "str"}, @@ -2271,6 +2993,7 @@ def __init__( version: Optional[Union[str, "_models.SqlVersion"]] = None, edition: Optional[Union[str, "_models.EditionType"]] = None, v_core: Optional[str] = None, + cores: Optional[str] = None, patch_level: Optional[str] = None, collation: Optional[str] = None, current_version: Optional[str] = None, @@ -2282,20 +3005,23 @@ def __init__( azure_defender_status_last_updated: Optional[datetime.datetime] = None, azure_defender_status: Optional[Union[str, "_models.DefenderStatus"]] = None, host_type: Optional[Union[str, "_models.HostType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword version: SQL Server version. Known values are: "SQL Server 2012", "SQL Server 2014", "SQL Server 2016", "SQL Server 2017", "SQL Server 2019", "SQL Server 2022", and "Unknown". :paramtype version: str or ~azure.mgmt.azurearcdata.models.SqlVersion :keyword edition: SQL Server edition. Known values are: "Evaluation", "Enterprise", "Standard", - "Web", "Developer", and "Express". + "Web", "Developer", "Express", and "Business Intelligence". :paramtype edition: str or ~azure.mgmt.azurearcdata.models.EditionType :keyword container_resource_id: ARM Resource id of the container resource (Azure Arc for Servers). Required. :paramtype container_resource_id: str :keyword v_core: The number of logical processors used by the SQL Server instance. :paramtype v_core: str + :keyword cores: The number of total cores of the Operating System Environment (OSE) hosting the + SQL Server instance. + :paramtype cores: str :keyword status: The cloud connectivity status. Required. Known values are: "Connected", "Disconnected", "Registered", and "Unknown". :paramtype status: str or ~azure.mgmt.azurearcdata.models.ConnectionStatus @@ -2334,6 +3060,7 @@ def __init__( self.container_resource_id = container_resource_id self.create_time = None self.v_core = v_core + self.cores = cores self.status = status self.patch_level = patch_level self.collation = collation @@ -2360,7 +3087,7 @@ class SqlServerInstanceUpdate(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2406,8 +3133,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -2461,8 +3188,8 @@ def __init__( tenant_id: Optional[str] = None, authority: Optional[str] = None, client_secret: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword client_id: Client ID of the service principal for uploading data. :paramtype client_id: str @@ -2506,8 +3233,8 @@ def __init__( metrics: Optional[datetime.datetime] = None, logs: Optional[datetime.datetime] = None, usages: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword metrics: Last uploaded date for metrics from kubernetes cluster. Defaults to current date time. diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py index 86245dd95097..da476c846a5c 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py @@ -8,10 +8,12 @@ from ._operations import Operations from ._sql_managed_instances_operations import SqlManagedInstancesOperations +from ._failover_groups_operations import FailoverGroupsOperations from ._sql_server_instances_operations import SqlServerInstancesOperations from ._data_controllers_operations import DataControllersOperations from ._active_directory_connectors_operations import ActiveDirectoryConnectorsOperations from ._postgres_instances_operations import PostgresInstancesOperations +from ._sql_server_databases_operations import SqlServerDatabasesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -20,10 +22,12 @@ __all__ = [ "Operations", "SqlManagedInstancesOperations", + "FailoverGroupsOperations", "SqlServerInstancesOperations", "DataControllersOperations", "ActiveDirectoryConnectorsOperations", "PostgresInstancesOperations", + "SqlServerDatabasesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py index 0832fa65bb97..e0ceb9b47c9e 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py @@ -49,8 +49,8 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -86,8 +86,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,8 +129,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -169,8 +169,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -240,7 +240,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ActiveDirectoryConnectorListResult] = kwargs.pop("cls", None) @@ -333,7 +333,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -488,8 +488,8 @@ def begin_create( :param active_directory_connector_name: The name of the Active Directory connector instance. Required. :type active_directory_connector_name: str - :param active_directory_connector_resource: desc. Is either a model type or a IO type. - Required. + :param active_directory_connector_resource: desc. Is either a ActiveDirectoryConnectorResource + type or a IO type. Required. :type active_directory_connector_resource: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -512,7 +512,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -576,7 +576,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -640,7 +640,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -712,7 +712,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py index f888ba16368e..93570faf7de3 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py @@ -47,8 +47,8 @@ def build_list_in_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -75,8 +75,8 @@ def build_list_in_group_request(resource_group_name: str, subscription_id: str, _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -107,8 +107,8 @@ def build_put_data_controller_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -143,8 +143,8 @@ def build_delete_data_controller_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -176,8 +176,8 @@ def build_get_data_controller_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -209,8 +209,8 @@ def build_patch_data_controller_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -273,7 +273,7 @@ def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.DataControlle _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) @@ -362,7 +362,7 @@ def list_in_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) @@ -453,7 +453,7 @@ def _put_data_controller_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -592,7 +592,8 @@ def begin_put_data_controller( :type resource_group_name: str :param data_controller_name: The name of the data controller. Required. :type data_controller_name: str - :param data_controller_resource: desc. Is either a model type or a IO type. Required. + :param data_controller_resource: desc. Is either a DataControllerResource type or a IO type. + Required. :type data_controller_resource: ~azure.mgmt.azurearcdata.models.DataControllerResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -613,7 +614,7 @@ def begin_put_data_controller( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -676,7 +677,7 @@ def _delete_data_controller_initial( # pylint: disable=inconsistent-return-stat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -736,7 +737,7 @@ def begin_delete_data_controller( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -804,7 +805,7 @@ def get_data_controller( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DataControllerResource] = kwargs.pop("cls", None) @@ -861,7 +862,7 @@ def _patch_data_controller_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -998,8 +999,8 @@ def begin_patch_data_controller( :type resource_group_name: str :param data_controller_name: The name of the data controller. Required. :type data_controller_name: str - :param data_controller_resource: The update data controller resource. Is either a model type or - a IO type. Required. + :param data_controller_resource: The update data controller resource. Is either a + DataControllerUpdate type or a IO type. Required. :type data_controller_resource: ~azure.mgmt.azurearcdata.models.DataControllerUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1020,7 +1021,7 @@ def begin_patch_data_controller( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_failover_groups_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_failover_groups_operations.py new file mode 100644 index 000000000000..68757ee963a5 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_failover_groups_operations.py @@ -0,0 +1,736 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_request( + resource_group_name: str, sql_managed_instance_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, + sql_managed_instance_name: str, + failover_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_name, "str"), + "failoverGroupName": _SERIALIZER.url("failover_group_name", failover_group_name, "str"), + } + + _url: str = _format_url_section(_url, **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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + sql_managed_instance_name: str, + failover_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_name, "str"), + "failoverGroupName": _SERIALIZER.url("failover_group_name", failover_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # 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) + + +def build_get_request( + resource_group_name: str, + sql_managed_instance_name: str, + failover_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_name, "str"), + "failoverGroupName": _SERIALIZER.url("failover_group_name", failover_group_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class FailoverGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurearcdata.AzureArcDataManagementClient`'s + :attr:`failover_groups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, sql_managed_instance_name: str, **kwargs: Any + ) -> Iterable["_models.FailoverGroupResource"]: + """List the failover groups associated with the given sql managed instance. + + List the failover groups associated with the given sql managed instance. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FailoverGroupResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FailoverGroupListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FailoverGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + 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) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups" + } + + def _create_initial( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: Union[_models.FailoverGroupResource, IO], + **kwargs: Any + ) -> _models.FailoverGroupResource: + error_map = { + 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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FailoverGroupResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(failover_group_resource, (IO, bytes)): + _content = failover_group_resource + else: + _json = self._serialize.body(failover_group_resource, "FailoverGroupResource") + + request = build_create_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + 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) + + if response.status_code == 200: + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + @overload + def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: _models.FailoverGroupResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FailoverGroupResource]: + """Creates or replaces a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :param failover_group_resource: desc. Required. + :type failover_group_resource: ~azure.mgmt.azurearcdata.models.FailoverGroupResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FailoverGroupResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FailoverGroupResource]: + """Creates or replaces a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :param failover_group_resource: desc. Required. + :type failover_group_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FailoverGroupResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + failover_group_name: str, + failover_group_resource: Union[_models.FailoverGroupResource, IO], + **kwargs: Any + ) -> LROPoller[_models.FailoverGroupResource]: + """Creates or replaces a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :param failover_group_resource: desc. Is either a FailoverGroupResource type or a IO type. + Required. + :type failover_group_resource: ~azure.mgmt.azurearcdata.models.FailoverGroupResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FailoverGroupResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurearcdata.models.FailoverGroupResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FailoverGroupResource] = 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._create_initial( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + failover_group_resource=failover_group_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sql_managed_instance_name: str, failover_group_name: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + @distributed_trace + def begin_delete( + self, resource_group_name: str, sql_managed_instance_name: str, failover_group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + 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) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, sql_managed_instance_name: str, failover_group_name: str, **kwargs: Any + ) -> _models.FailoverGroupResource: + """Retrieves a failover group resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_managed_instance_name: Name of SQL Managed Instance. Required. + :type sql_managed_instance_name: str + :param failover_group_name: The name of the Failover Group. Required. + :type failover_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FailoverGroupResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.FailoverGroupResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.FailoverGroupResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + failover_group_name=failover_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("FailoverGroupResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}/failoverGroups/{failoverGroupName}" + } diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py index 38e3d4aaf604..e441403a2602 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py @@ -45,8 +45,8 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -93,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py index a02708bbb26e..4e50dc49de7e 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py @@ -47,8 +47,8 @@ def build_list_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: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -75,8 +75,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -107,8 +107,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -140,8 +140,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,8 +176,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -209,8 +209,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -272,7 +272,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.PostgresInstance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) @@ -358,7 +358,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) @@ -455,7 +455,7 @@ def get(self, resource_group_name: str, postgres_instance_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.PostgresInstance] = kwargs.pop("cls", None) @@ -512,7 +512,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -651,7 +651,8 @@ def begin_create( :type resource_group_name: str :param postgres_instance_name: Name of Postgres Instance. Required. :type postgres_instance_name: str - :param resource: The postgres instance. Is either a model type or a IO type. Required. + :param resource: The postgres instance. Is either a PostgresInstance type or a IO type. + Required. :type resource: ~azure.mgmt.azurearcdata.models.PostgresInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -672,7 +673,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -735,7 +736,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -793,7 +794,7 @@ def begin_delete(self, resource_group_name: str, postgres_instance_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -903,7 +904,8 @@ def update( :type resource_group_name: str :param postgres_instance_name: Name of Postgres Instance. Required. :type postgres_instance_name: str - :param parameters: The Postgres Instance. Is either a model type or a IO type. Required. + :param parameters: The Postgres Instance. Is either a PostgresInstanceUpdate type or a IO type. + Required. :type parameters: ~azure.mgmt.azurearcdata.models.PostgresInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -924,7 +926,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py index d9f16dea0afe..63fa5474b804 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py @@ -47,8 +47,8 @@ def build_list_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: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -75,8 +75,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -107,8 +107,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -140,8 +140,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,8 +176,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -209,8 +209,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -272,7 +272,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SqlManagedInstance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) @@ -358,7 +358,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) @@ -457,7 +457,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlManagedInstance] = kwargs.pop("cls", None) @@ -514,7 +514,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -654,7 +654,7 @@ def begin_create( :param sql_managed_instance_name: Name of SQL Managed Instance. Required. :type sql_managed_instance_name: str :param sql_managed_instance: The SQL Managed Instance to be created or updated. Is either a - model type or a IO type. Required. + SqlManagedInstance type or a IO type. Required. :type sql_managed_instance: ~azure.mgmt.azurearcdata.models.SqlManagedInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -675,7 +675,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -738,7 +738,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -796,7 +796,7 @@ def begin_delete(self, resource_group_name: str, sql_managed_instance_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -906,7 +906,8 @@ def update( :type resource_group_name: str :param sql_managed_instance_name: Name of SQL Managed Instance. Required. :type sql_managed_instance_name: str - :param parameters: The SQL Managed Instance. Is either a model type or a IO type. Required. + :param parameters: The SQL Managed Instance. Is either a SqlManagedInstanceUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -927,7 +928,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_databases_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_databases_operations.py new file mode 100644 index 000000000000..66776f3419aa --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_databases_operations.py @@ -0,0 +1,766 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_request( + resource_group_name: str, sql_server_instance_name: str, database_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + } + + _url: str = _format_url_section(_url, **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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, sql_server_instance_name: str, database_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # 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) + + +def build_get_request( + resource_group_name: str, sql_server_instance_name: str, database_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, sql_server_instance_name: str, database_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_name, "str"), + "databaseName": _SERIALIZER.url("database_name", database_name, "str"), + } + + _url: str = _format_url_section(_url, **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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_request( + resource_group_name: str, sql_server_instance_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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SqlServerDatabasesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.azurearcdata.AzureArcDataManagementClient`'s + :attr:`sql_server_databases` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def create( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_resource: _models.SqlServerDatabaseResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Creates or replaces an Arc Sql Server Database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_resource: The request body for database resource. Required. + :type sql_server_database_resource: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_resource: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Creates or replaces an Arc Sql Server Database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_resource: The request body for database resource. Required. + :type sql_server_database_resource: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_resource: Union[_models.SqlServerDatabaseResource, IO], + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Creates or replaces an Arc Sql Server Database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_resource: The request body for database resource. Is either a + SqlServerDatabaseResource type or a IO type. Required. + :type sql_server_database_resource: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlServerDatabaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sql_server_database_resource, (IO, bytes)): + _content = sql_server_database_resource + else: + _json = self._serialize.body(sql_server_database_resource, "SqlServerDatabaseResource") + + request = build_create_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("SqlServerDatabaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, sql_server_instance_name: str, database_name: str, **kwargs: Any + ) -> None: + """Deletes an Arc Sql Server database resource. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @distributed_trace + def get( + self, resource_group_name: str, sql_server_instance_name: str, database_name: str, **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Retrieves an Arc Sql Server database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SqlServerDatabaseResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("SqlServerDatabaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @overload + def update( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_update: _models.SqlServerDatabaseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Updates an existing database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_update: The requested database resource state. Required. + :type sql_server_database_update: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_update: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Updates an existing database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_update: The requested database resource state. Required. + :type sql_server_database_update: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + sql_server_instance_name: str, + database_name: str, + sql_server_database_update: Union[_models.SqlServerDatabaseUpdate, IO], + **kwargs: Any + ) -> _models.SqlServerDatabaseResource: + """Updates an existing database. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :param database_name: Name of the database. Required. + :type database_name: str + :param sql_server_database_update: The requested database resource state. Is either a + SqlServerDatabaseUpdate type or a IO type. Required. + :type sql_server_database_update: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlServerDatabaseResource or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 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: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SqlServerDatabaseResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(sql_server_database_update, (IO, bytes)): + _content = sql_server_database_update + else: + _json = self._serialize.body(sql_server_database_update, "SqlServerDatabaseUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + 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) + + deserialized = self._deserialize("SqlServerDatabaseResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases/{databaseName}" + } + + @distributed_trace + def list( + self, resource_group_name: str, sql_server_instance_name: str, **kwargs: Any + ) -> Iterable["_models.SqlServerDatabaseResource"]: + """List the databases associated with the given Arc Sql Server. + + List the databases associated with the given Arc Sql Server. + + :param resource_group_name: The name of the Azure resource group. Required. + :type resource_group_name: str + :param sql_server_instance_name: Name of SQL Server Instance. Required. + :type sql_server_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlServerDatabaseResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurearcdata.models.SqlServerDatabaseResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ArcSqlServerDatabaseListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ArcSqlServerDatabaseListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + response = pipeline_response.http_response + + 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) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}/databases" + } diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py index 0a442ca6fc69..11d8d983af84 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py @@ -47,8 +47,8 @@ def build_list_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: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -75,8 +75,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -107,8 +107,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -140,8 +140,8 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,8 +176,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) accept = _headers.pop("Accept", "application/json") @@ -209,8 +209,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-03-01-preview") + api_version: Literal["2023-01-15-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-01-15-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -272,7 +272,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.SqlServerInstance"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) @@ -358,7 +358,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) @@ -455,7 +455,7 @@ def get(self, resource_group_name: str, sql_server_instance_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.SqlServerInstance] = kwargs.pop("cls", None) @@ -512,7 +512,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -651,8 +651,8 @@ def begin_create( :type resource_group_name: str :param sql_server_instance_name: Name of SQL Server Instance. Required. :type sql_server_instance_name: str - :param sql_server_instance: The SQL Server Instance to be created or updated. Is either a model - type or a IO type. Required. + :param sql_server_instance: The SQL Server Instance to be created or updated. Is either a + SqlServerInstance type or a IO type. Required. :type sql_server_instance: ~azure.mgmt.azurearcdata.models.SqlServerInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -673,7 +673,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -736,7 +736,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -794,7 +794,7 @@ def begin_delete(self, resource_group_name: str, sql_server_instance_name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -904,7 +904,8 @@ def update( :type resource_group_name: str :param sql_server_instance_name: Name of SQL Server Instance. Required. :type sql_server_instance_name: str - :param parameters: The SQL Server Instance. Is either a model type or a IO type. Required. + :param parameters: The SQL Server Instance. Is either a SqlServerInstanceUpdate type or a IO + type. Required. :type parameters: ~azure.mgmt.azurearcdata.models.SqlServerInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -925,7 +926,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-03-01-preview"] = kwargs.pop( + api_version: Literal["2023-01-15-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_active_directory_connector.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_active_directory_connector.py index 992c02d65a25..2df5cc092720 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_active_directory_connector.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_active_directory_connector.py @@ -59,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateActiveDirectoryConnector.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdateActiveDirectoryConnector.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_arc_sql_server_database.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_arc_sql_server_database.py new file mode 100644 index 000000000000..f8f331587f96 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_arc_sql_server_database.py @@ -0,0 +1,70 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python create_or_update_arc_sql_server_database.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.sql_server_databases.create( + resource_group_name="testrg", + sql_server_instance_name="testSqlServerInstance", + database_name="testdb", + sql_server_database_resource={ + "location": "southeastasia", + "properties": { + "backupInformation": { + "lastFullBackup": "2022-05-05T16:26:33.883Z", + "lastLogBackup": "2022-05-10T16:26:33.883Z", + }, + "collationName": "SQL_Latin1_General_CP1_CI_AS", + "compatibilityLevel": 150, + "databaseCreationDate": "2022-04-05T16:26:33.883Z", + "databaseOptions": { + "isAutoCloseOn": True, + "isAutoCreateStatsOn": True, + "isAutoShrinkOn": True, + "isAutoUpdateStatsOn": True, + "isEncrypted": True, + "isMemoryOptimizationEnabled": True, + "isRemoteDataArchiveEnabled": True, + "isTrustworthyOn": True, + }, + "isReadOnly": True, + "recoveryMode": "Full", + "sizeMB": 150, + "spaceAvailableMB": 100, + "state": "Online", + }, + "tags": {"mytag": "myval"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdateArcSqlServerDatabase.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_data_controller.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_data_controller.py index 748fb8eabae1..fffcf361a796 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_data_controller.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_data_controller.py @@ -71,6 +71,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateDataController.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdateDataController.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_failover_group.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_failover_group.py new file mode 100644 index 000000000000..5ab375bc8778 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_failover_group.py @@ -0,0 +1,48 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python create_or_update_failover_group.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.failover_groups.begin_create( + resource_group_name="testrg", + sql_managed_instance_name="testSqlManagedInstance", + failover_group_name="testFailoverGroupName", + failover_group_resource={ + "properties": { + "partnerManagedInstanceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/sqlManagedInstances/partnerMI", + "spec": {"partnerSyncMode": "async", "role": "primary"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdateFailoverGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_postgres_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_postgres_instance.py index 7119b1f25104..8ad7990f2e6d 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_postgres_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_postgres_instance.py @@ -83,6 +83,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdatePostgresInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdatePostgresInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_managed_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_managed_instance.py index e061afe5d2fb..6b65b70d0665 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_managed_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_managed_instance.py @@ -69,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateSqlManagedInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdateSqlManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_server_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_server_instance.py index d4a8a27b399c..585c4ecc4b30 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_server_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/create_or_update_sql_server_instance.py @@ -39,6 +39,7 @@ def main(): "azureDefenderStatusLastUpdated": "2020-01-02T17:18:19.1234567Z", "collation": "collation", "containerResourceId": "Resource id of hosting Arc Machine", + "cores": "4", "currentVersion": "2012", "edition": "Developer", "hostType": "Physical Server", @@ -58,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/CreateOrUpdateSqlServerInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/CreateOrUpdateSqlServerInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_active_directory_connector.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_active_directory_connector.py index 2eeb1ba06e8c..31f9e18283ca 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_active_directory_connector.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_active_directory_connector.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteActiveDirectoryConnector.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeleteActiveDirectoryConnector.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_arc_sql_server_database.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_arc_sql_server_database.py new file mode 100644 index 000000000000..7ba431c80d1f --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_arc_sql_server_database.py @@ -0,0 +1,42 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python delete_arc_sql_server_database.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.sql_server_databases.delete( + resource_group_name="testrg", + sql_server_instance_name="testsqlManagedInstance", + database_name="testdb", + ) + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeleteArcSqlServerDatabase.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_data_controller.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_data_controller.py index a4cb8fcbea06..7146777bd584 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_data_controller.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_data_controller.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteDataController.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeleteDataController.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_failover_group.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_failover_group.py new file mode 100644 index 000000000000..8f720fdc8fdd --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_failover_group.py @@ -0,0 +1,42 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python delete_failover_group.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.failover_groups.begin_delete( + resource_group_name="testrg", + sql_managed_instance_name="testSqlManagedInstance", + failover_group_name="testFailoverGroupName", + ).result() + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeleteFailoverGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_postgres_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_postgres_instance.py index 93e3462283c4..f37c75639efd 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_postgres_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_postgres_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeletePostgresInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeletePostgresInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_managed_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_managed_instance.py index 756198983e48..fe9d4161d2a3 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_managed_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_managed_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteSqlManagedInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeleteSqlManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_server_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_server_instance.py index f40d9fa71235..df931a13e4f1 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_server_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_sql_server_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/DeleteSqlServerInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/DeleteSqlServerInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_active_directory_connector.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_active_directory_connector.py index 5b95f948a52e..f608b59bc085 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_active_directory_connector.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_active_directory_connector.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetActiveDirectoryConnector.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetActiveDirectoryConnector.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_arc_sql_server_database.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_arc_sql_server_database.py new file mode 100644 index 000000000000..c2700a8b0066 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_arc_sql_server_database.py @@ -0,0 +1,42 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python get_arc_sql_server_database.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.sql_server_databases.get( + resource_group_name="testrg", + sql_server_instance_name="testSqlServerInstance", + database_name="testdb", + ) + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetArcSqlServerDatabase.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_data_controller.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_data_controller.py index d998f7445f5b..bc64366cb3f9 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_data_controller.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_data_controller.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetDataController.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetDataController.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_failover_group.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_failover_group.py new file mode 100644 index 000000000000..6f83705e021d --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_failover_group.py @@ -0,0 +1,42 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python get_failover_group.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.failover_groups.get( + resource_group_name="testrg", + sql_managed_instance_name="testSqlManagedInstance", + failover_group_name="testFailoverGroupName", + ) + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetFailoverGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_postgres_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_postgres_instance.py index 368cace719b0..83ab15b3fb63 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_postgres_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_postgres_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetPostgresInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetPostgresInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_managed_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_managed_instance.py index 9a8917c8d85c..41352d567760 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_managed_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_managed_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetSqlManagedInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetSqlManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_server_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_server_instance.py index dc2feeb0fbf9..67e7fd6bc7f8 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_server_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/get_sql_server_instance.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/GetSqlServerInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/GetSqlServerInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_data_controller_active_directory_connector.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_data_controller_active_directory_connector.py index 29057515c196..8adea7075de2 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_data_controller_active_directory_connector.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_data_controller_active_directory_connector.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByDataControllerActiveDirectoryConnector.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListByDataControllerActiveDirectoryConnector.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_data_controller.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_data_controller.py index 07dc6bb3a06a..b07d86bb93f7 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_data_controller.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_data_controller.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupDataController.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListByResourceGroupDataController.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_postgres_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_postgres_instance.py index f6a56e784bf8..8a11f7524632 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_postgres_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_postgres_instance.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupPostgresInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListByResourceGroupPostgresInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_managed_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_managed_instance.py index 503d98ee4dc2..ad2b6d12decc 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_managed_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_managed_instance.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupSqlManagedInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListByResourceGroupSqlManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_server_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_server_instance.py index b93b9e7e405f..ec2f8ff57e23 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_server_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_resource_group_sql_server_instance.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListByResourceGroupSqlServerInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListByResourceGroupSqlServerInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_sql_managed_instance_failover_group.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_sql_managed_instance_failover_group.py new file mode 100644 index 000000000000..c90a46c86278 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_sql_managed_instance_failover_group.py @@ -0,0 +1,42 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python list_by_sql_managed_instance_failover_group.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.failover_groups.list( + resource_group_name="testrg", + sql_managed_instance_name="testSqlManagedInstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListBySqlManagedInstanceFailoverGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_sql_server_instance_database.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_sql_server_instance_database.py new file mode 100644 index 000000000000..1fb1e53f1a8f --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_by_sql_server_instance_database.py @@ -0,0 +1,42 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python list_by_sql_server_instance_database.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.sql_server_databases.list( + resource_group_name="testrg", + sql_server_instance_name="testSqlServerInstance", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListBySqlServerInstanceDatabase.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_operation.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_operation.py index 267aa2de8d4d..d7531b5f6188 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_operation.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_operation.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListOperation.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListOperation.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_data_controller.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_data_controller.py index 3d30832d330b..908dc9ea4ee9 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_data_controller.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_data_controller.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionDataController.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListSubscriptionDataController.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_postgres_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_postgres_instance.py index b38cb284be5e..d29faa9645cf 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_postgres_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_postgres_instance.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionPostgresInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListSubscriptionPostgresInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_managed_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_managed_instance.py index ce26408e3a9b..bdde4a1d32f4 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_managed_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_managed_instance.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionSqlManagedInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListSubscriptionSqlManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_server_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_server_instance.py index 7f853dc2e8dd..3ad6671024ef 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_server_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/list_subscription_sql_server_instance.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/ListSubscriptionSqlServerInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/ListSubscriptionSqlServerInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_data_controller.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_data_controller.py index a768debee900..8d5bcc353979 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_data_controller.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_data_controller.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateDataController.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/UpdateDataController.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_postgres_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_postgres_instance.py index fc9d0a052b94..7bad8b0e287c 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_postgres_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_postgres_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdatePostgresInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/UpdatePostgresInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_managed_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_managed_instance.py index fddb55392d48..82b848a5980c 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_managed_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_managed_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateSqlManagedInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/UpdateSqlManagedInstance.json if __name__ == "__main__": main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_database.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_database.py new file mode 100644 index 000000000000..34565eeffe1f --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_database.py @@ -0,0 +1,43 @@ +# 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.azurearcdata import AzureArcDataManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-azurearcdata +# USAGE + python update_sql_server_database.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 = AzureArcDataManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-1111-2222-3333-444444444444", + ) + + response = client.sql_server_databases.update( + resource_group_name="testrg", + sql_server_instance_name="testsqlManagedInstance", + database_name="testdb", + sql_server_database_update={"tags": {"mytag": "myval1"}}, + ) + print(response) + + +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/UpdateSqlServerDatabase.json +if __name__ == "__main__": + main() diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_instance.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_instance.py index 0a002fe12522..2a61bf3e85bf 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_instance.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/update_sql_server_instance.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2022-03-01-preview/examples/UpdateSqlServerInstance.json +# x-ms-original-file: specification/azurearcdata/resource-manager/Microsoft.AzureArcData/preview/2023-01-15-preview/examples/UpdateSqlServerInstance.json if __name__ == "__main__": main()