diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json index f285b3b3d35a..c49564b440dc 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json @@ -1,11 +1,11 @@ { - "commit": "be6cd9ccfcb6ba08c1c206627026eabfbff31fc1", + "commit": "d19734a028321ea3dbe7a114395d72873599b076", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.6.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.6.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..950b3b3f2fd9 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 @@ -70,7 +76,7 @@ def __init__( self._config = AzureArcDataManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -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..5fc241367677 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -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 - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,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: str = 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..842ae727fbbc 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 @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -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 @@ -1242,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -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..0da9910bc80e 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 @@ -71,7 +78,7 @@ def __init__( self._config = AzureArcDataManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -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..fa26505c0997 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -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 - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,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: str = 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..f901eeaacb52 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +38,6 @@ 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]] @@ -87,9 +83,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActiveDirectoryConnectorListResult] = kwargs.pop("cls", None) error_map = { @@ -143,8 +137,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -180,16 +175,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(active_directory_connector_resource, (IO, bytes)): + if isinstance(active_directory_connector_resource, (IOBase, bytes)): _content = active_directory_connector_resource else: _json = self._serialize.body(active_directory_connector_resource, "ActiveDirectoryConnectorResource") @@ -210,8 +203,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,8 +329,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,9 +353,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -424,9 +416,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -442,8 +432,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,9 +479,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -560,9 +549,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) request = build_get_request( @@ -578,8 +565,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..701a56b1b548 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ build_put_data_controller_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]] @@ -83,9 +79,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) error_map = { @@ -137,8 +131,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,9 +168,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) error_map = { @@ -228,8 +221,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,16 +258,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.DataControllerResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_controller_resource, (IO, bytes)): + if isinstance(data_controller_resource, (IOBase, bytes)): _content = data_controller_resource else: _json = self._serialize.body(data_controller_resource, "DataControllerResource") @@ -293,8 +285,9 @@ async def _put_data_controller_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,7 +398,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,9 +421,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.DataControllerResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -491,9 +483,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_data_controller_request( @@ -508,8 +498,9 @@ async def _delete_data_controller_initial( # pylint: disable=inconsistent-retur request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -551,9 +542,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -619,9 +608,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataControllerResource] = kwargs.pop("cls", None) request = build_get_data_controller_request( @@ -636,8 +623,9 @@ async def get_data_controller( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -676,16 +664,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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[Optional[_models.DataControllerResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_controller_resource, (IO, bytes)): + if isinstance(data_controller_resource, (IOBase, bytes)): _content = data_controller_resource else: _json = self._serialize.body(data_controller_resource, "DataControllerUpdate") @@ -705,8 +691,9 @@ async def _patch_data_controller_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -815,8 +802,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,9 +825,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.DataControllerResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) 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..3f7e6403fde3 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_failover_groups_operations.py @@ -0,0 +1,582 @@ +# 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. +# -------------------------------------------------------------------------- +from io import IOBase +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, +) + +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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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, (IOBase, 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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: str = 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 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: str = 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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..91909e6d2899 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 @@ -6,7 +6,6 @@ # 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, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import 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]] @@ -69,9 +64,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -122,8 +115,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..cb71a04afa38 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ 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]] @@ -82,9 +78,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -136,8 +130,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,9 +166,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -226,8 +219,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,9 +264,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostgresInstance] = kwargs.pop("cls", None) request = build_get_request( @@ -287,8 +279,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,16 +320,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.PostgresInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(resource, (IO, bytes)): + if isinstance(resource, (IOBase, bytes)): _content = resource else: _json = self._serialize.body(resource, "PostgresInstance") @@ -356,8 +347,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,7 +458,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,9 +480,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.PostgresInstance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -551,9 +542,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -568,8 +557,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -611,9 +601,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -721,7 +709,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,16 +731,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.PostgresInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PostgresInstanceUpdate") @@ -771,8 +758,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..79fc204a6ca7 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ 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]] @@ -82,9 +78,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -136,8 +130,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,9 +166,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -226,8 +219,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,9 +264,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlManagedInstance] = kwargs.pop("cls", None) request = build_get_request( @@ -287,8 +279,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,16 +320,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlManagedInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(sql_managed_instance, (IO, bytes)): + if isinstance(sql_managed_instance, (IOBase, bytes)): _content = sql_managed_instance else: _json = self._serialize.body(sql_managed_instance, "SqlManagedInstance") @@ -356,8 +347,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -467,7 +459,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,9 +480,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlManagedInstance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -552,9 +542,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -569,8 +557,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,9 +601,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -722,7 +709,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,16 +731,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlManagedInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlManagedInstanceUpdate") @@ -772,8 +758,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..465ab01f8655 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_databases_operations.py @@ -0,0 +1,587 @@ +# 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. +# -------------------------------------------------------------------------- +from io import IOBase +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, +) + +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: str = 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, (IOBase, 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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, (IOBase, 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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..fbe3f2f03cbf 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,10 +40,6 @@ 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]] @@ -82,9 +78,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -136,8 +130,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,9 +166,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -226,8 +219,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -270,9 +264,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlServerInstance] = kwargs.pop("cls", None) request = build_get_request( @@ -287,8 +279,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -327,16 +320,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlServerInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(sql_server_instance, (IO, bytes)): + if isinstance(sql_server_instance, (IOBase, bytes)): _content = sql_server_instance else: _json = self._serialize.body(sql_server_instance, "SqlServerInstance") @@ -356,8 +347,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,8 +458,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,9 +480,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlServerInstance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -552,9 +542,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -569,8 +557,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,9 +601,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -722,7 +709,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,16 +731,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlServerInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlServerInstanceUpdate") @@ -772,8 +758,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..28faf486165c 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 @@ -16,6 +16,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,9 +25,19 @@ 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 K8SActiveDirectory +from ._models_py3 import K8SActiveDirectoryConnector +from ._models_py3 import K8SNetworkSettings from ._models_py3 import K8SResourceRequirements from ._models_py3 import K8SScheduling from ._models_py3 import K8SSchedulingOptions +from ._models_py3 import K8SSecurity +from ._models_py3 import K8SSettings +from ._models_py3 import K8StransparentDataEncryption from ._models_py3 import KeytabInformation from ._models_py3 import LogAnalyticsWorkspaceConfig from ._models_py3 import OnPremiseProperty @@ -48,6 +59,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,12 +78,17 @@ 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 ._patch import __all__ as _patch_all @@ -85,6 +106,7 @@ "ActiveDirectoryDomainController", "ActiveDirectoryDomainControllers", "ActiveDirectoryInformation", + "ArcSqlServerDatabaseListResult", "BasicLoginInformation", "CommonSku", "DataControllerProperties", @@ -93,9 +115,19 @@ "ErrorResponse", "ErrorResponseBody", "ExtendedLocation", + "FailoverGroupListResult", + "FailoverGroupProperties", + "FailoverGroupResource", + "FailoverGroupSpec", + "K8SActiveDirectory", + "K8SActiveDirectoryConnector", + "K8SNetworkSettings", "K8SResourceRequirements", "K8SScheduling", "K8SSchedulingOptions", + "K8SSecurity", + "K8SSettings", + "K8StransparentDataEncryption", "KeytabInformation", "LogAnalyticsWorkspaceConfig", "OnPremiseProperty", @@ -117,6 +149,11 @@ "SqlManagedInstanceProperties", "SqlManagedInstanceSku", "SqlManagedInstanceUpdate", + "SqlServerDatabaseResource", + "SqlServerDatabaseResourceProperties", + "SqlServerDatabaseResourcePropertiesBackupInformation", + "SqlServerDatabaseResourcePropertiesDatabaseOptions", + "SqlServerDatabaseUpdate", "SqlServerInstance", "SqlServerInstanceListResult", "SqlServerInstanceProperties", @@ -130,12 +167,17 @@ "ArcSqlServerLicenseType", "ConnectionStatus", "CreatedByType", + "DatabaseState", "DefenderStatus", "EditionType", "ExtendedLocationTypes", + "FailoverGroupPartnerSyncMode", "HostType", "Infrastructure", + "InstanceFailoverGroupRole", "OperationOrigin", + "ProvisioningState", + "RecoveryMode", "SqlManagedInstanceSkuTier", "SqlVersion", ] 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..14fc21e240a9 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,14 @@ 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" + ASYNC_ENUM = "async" + + class HostType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of host for Azure Arc SQL Server.""" @@ -109,6 +132,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 +148,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.""" 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..c764343d6d5a 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: @@ -410,7 +410,7 @@ class ActiveDirectoryConnectorStatus(_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 last_update_time: The time that the custom resource was last updated. :vartype last_update_time: str :ivar observed_generation: The version of the replicaSet associated with the AD connector @@ -430,16 +430,16 @@ class ActiveDirectoryConnectorStatus(_serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, 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. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword last_update_time: The time that the custom resource was last updated. :paramtype last_update_time: str :keyword observed_generation: The version of the replicaSet associated with the AD connector @@ -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,34 @@ def __init__(self, *, keytab_information: Optional["_models.KeytabInformation"] self.keytab_information = keytab_information +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 +588,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 +641,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 +744,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 +799,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 +840,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 +907,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 +943,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 +967,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 +1006,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 +1047,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,12 +1060,356 @@ 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: JSON + """ + + _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": "object"}, + } + + def __init__( + self, + *, + partner_managed_instance_id: str, + spec: "_models.FailoverGroupSpec", + additional_properties: Optional[Dict[str, Any]] = None, + status: Optional[JSON] = 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: JSON + """ + 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", "sync", and "async". + :vartype partner_sync_mode: str or ~azure.mgmt.azurearcdata.models.FailoverGroupPartnerSyncMode + :ivar role: The role of the SQL managed instance in this failover group. 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"] = "primary", + 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", "sync", and "async". + :paramtype partner_sync_mode: str or + ~azure.mgmt.azurearcdata.models.FailoverGroupPartnerSyncMode + :keyword role: The role of the SQL managed instance in this failover group. 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 K8SActiveDirectory(_serialization.Model): + """The kubernetes active directory information. + + :ivar connector: + :vartype connector: ~azure.mgmt.azurearcdata.models.K8SActiveDirectoryConnector + :ivar account_name: Account name for AAD. + :vartype account_name: str + :ivar keytab_secret: Keytab secret used to authenticate with Active Directory. + :vartype keytab_secret: str + :ivar encryption_types: An array of encryption types. + :vartype encryption_types: list[str] + """ + + _attribute_map = { + "connector": {"key": "connector", "type": "K8SActiveDirectoryConnector"}, + "account_name": {"key": "accountName", "type": "str"}, + "keytab_secret": {"key": "keytabSecret", "type": "str"}, + "encryption_types": {"key": "encryptionTypes", "type": "[str]"}, + } + + def __init__( + self, + *, + connector: Optional["_models.K8SActiveDirectoryConnector"] = None, + account_name: Optional[str] = None, + keytab_secret: Optional[str] = None, + encryption_types: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword connector: + :paramtype connector: ~azure.mgmt.azurearcdata.models.K8SActiveDirectoryConnector + :keyword account_name: Account name for AAD. + :paramtype account_name: str + :keyword keytab_secret: Keytab secret used to authenticate with Active Directory. + :paramtype keytab_secret: str + :keyword encryption_types: An array of encryption types. + :paramtype encryption_types: list[str] + """ + super().__init__(**kwargs) + self.connector = connector + self.account_name = account_name + self.keytab_secret = keytab_secret + self.encryption_types = encryption_types + + +class K8SActiveDirectoryConnector(_serialization.Model): + """K8SActiveDirectoryConnector. + + :ivar name: Name of the connector. + :vartype name: str + :ivar namespace: Name space of the connector. + :vartype namespace: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + } + + def __init__(self, *, name: Optional[str] = None, namespace: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword name: Name of the connector. + :paramtype name: str + :keyword namespace: Name space of the connector. + :paramtype namespace: str + """ + super().__init__(**kwargs) + self.name = name + self.namespace = namespace + + +class K8SNetworkSettings(_serialization.Model): + """The kubernetes network settings information. + + :ivar forceencryption: If 1, then SQL Server forces all connections to be encrypted. By + default, this option is 0. + :vartype forceencryption: int + :ivar tlsciphers: Specifies which ciphers are allowed by SQL Server for TLS. + :vartype tlsciphers: str + :ivar tlsprotocols: A comma-separated list of which TLS protocols are allowed by SQL Server. + :vartype tlsprotocols: str + """ + + _attribute_map = { + "forceencryption": {"key": "forceencryption", "type": "int"}, + "tlsciphers": {"key": "tlsciphers", "type": "str"}, + "tlsprotocols": {"key": "tlsprotocols", "type": "str"}, + } + + def __init__( + self, + *, + forceencryption: Optional[int] = None, + tlsciphers: Optional[str] = None, + tlsprotocols: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword forceencryption: If 1, then SQL Server forces all connections to be encrypted. By + default, this option is 0. + :paramtype forceencryption: int + :keyword tlsciphers: Specifies which ciphers are allowed by SQL Server for TLS. + :paramtype tlsciphers: str + :keyword tlsprotocols: A comma-separated list of which TLS protocols are allowed by SQL Server. + :paramtype tlsprotocols: str + """ + super().__init__(**kwargs) + self.forceencryption = forceencryption + self.tlsciphers = tlsciphers + self.tlsprotocols = tlsprotocols + + class K8SResourceRequirements(_serialization.Model): """The kubernetes resource limits and requests used to restrict or reserve resource usage. :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 requests: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and @@ -1057,15 +1431,15 @@ class K8SResourceRequirements(_serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = 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. - :paramtype additional_properties: dict[str, JSON] + :paramtype additional_properties: dict[str, any] :keyword requests: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and @@ -1088,7 +1462,7 @@ class K8SScheduling(_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 default: The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the database service. :vartype default: ~azure.mgmt.azurearcdata.models.K8SSchedulingOptions @@ -1102,14 +1476,14 @@ class K8SScheduling(_serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, default: Optional["_models.K8SSchedulingOptions"] = 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 default: The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the database service. :paramtype default: ~azure.mgmt.azurearcdata.models.K8SSchedulingOptions @@ -1120,11 +1494,12 @@ 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. - :vartype additional_properties: dict[str, JSON] + :vartype additional_properties: dict[str, any] :ivar resources: The kubernetes resource limits and requests used to restrict or reserve resource usage. :vartype resources: ~azure.mgmt.azurearcdata.models.K8SResourceRequirements @@ -1138,14 +1513,14 @@ class K8SSchedulingOptions(_serialization.Model): def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, resources: Optional["_models.K8SResourceRequirements"] = 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 resources: The kubernetes resource limits and requests used to restrict or reserve resource usage. :paramtype resources: ~azure.mgmt.azurearcdata.models.K8SResourceRequirements @@ -1155,6 +1530,126 @@ def __init__( self.resources = resources +class K8SSecurity(_serialization.Model): + """The kubernetes security information. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar admin_login_secret: Admin login secret key. + :vartype admin_login_secret: str + :ivar service_certificate_secret: Service certificate secret used. + :vartype service_certificate_secret: str + :ivar active_directory: The kubernetes active directory information. + :vartype active_directory: ~azure.mgmt.azurearcdata.models.K8SActiveDirectory + :ivar transparent_data_encryption: Transparent data encryption information. + :vartype transparent_data_encryption: + ~azure.mgmt.azurearcdata.models.K8StransparentDataEncryption + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "admin_login_secret": {"key": "adminLoginSecret", "type": "str"}, + "service_certificate_secret": {"key": "serviceCertificateSecret", "type": "str"}, + "active_directory": {"key": "activeDirectory", "type": "K8SActiveDirectory"}, + "transparent_data_encryption": {"key": "transparentDataEncryption", "type": "K8StransparentDataEncryption"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + admin_login_secret: Optional[str] = None, + service_certificate_secret: Optional[str] = None, + active_directory: Optional["_models.K8SActiveDirectory"] = None, + transparent_data_encryption: Optional["_models.K8StransparentDataEncryption"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword admin_login_secret: Admin login secret key. + :paramtype admin_login_secret: str + :keyword service_certificate_secret: Service certificate secret used. + :paramtype service_certificate_secret: str + :keyword active_directory: The kubernetes active directory information. + :paramtype active_directory: ~azure.mgmt.azurearcdata.models.K8SActiveDirectory + :keyword transparent_data_encryption: Transparent data encryption information. + :paramtype transparent_data_encryption: + ~azure.mgmt.azurearcdata.models.K8StransparentDataEncryption + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.admin_login_secret = admin_login_secret + self.service_certificate_secret = service_certificate_secret + self.active_directory = active_directory + self.transparent_data_encryption = transparent_data_encryption + + +class K8SSettings(_serialization.Model): + """The kubernetes settings information. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar network: The kubernetes network settings information. + :vartype network: ~azure.mgmt.azurearcdata.models.K8SNetworkSettings + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "network": {"key": "network", "type": "K8SNetworkSettings"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + network: Optional["_models.K8SNetworkSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword network: The kubernetes network settings information. + :paramtype network: ~azure.mgmt.azurearcdata.models.K8SNetworkSettings + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.network = network + + +class K8StransparentDataEncryption(_serialization.Model): + """Transparent data encryption information. + + :ivar mode: Transparent data encryption mode. Can be Service Managed, Customer managed or + disabled. + :vartype mode: str + :ivar protector_secret: Protector secret for customer managed Transparent data encryption mode. + :vartype protector_secret: str + """ + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "protector_secret": {"key": "protectorSecret", "type": "str"}, + } + + def __init__(self, *, mode: Optional[str] = None, protector_secret: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword mode: Transparent data encryption mode. Can be Service Managed, Customer managed or + disabled. + :paramtype mode: str + :keyword protector_secret: Protector secret for customer managed Transparent data encryption + mode. + :paramtype protector_secret: str + """ + super().__init__(**kwargs) + self.mode = mode + self.protector_secret = protector_secret + + class KeytabInformation(_serialization.Model): """Keytab used for authenticate with Active Directory. @@ -1166,7 +1661,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 +1684,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 +1728,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 @@ -1268,7 +1763,7 @@ class Operation(_serialization.Model): :ivar is_data_action: Indicates whether the operation is a data action. Required. :vartype is_data_action: bool :ivar properties: Additional descriptions for the operation. - :vartype properties: dict[str, JSON] + :vartype properties: dict[str, any] """ _validation = { @@ -1287,7 +1782,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 +1830,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 +1870,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 +1896,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 +1968,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 +2009,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 +2057,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 +2127,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 +2171,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 +2243,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 +2268,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 +2281,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 """ @@ -1807,7 +2302,7 @@ class SqlManagedInstanceK8SSpec(_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 scheduling: The kubernetes scheduling information. :vartype scheduling: ~azure.mgmt.azurearcdata.models.K8SScheduling :ivar replicas: This option specifies the number of SQL Managed Instance replicas that will be @@ -1815,26 +2310,34 @@ class SqlManagedInstanceK8SSpec(_serialization.Model): BusinessCritical, allowed values are '2' or '3' with default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. :vartype replicas: int + :ivar security: The kubernetes security information. + :vartype security: ~azure.mgmt.azurearcdata.models.K8SSecurity + :ivar settings: The kubernetes settings information. + :vartype settings: ~azure.mgmt.azurearcdata.models.K8SSettings """ _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, "scheduling": {"key": "scheduling", "type": "K8SScheduling"}, "replicas": {"key": "replicas", "type": "int"}, + "security": {"key": "security", "type": "K8SSecurity"}, + "settings": {"key": "settings", "type": "K8SSettings"}, } def __init__( self, *, - additional_properties: Optional[Dict[str, JSON]] = None, + additional_properties: Optional[Dict[str, Any]] = None, scheduling: Optional["_models.K8SScheduling"] = None, replicas: Optional[int] = None, - **kwargs - ): + security: Optional["_models.K8SSecurity"] = None, + settings: Optional["_models.K8SSettings"] = None, + **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 scheduling: The kubernetes scheduling information. :paramtype scheduling: ~azure.mgmt.azurearcdata.models.K8SScheduling :keyword replicas: This option specifies the number of SQL Managed Instance replicas that will @@ -1842,11 +2345,17 @@ def __init__( BusinessCritical, allowed values are '2' or '3' with default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. :paramtype replicas: int + :keyword security: The kubernetes security information. + :paramtype security: ~azure.mgmt.azurearcdata.models.K8SSecurity + :keyword settings: The kubernetes settings information. + :paramtype settings: ~azure.mgmt.azurearcdata.models.K8SSettings """ super().__init__(**kwargs) self.additional_properties = additional_properties self.scheduling = scheduling self.replicas = replicas + self.security = security + self.settings = settings class SqlManagedInstanceListResult(_serialization.Model): @@ -1870,7 +2379,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 +2457,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 +2552,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,13 +2588,327 @@ 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] + """ + super().__init__(**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): @@ -2138,8 +2961,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 +2996,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 +3014,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 +3023,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 +3074,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 +3098,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 +3110,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 +3165,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 +3192,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 +3238,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 +3293,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 +3338,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..9d922bdfde4f 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ 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]] @@ -49,9 +45,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,9 +80,7 @@ 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: str = 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,9 +121,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,9 +159,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -240,9 +228,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActiveDirectoryConnectorListResult] = kwargs.pop("cls", None) error_map = { @@ -296,8 +282,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -333,16 +320,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(active_directory_connector_resource, (IO, bytes)): + if isinstance(active_directory_connector_resource, (IOBase, bytes)): _content = active_directory_connector_resource else: _json = self._serialize.body(active_directory_connector_resource, "ActiveDirectoryConnectorResource") @@ -363,8 +348,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,8 +474,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,9 +498,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -576,9 +560,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -594,8 +576,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,9 +623,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -712,9 +693,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ActiveDirectoryConnectorResource] = kwargs.pop("cls", None) request = build_get_request( @@ -730,8 +709,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..3fa999a3c630 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ 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]] @@ -47,9 +43,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,9 +69,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,9 +99,7 @@ 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: str = 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,9 +133,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,9 +164,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,9 +195,7 @@ 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: str = 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,9 +257,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) error_map = { @@ -327,8 +309,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -362,9 +345,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PageOfDataControllerResource] = kwargs.pop("cls", None) error_map = { @@ -417,8 +398,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -453,16 +435,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.DataControllerResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_controller_resource, (IO, bytes)): + if isinstance(data_controller_resource, (IOBase, bytes)): _content = data_controller_resource else: _json = self._serialize.body(data_controller_resource, "DataControllerResource") @@ -482,8 +462,9 @@ def _put_data_controller_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,7 +573,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,9 +595,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.DataControllerResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -676,9 +656,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_data_controller_request( @@ -693,8 +671,9 @@ def _delete_data_controller_initial( # pylint: disable=inconsistent-return-stat request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -736,9 +715,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -804,9 +781,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataControllerResource] = kwargs.pop("cls", None) request = build_get_data_controller_request( @@ -821,8 +796,9 @@ def get_data_controller( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -861,16 +837,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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[Optional[_models.DataControllerResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(data_controller_resource, (IO, bytes)): + if isinstance(data_controller_resource, (IOBase, bytes)): _content = data_controller_resource else: _json = self._serialize.body(data_controller_resource, "DataControllerUpdate") @@ -890,8 +864,9 @@ def _patch_data_controller_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -998,8 +973,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,9 +995,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.DataControllerResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 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..f4977b5dcf38 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_failover_groups_operations.py @@ -0,0 +1,716 @@ +# 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. +# -------------------------------------------------------------------------- +from io import IOBase +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 + +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: str = 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: str = 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: str = 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: str = 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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, (IOBase, 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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: str = 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 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: str = 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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..2ff2689ff0a5 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 @@ -6,7 +6,6 @@ # 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, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +40,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..1bac766feb73 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ 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]] @@ -47,9 +43,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,9 +69,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,9 +99,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,9 +130,7 @@ 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: str = 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,9 +164,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,9 +195,7 @@ 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: str = 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,9 +256,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -326,8 +308,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,9 +341,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostgresInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -413,8 +394,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -455,9 +437,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PostgresInstance] = kwargs.pop("cls", None) request = build_get_request( @@ -472,8 +452,9 @@ def get(self, resource_group_name: str, postgres_instance_name: str, **kwargs: A request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,16 +493,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.PostgresInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(resource, (IO, bytes)): + if isinstance(resource, (IOBase, bytes)): _content = resource else: _json = self._serialize.body(resource, "PostgresInstance") @@ -541,8 +520,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,7 +631,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,9 +653,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.PostgresInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -735,9 +714,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -752,8 +729,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -793,9 +771,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -903,7 +879,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,16 +901,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.PostgresInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "PostgresInstanceUpdate") @@ -953,8 +928,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..70ebcdfd8859 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ 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]] @@ -47,9 +43,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,9 +69,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,9 +99,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,9 +130,7 @@ 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: str = 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,9 +164,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,9 +195,7 @@ 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: str = 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,9 +256,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -326,8 +308,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,9 +341,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlManagedInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -413,8 +394,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,9 +439,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlManagedInstance] = kwargs.pop("cls", None) request = build_get_request( @@ -474,8 +454,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -514,16 +495,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlManagedInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(sql_managed_instance, (IO, bytes)): + if isinstance(sql_managed_instance, (IOBase, bytes)): _content = sql_managed_instance else: _json = self._serialize.body(sql_managed_instance, "SqlManagedInstance") @@ -543,8 +522,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,7 +634,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,9 +655,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlManagedInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -738,9 +716,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -755,8 +731,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -796,9 +773,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -906,7 +881,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,16 +903,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlManagedInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlManagedInstanceUpdate") @@ -956,8 +930,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..452fcaa94e9b --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_databases_operations.py @@ -0,0 +1,747 @@ +# 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. +# -------------------------------------------------------------------------- +from io import IOBase +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 + +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: str = 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: str = 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: str = 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: str = 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: str = 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: str = 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, (IOBase, 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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, (IOBase, 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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: str = 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + 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..10943aa7a826 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +32,6 @@ 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]] @@ -47,9 +43,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,9 +69,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,9 +99,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,9 +130,7 @@ 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: str = 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,9 +164,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-15-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -209,9 +195,7 @@ 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: str = 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,9 +256,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -326,8 +308,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,9 +341,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlServerInstanceListResult] = kwargs.pop("cls", None) error_map = { @@ -413,8 +394,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -455,9 +437,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SqlServerInstance] = kwargs.pop("cls", None) request = build_get_request( @@ -472,8 +452,9 @@ def get(self, resource_group_name: str, sql_server_instance_name: str, **kwargs: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,16 +493,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlServerInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(sql_server_instance, (IO, bytes)): + if isinstance(sql_server_instance, (IOBase, bytes)): _content = sql_server_instance else: _json = self._serialize.body(sql_server_instance, "SqlServerInstance") @@ -541,8 +520,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -651,8 +631,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,9 +653,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlServerInstance] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -736,9 +714,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -753,8 +729,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -794,9 +771,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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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) @@ -904,7 +879,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,16 +901,14 @@ 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", _params.pop("api-version", self._config.api_version) - ) + api_version: str = 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.SqlServerInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IO, bytes)): + if isinstance(parameters, (IOBase, bytes)): _content = parameters else: _json = self._serialize.body(parameters, "SqlServerInstanceUpdate") @@ -954,8 +928,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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..b1bd99786063 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 @@ -57,6 +57,24 @@ def main(): } } }, + "security": { + "activeDirectory": { + "accountName": "Account name", + "connector": {"name": "Name of connector", "namespace": "Namespace of connector"}, + "encryptionTypes": ["Encryption type item1, Encryption type item2,..."], + "keytabSecret": "Key tab secret of account", + }, + "adminLoginSecret": "test-sql-login-secret", + "serviceCertificateSecret": "Service Certificate Secret", + "transparentDataEncryption": {"mode": "SystemManaged"}, + }, + "settings": { + "network": { + "forceencryption": 0, + "tlsciphers": "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384", + "tlsprotocols": "1.2", + } + }, }, }, "licenseType": "LicenseIncluded", @@ -69,6 +87,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..909e507eddaf 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 @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.active_directory_connectors.begin_delete( + client.active_directory_connectors.begin_delete( resource_group_name="testrg", data_controller_name="testdataController", active_directory_connector_name="testADConnector", ).result() - 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..56a24a60d945 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_arc_sql_server_database.py @@ -0,0 +1,41 @@ +# 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", + ) + + client.sql_server_databases.delete( + resource_group_name="testrg", + sql_server_instance_name="testsqlManagedInstance", + database_name="testdb", + ) + + +# 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..77bb02315918 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 @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.data_controllers.begin_delete_data_controller( + client.data_controllers.begin_delete_data_controller( resource_group_name="testrg", data_controller_name="testdataController", ).result() - 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..199915ae089e --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/generated_samples/delete_failover_group.py @@ -0,0 +1,41 @@ +# 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", + ) + + client.failover_groups.begin_delete( + resource_group_name="testrg", + sql_managed_instance_name="testSqlManagedInstance", + failover_group_name="testFailoverGroupName", + ).result() + + +# 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..2a894f2f5724 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 @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.postgres_instances.begin_delete( + client.postgres_instances.begin_delete( resource_group_name="testrg", postgres_instance_name="testpostgresInstance", ).result() - 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..5cae46617bf0 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 @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.sql_managed_instances.begin_delete( + client.sql_managed_instances.begin_delete( resource_group_name="testrg", sql_managed_instance_name="testsqlManagedInstance", ).result() - 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..44a1cb3b92bf 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 @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-1111-2222-3333-444444444444", ) - response = client.sql_server_instances.begin_delete( + client.sql_server_instances.begin_delete( resource_group_name="testrg", sql_server_instance_name="testsqlServerInstance", ).result() - 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()