diff --git a/sdk/signalr/azure-mgmt-signalr/_meta.json b/sdk/signalr/azure-mgmt-signalr/_meta.json index 1365e413a3f3..52c889535594 100644 --- a/sdk/signalr/azure-mgmt-signalr/_meta.json +++ b/sdk/signalr/azure-mgmt-signalr/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f6d16956a7d5b75e125a88d81d7bc9b6fecfd41a", + "commit": "e4f05ae0d0ec8fd2258803174f88602cd6ad31cb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.4.0", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/signalr/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.4.0 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/signalr/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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/signalr/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py index d254ddb31da8..2ff46ccc038c 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_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 @@ -33,17 +27,16 @@ class SignalRManagementClientConfiguration(Configuration): # pylint: disable=to :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-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(SignalRManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", "2023-02-01") + api_version: str = kwargs.pop("api_version", "2023-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_serialization.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_serialization.py index f17c068e833e..4bae2292227b 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_serialization.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_serialization.py @@ -629,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): @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1271,7 +1281,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 @@ -1295,7 +1305,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): diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py index c84635ca0b59..c7173fa40d2d 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py @@ -22,6 +22,7 @@ SignalROperations, SignalRPrivateEndpointConnectionsOperations, SignalRPrivateLinkResourcesOperations, + SignalRReplicasOperations, SignalRSharedPrivateLinkResourcesOperations, UsagesOperations, ) @@ -52,19 +53,20 @@ class SignalRManagementClient: # pylint: disable=client-accepts-api-version-key :ivar signal_rprivate_link_resources: SignalRPrivateLinkResourcesOperations operations :vartype signal_rprivate_link_resources: azure.mgmt.signalr.operations.SignalRPrivateLinkResourcesOperations + :ivar signal_rreplicas: SignalRReplicasOperations operations + :vartype signal_rreplicas: azure.mgmt.signalr.operations.SignalRReplicasOperations :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations operations :vartype signal_rshared_private_link_resources: azure.mgmt.signalr.operations.SignalRSharedPrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-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 Retry-After header is present. @@ -80,7 +82,7 @@ def __init__( self._config = SignalRManagementClientConfiguration( 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) @@ -101,6 +103,9 @@ def __init__( self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.signal_rreplicas = SignalRReplicasOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py index bd0df84f5319..0dafe0e287ff 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_vendor.py @@ -5,8 +5,6 @@ # 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 @@ -16,15 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py index dbf4c577231c..e5754a47ce68 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.2.0" +VERSION = "1.0.0b1" diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py index 2ddd31e6ad1b..0dc64cb72302 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_configuration.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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 @@ -33,17 +27,16 @@ class SignalRManagementClientConfiguration(Configuration): # pylint: disable=to :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-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(SignalRManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", "2023-02-01") + api_version: str = kwargs.pop("api_version", "2023-08-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py index 52e3c3987a10..569ddba1f4b7 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/_signal_rmanagement_client.py @@ -22,6 +22,7 @@ SignalROperations, SignalRPrivateEndpointConnectionsOperations, SignalRPrivateLinkResourcesOperations, + SignalRReplicasOperations, SignalRSharedPrivateLinkResourcesOperations, UsagesOperations, ) @@ -53,19 +54,20 @@ class SignalRManagementClient: # pylint: disable=client-accepts-api-version-key :ivar signal_rprivate_link_resources: SignalRPrivateLinkResourcesOperations operations :vartype signal_rprivate_link_resources: azure.mgmt.signalr.aio.operations.SignalRPrivateLinkResourcesOperations + :ivar signal_rreplicas: SignalRReplicasOperations operations + :vartype signal_rreplicas: azure.mgmt.signalr.aio.operations.SignalRReplicasOperations :ivar signal_rshared_private_link_resources: SignalRSharedPrivateLinkResourcesOperations operations :vartype signal_rshared_private_link_resources: azure.mgmt.signalr.aio.operations.SignalRSharedPrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. 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 "2023-02-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-08-01-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 Retry-After header is present. @@ -81,7 +83,7 @@ def __init__( self._config = SignalRManagementClientConfiguration( 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) @@ -102,6 +104,9 @@ def __init__( self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.signal_rreplicas = SignalRReplicasOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.signal_rshared_private_link_resources = SignalRSharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py index 336c42dd5325..e15b22bc07ac 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/__init__.py @@ -13,6 +13,7 @@ from ._signal_rcustom_domains_operations import SignalRCustomDomainsOperations from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations +from ._signal_rreplicas_operations import SignalRReplicasOperations from ._signal_rshared_private_link_resources_operations import SignalRSharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all @@ -27,6 +28,7 @@ "SignalRCustomDomainsOperations", "SignalRPrivateEndpointConnectionsOperations", "SignalRPrivateLinkResourcesOperations", + "SignalRReplicasOperations", "SignalRSharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_operations.py index c74a7d8cfeaa..0bc414843400 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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["2023-02-01"] = 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.OperationList] = 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_operations.py index 875ec7a8dde3..09caf728ef87 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_r_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 @@ -39,16 +39,13 @@ build_list_by_resource_group_request, build_list_by_subscription_request, build_list_keys_request, + build_list_replica_skus_request, build_list_skus_request, build_regenerate_key_request, build_restart_request, build_update_request, ) -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -145,16 +142,14 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.NameAvailability] = 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, "NameAvailabilityParameters") @@ -173,8 +168,9 @@ async def check_name_availability( 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 @@ -207,9 +203,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SignalRR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResourceList] = kwargs.pop("cls", None) error_map = { @@ -261,8 +255,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 @@ -285,8 +280,8 @@ def list_by_resource_group( ) -> AsyncIterable["_models.SignalRResource"]: """Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SignalRResource or the result of cls(response) @@ -296,9 +291,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResourceList] = kwargs.pop("cls", None) error_map = { @@ -351,8 +344,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 @@ -373,8 +367,8 @@ async def get_next(next_link=None): async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.SignalRResource: """Get the resource and its properties. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -394,9 +388,7 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource] = kwargs.pop("cls", None) request = build_get_request( @@ -411,8 +403,9 @@ async def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) 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 @@ -451,16 +444,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource]] = 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, "SignalRResource") @@ -480,8 +471,9 @@ async def _create_or_update_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 @@ -519,8 +511,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.SignalRResource]: """Create or update a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -555,8 +547,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.SignalRResource]: """Create or update a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -589,8 +581,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.SignalRResource]: """Create or update a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -616,9 +608,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -645,7 +635,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -677,9 +670,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["2023-02-01"] = 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( @@ -694,8 +685,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 @@ -716,8 +708,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements async def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Operation to delete a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -736,9 +728,7 @@ async def begin_delete(self, resource_group_name: str, resource_name: str, **kwa _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) @@ -798,16 +788,14 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource]] = 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, "SignalRResource") @@ -827,8 +815,9 @@ async def _update_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 @@ -839,11 +828,15 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SignalRResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -863,8 +856,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.SignalRResource]: """Operation to update an exiting resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -899,8 +892,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.SignalRResource]: """Operation to update an exiting resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -933,8 +926,8 @@ async def begin_update( ) -> AsyncLROPoller[_models.SignalRResource]: """Operation to update an exiting resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -960,9 +953,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -989,7 +980,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1011,8 +1004,8 @@ def get_long_running_output(pipeline_response): async def list_keys(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.SignalRKeys: """Get the access keys of the resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1032,9 +1025,7 @@ async def list_keys(self, resource_group_name: str, resource_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRKeys] = kwargs.pop("cls", None) request = build_list_keys_request( @@ -1049,8 +1040,9 @@ async def list_keys(self, resource_group_name: str, resource_name: str, **kwargs 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 @@ -1089,16 +1081,14 @@ async def _regenerate_key_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRKeys] = 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, "RegenerateKeyParameters") @@ -1118,23 +1108,31 @@ async def _regenerate_key_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 - if response.status_code not in [202]: + if response.status_code not in [200, 202]: 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("SignalRKeys", pipeline_response) + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("SignalRKeys", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SignalRKeys", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore _regenerate_key_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey" @@ -1153,8 +1151,8 @@ async def begin_regenerate_key( """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1190,8 +1188,8 @@ async def begin_regenerate_key( """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1225,8 +1223,8 @@ async def begin_regenerate_key( """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1252,9 +1250,7 @@ async def begin_regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRKeys] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1282,8 +1278,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -1302,6 +1297,74 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey" } + @distributed_trace_async + async def list_replica_skus( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> _models.SkuList: + """List all available skus of the replica resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuList or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SkuList + :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.SkuList] = kwargs.pop("cls", None) + + request = build_list_replica_skus_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_replica_skus.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("SkuList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_replica_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/skus" + } + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: @@ -1316,9 +1379,7 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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_restart_request( @@ -1333,8 +1394,9 @@ async def _restart_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 @@ -1344,8 +1406,12 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart" @@ -1355,8 +1421,8 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements async def begin_restart(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Operation to restart a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1375,9 +1441,7 @@ async def begin_restart(self, resource_group_name: str, resource_name: str, **kw _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) @@ -1400,8 +1464,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) @@ -1424,8 +1487,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def list_skus(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.SkuList: """List all available skus of the resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1445,9 +1508,7 @@ async def list_skus(self, resource_group_name: str, resource_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SkuList] = kwargs.pop("cls", None) request = build_list_skus_request( @@ -1462,8 +1523,9 @@ async def list_skus(self, resource_group_name: str, resource_name: str, **kwargs 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_certificates_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_certificates_operations.py index 1e6cfcba8eae..d3b53c5c1824 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_certificates_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_certificates_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]] @@ -71,8 +67,8 @@ def list( ) -> AsyncIterable["_models.CustomCertificate"]: """List all custom certificates. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -84,9 +80,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificateList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +134,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 @@ -164,8 +159,8 @@ async def get( ) -> _models.CustomCertificate: """Get a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -187,9 +182,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificate] = kwargs.pop("cls", None) request = build_get_request( @@ -205,8 +198,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 @@ -246,16 +240,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificate] = 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, "CustomCertificate") @@ -276,8 +268,9 @@ async def _create_or_update_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 @@ -315,8 +308,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomCertificate]: """Create or update a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -354,8 +347,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomCertificate]: """Create or update a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -391,8 +384,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomCertificate]: """Create or update a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -419,9 +412,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificate] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -449,7 +440,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -473,8 +467,8 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -496,9 +490,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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( @@ -514,8 +506,9 @@ async def delete( # 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 diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_domains_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_domains_operations.py index bbf80c7c31f7..8ed93026b225 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_domains_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rcustom_domains_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]] @@ -71,8 +67,8 @@ def list( ) -> AsyncIterable["_models.CustomDomain"]: """List all custom domains. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -84,9 +80,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomainList] = kwargs.pop("cls", None) error_map = { @@ -140,8 +134,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 @@ -162,8 +157,8 @@ async def get_next(next_link=None): async def get(self, resource_group_name: str, resource_name: str, name: str, **kwargs: Any) -> _models.CustomDomain: """Get a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -185,9 +180,7 @@ async def get(self, resource_group_name: str, resource_name: str, name: str, **k _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomain] = kwargs.pop("cls", None) request = build_get_request( @@ -203,8 +196,9 @@ async def get(self, resource_group_name: str, resource_name: str, name: str, **k 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 @@ -244,16 +238,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomain] = 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, "CustomDomain") @@ -274,8 +266,9 @@ async def _create_or_update_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 @@ -309,8 +302,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomDomain]: """Create or update a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -348,8 +341,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomDomain]: """Create or update a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -385,8 +378,8 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.CustomDomain]: """Create or update a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -413,9 +406,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomain] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -443,7 +434,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -475,9 +469,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["2023-02-01"] = 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( @@ -493,8 +485,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 @@ -517,8 +510,8 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -539,9 +532,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_operations.py index 183ecd512d4b..1dd1c28a0327 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_endpoint_connections_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_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]] @@ -71,8 +67,8 @@ def list( ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """List private endpoint connections. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -86,9 +82,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateEndpointConnectionList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +136,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 @@ -166,10 +161,11 @@ async def get( ) -> _models.PrivateEndpointConnection: """Get the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -189,9 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -207,8 +201,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 @@ -242,10 +237,11 @@ async def update( ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -273,10 +269,11 @@ async def update( ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -302,10 +299,11 @@ async def update( ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -331,16 +329,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateEndpointConnection] = 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, "PrivateEndpointConnection") @@ -361,8 +357,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 @@ -397,9 +394,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["2023-02-01"] = 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( @@ -415,8 +410,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 @@ -439,10 +435,11 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -461,9 +458,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_operations.py index e6661c1a5e64..32214e77a57e 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rprivate_link_resources_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._signal_rprivate_link_resources_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]] @@ -63,8 +58,8 @@ def list( ) -> AsyncIterable["_models.PrivateLinkResource"]: """Get the private link resources that need to be created for a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -76,9 +71,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateLinkResourceList] = kwargs.pop("cls", None) error_map = { @@ -132,8 +125,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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplicas_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplicas_operations.py new file mode 100644 index 000000000000..24aa2cadfd49 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rreplicas_operations.py @@ -0,0 +1,894 @@ +# 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._signal_rreplicas_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_restart_request, + build_update_request, +) + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SignalRReplicasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.signalr.aio.SignalRManagementClient`'s + :attr:`signal_rreplicas` 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, resource_name: str, **kwargs: Any) -> AsyncIterable["_models.Replica"]: + """List all replicas belong to this resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Replica or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.signalr.models.Replica] + :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.ReplicaList] = 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, + resource_name=resource_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("ReplicaList", 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.SignalRService/signalR/{resourceName}/replicas" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> _models.Replica: + """Get the replica and its properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replica or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.Replica + :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.Replica] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_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("Replica", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> _models.Replica: + 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.Replica] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Replica") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_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("Replica", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Replica", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: _models.Replica, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Create or update a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: ~azure.mgmt.signalr.models.Replica + :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 Replica or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Create or update a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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 Replica or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Create or update a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the create or update operation. Is either a Replica type or a + IO type. Required. + :type parameters: ~azure.mgmt.signalr.models.Replica or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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 Replica or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.Replica] + :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.Replica] = 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_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + parameters=parameters, + 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("Replica", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> None: + """Operation to delete a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_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, + resource_name=resource_name, + replica_name=replica_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.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> _models.Replica: + 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.Replica] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Replica") + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Replica", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("Replica", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: _models.Replica, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Operation to update an exiting replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the update operation. Required. + :type parameters: ~azure.mgmt.signalr.models.Replica + :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 Replica or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Operation to update an exiting replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the update operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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 Replica or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> AsyncLROPoller[_models.Replica]: + """Operation to update an exiting replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the update operation. Is either a Replica type or a IO type. + Required. + :type parameters: ~azure.mgmt.signalr.models.Replica or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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 Replica or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.signalr.models.Replica] + :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.Replica] = 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + parameters=parameters, + 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("Replica", 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": "location"}, **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_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, replica_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_restart_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restart_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 [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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart" + } + + @distributed_trace_async + async def begin_restart( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to restart a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_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._restart_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_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, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.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_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart" + } diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py index e68b0a036e42..097819335c21 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_signal_rshared_private_link_resources_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]] @@ -71,8 +67,8 @@ def list( ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: """List shared private link resources. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -86,9 +82,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResourceList] = kwargs.pop("cls", None) error_map = { @@ -142,8 +136,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 @@ -169,8 +164,8 @@ async def get( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -190,9 +185,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( @@ -208,8 +201,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 @@ -249,16 +243,14 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResource] = 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, "SharedPrivateLinkResource") @@ -279,8 +271,9 @@ async def _create_or_update_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 @@ -321,8 +314,8 @@ async def begin_create_or_update( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -362,8 +355,8 @@ async def begin_create_or_update( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -401,8 +394,8 @@ async def begin_create_or_update( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -429,9 +422,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -459,7 +450,10 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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: @@ -491,9 +485,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["2023-02-01"] = 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( @@ -509,8 +501,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 @@ -536,8 +529,8 @@ async def begin_delete( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -556,9 +549,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_operations.py index 7c877716f741..d3bc85e39902 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/aio/operations/_usages_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._usages_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]] @@ -71,9 +66,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.SignalRUs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRUsageList] = kwargs.pop("cls", None) error_map = { @@ -126,8 +119,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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py index d485335cb818..13eac9151693 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py @@ -14,6 +14,7 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse +from ._models_py3 import IPRule from ._models_py3 import LiveTraceCategory from ._models_py3 import LiveTraceConfiguration from ._models_py3 import LogSpecification @@ -36,6 +37,8 @@ from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import RegenerateKeyParameters +from ._models_py3 import Replica +from ._models_py3 import ReplicaList from ._models_py3 import Resource from ._models_py3 import ResourceLogCategory from ._models_py3 import ResourceLogConfiguration @@ -93,6 +96,7 @@ "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", + "IPRule", "LiveTraceCategory", "LiveTraceConfiguration", "LogSpecification", @@ -115,6 +119,8 @@ "PrivateLinkServiceConnectionState", "ProxyResource", "RegenerateKeyParameters", + "Replica", + "ReplicaList", "Resource", "ResourceLogCategory", "ResourceLogConfiguration", diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py index 54917cf5170f..c6b07d939cc1 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py @@ -18,28 +18,35 @@ class Resource(_serialization.Model): - """The core properties of ARM resources. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :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.signalr.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__(self, **kwargs: Any) -> None: @@ -48,32 +55,40 @@ def __init__(self, **kwargs: Any) -> None: self.id = None self.name = None self.type = None + self.system_data = None class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than - required location and tags. + """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. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :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.signalr.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } def __init__(self, **kwargs: Any) -> None: @@ -88,13 +103,16 @@ class CustomCertificate(ProxyResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Known values are: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", and "Moving". @@ -145,7 +163,6 @@ def __init__( :paramtype key_vault_secret_version: str """ super().__init__(**kwargs) - self.system_data = None self.provisioning_state = None self.key_vault_base_uri = key_vault_base_uri self.key_vault_secret_name = key_vault_secret_name @@ -194,13 +211,16 @@ class CustomDomain(ProxyResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Known values are: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", and "Moving". @@ -239,7 +259,6 @@ def __init__(self, *, domain_name: str, custom_certificate: "_models.ResourceRef :paramtype custom_certificate: ~azure.mgmt.signalr.models.ResourceReference """ super().__init__(**kwargs) - self.system_data = None self.provisioning_state = None self.domain_name = domain_name self.custom_certificate = custom_certificate @@ -416,6 +435,34 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class IPRule(_serialization.Model): + """An IP rule. + + :ivar value: An IP or CIDR or ServiceTag. + :vartype value: str + :ivar action: Azure Networking ACL Action. Known values are: "Allow" and "Deny". + :vartype action: str or ~azure.mgmt.signalr.models.ACLAction + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "action": {"key": "action", "type": "str"}, + } + + def __init__( + self, *, value: Optional[str] = None, action: Optional[Union[str, "_models.ACLAction"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: An IP or CIDR or ServiceTag. + :paramtype value: str + :keyword action: Azure Networking ACL Action. Known values are: "Allow" and "Deny". + :paramtype action: str or ~azure.mgmt.signalr.models.ACLAction + """ + super().__init__(**kwargs) + self.value = value + self.action = action + + class LiveTraceCategory(_serialization.Model): """Live trace category configuration of a Microsoft.SignalRService resource. @@ -722,8 +769,9 @@ class NameAvailabilityParameters(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: The resource type. Can be "Microsoft.SignalRService/SignalR" or - "Microsoft.SignalRService/webPubSub". Required. + :ivar type: The resource type. Can be "Microsoft.SignalRService/SignalR", + "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" or + "Microsoft.SignalRService/WebPubSub/replicas". Required. :vartype type: str :ivar name: The resource name to validate. e.g."my-resource-name". Required. :vartype name: str @@ -741,8 +789,9 @@ class NameAvailabilityParameters(_serialization.Model): def __init__(self, *, type: str, name: str, **kwargs: Any) -> None: """ - :keyword type: The resource type. Can be "Microsoft.SignalRService/SignalR" or - "Microsoft.SignalRService/webPubSub". Required. + :keyword type: The resource type. Can be "Microsoft.SignalRService/SignalR", + "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" or + "Microsoft.SignalRService/WebPubSub/replicas". Required. :paramtype type: str :keyword name: The resource name to validate. e.g."my-resource-name". Required. :paramtype name: str @@ -1014,13 +1063,16 @@ class PrivateEndpointConnection(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Known values are: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", and "Moving". @@ -1074,7 +1126,6 @@ def __init__( ~azure.mgmt.signalr.models.PrivateLinkServiceConnectionState """ super().__init__(**kwargs) - self.system_data = None self.provisioning_state = None self.private_endpoint = private_endpoint self.group_ids = None @@ -1122,12 +1173,17 @@ class PrivateLinkResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :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.signalr.models.SystemData :ivar group_id: Group Id of the private link resource. :vartype group_id: str :ivar required_members: Required members of the private link resource. @@ -1144,12 +1200,14 @@ class PrivateLinkResource(ProxyResource): "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "group_id": {"key": "properties.groupId", "type": "str"}, "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, @@ -1286,6 +1344,184 @@ def __init__(self, *, key_type: Optional[Union[str, "_models.KeyType"]] = None, self.key_type = key_type +class TrackedResource(Resource): + """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. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.signalr.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"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"}, + } + + def __init__(self, *, location: str, 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 + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class Replica(TrackedResource): + """A class represent a replica 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. E.g. + "/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.signalr.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 sku: The billing information of the resource. + :vartype sku: ~azure.mgmt.signalr.models.ResourceSku + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Unknown", + "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", and "Moving". + :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState + :ivar region_endpoint_enabled: Enable or disable the regional endpoint. Default to "Enabled". + When it's Disabled, new connections will not be routed to this endpoint, however existing + connections will not be affected. + :vartype region_endpoint_enabled: str + :ivar resource_stopped: Stop or start the resource. Default to "false". + When it's true, the data plane of the resource is shutdown. + When it's false, the data plane of the resource is started. + :vartype resource_stopped: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "provisioning_state": {"readonly": 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"}, + "sku": {"key": "sku", "type": "ResourceSku"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "region_endpoint_enabled": {"key": "properties.regionEndpointEnabled", "type": "str"}, + "resource_stopped": {"key": "properties.resourceStopped", "type": "str"}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.ResourceSku"] = None, + region_endpoint_enabled: str = "Enabled", + resource_stopped: str = "false", + **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 sku: The billing information of the resource. + :paramtype sku: ~azure.mgmt.signalr.models.ResourceSku + :keyword region_endpoint_enabled: Enable or disable the regional endpoint. Default to + "Enabled". + When it's Disabled, new connections will not be routed to this endpoint, however existing + connections will not be affected. + :paramtype region_endpoint_enabled: str + :keyword resource_stopped: Stop or start the resource. Default to "false". + When it's true, the data plane of the resource is shutdown. + When it's false, the data plane of the resource is started. + :paramtype resource_stopped: str + """ + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.provisioning_state = None + self.region_endpoint_enabled = region_endpoint_enabled + self.resource_stopped = resource_stopped + + +class ReplicaList(_serialization.Model): + """ReplicaList. + + :ivar value: List of the replica. + :vartype value: list[~azure.mgmt.signalr.models.Replica] + :ivar next_link: The URL the client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Replica]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Replica"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of the replica. + :paramtype value: list[~azure.mgmt.signalr.models.Replica] + :keyword next_link: The URL the client should use to fetch the next page (per server side + paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class ResourceLogCategory(_serialization.Model): """Resource log category configuration of a Microsoft.SignalRService resource. @@ -1621,13 +1857,16 @@ class SharedPrivateLinkResource(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar group_id: The group id from the provider of resource the shared private link resource is for. @@ -1687,7 +1926,6 @@ def __init__( :paramtype request_message: str """ super().__init__(**kwargs) - self.system_data = None self.group_id = group_id self.private_link_resource_id = private_link_resource_id self.provisioning_state = None @@ -1890,12 +2128,19 @@ class SignalRNetworkACLs(_serialization.Model): :vartype public_network: ~azure.mgmt.signalr.models.NetworkACL :ivar private_endpoints: ACLs for requests from private endpoints. :vartype private_endpoints: list[~azure.mgmt.signalr.models.PrivateEndpointACL] + :ivar ip_rules: IP rules for filtering public traffic. + :vartype ip_rules: list[~azure.mgmt.signalr.models.IPRule] """ + _validation = { + "ip_rules": {"max_items": 30, "min_items": 0}, + } + _attribute_map = { "default_action": {"key": "defaultAction", "type": "str"}, "public_network": {"key": "publicNetwork", "type": "NetworkACL"}, "private_endpoints": {"key": "privateEndpoints", "type": "[PrivateEndpointACL]"}, + "ip_rules": {"key": "ipRules", "type": "[IPRule]"}, } def __init__( @@ -1904,6 +2149,7 @@ def __init__( default_action: Optional[Union[str, "_models.ACLAction"]] = None, public_network: Optional["_models.NetworkACL"] = None, private_endpoints: Optional[List["_models.PrivateEndpointACL"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, **kwargs: Any ) -> None: """ @@ -1913,57 +2159,14 @@ def __init__( :paramtype public_network: ~azure.mgmt.signalr.models.NetworkACL :keyword private_endpoints: ACLs for requests from private endpoints. :paramtype private_endpoints: list[~azure.mgmt.signalr.models.PrivateEndpointACL] + :keyword ip_rules: IP rules for filtering public traffic. + :paramtype ip_rules: list[~azure.mgmt.signalr.models.IPRule] """ super().__init__(**kwargs) self.default_action = default_action self.public_network = public_network self.private_endpoints = private_endpoints - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource - e.g. "Microsoft.SignalRService/SignalR". - :vartype type: str - :ivar location: The GEO location of the resource. e.g. West US | East US | North Central US | - South Central US. - :vartype location: str - :ivar tags: Tags of the service which is a list of key value pairs that describe the resource. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: The GEO location of the resource. e.g. West US | East US | North Central US - | South Central US. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.location = location - self.tags = tags + self.ip_rules = ip_rules class SignalRResource(TrackedResource): # pylint: disable=too-many-instance-attributes @@ -1971,26 +2174,29 @@ class SignalRResource(TrackedResource): # pylint: disable=too-many-instance-att Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/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.SignalRService/SignalR". + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The GEO location of the resource. e.g. West US | East US | North Central US | - South Central US. - :vartype location: str - :ivar tags: Tags of the service which is a list of key value pairs that describe the resource. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.signalr.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 sku: The billing information of the resource. :vartype sku: ~azure.mgmt.signalr.models.ResourceSku - :ivar kind: The kind of the service, it can be SignalR or RawWebSockets. Known values are: - "SignalR" and "RawWebSockets". + :ivar kind: The kind of the service. Known values are: "SignalR" and "RawWebSockets". :vartype kind: str or ~azure.mgmt.signalr.models.ServiceKind :ivar identity: A class represent managed identities used for request and response. :vartype identity: ~azure.mgmt.signalr.models.ManagedIdentity - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.signalr.models.SystemData :ivar provisioning_state: Provisioning state of the resource. Known values are: "Unknown", "Succeeded", "Failed", "Canceled", "Running", "Creating", "Updating", "Deleting", and "Moving". :vartype provisioning_state: str or ~azure.mgmt.signalr.models.ProvisioningState @@ -2053,6 +2259,16 @@ class SignalRResource(TrackedResource): # pylint: disable=too-many-instance-att Enable or disable aad auth When set as true, connection with AuthType=aad won't work. :vartype disable_aad_auth: bool + :ivar region_endpoint_enabled: Enable or disable the regional endpoint. Default to "Enabled". + When it's Disabled, new connections will not be routed to this endpoint, however existing + connections will not be affected. + This property is replica specific. Disable the regional endpoint without replica is not + allowed. + :vartype region_endpoint_enabled: str + :ivar resource_stopped: Stop or start the resource. Default to "False". + When it's true, the data plane of the resource is shutdown. + When it's false, the data plane of the resource is started. + :vartype resource_stopped: str """ _validation = { @@ -2060,6 +2276,7 @@ class SignalRResource(TrackedResource): # pylint: disable=too-many-instance-att "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "location": {"required": True}, "provisioning_state": {"readonly": True}, "external_ip": {"readonly": True}, "host_name": {"readonly": True}, @@ -2075,12 +2292,12 @@ class SignalRResource(TrackedResource): # pylint: disable=too-many-instance-att "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, "sku": {"key": "sku", "type": "ResourceSku"}, "kind": {"key": "kind", "type": "str"}, "identity": {"key": "identity", "type": "ManagedIdentity"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "external_ip": {"key": "properties.externalIP", "type": "str"}, "host_name": {"key": "properties.hostName", "type": "str"}, @@ -2110,12 +2327,14 @@ class SignalRResource(TrackedResource): # pylint: disable=too-many-instance-att "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, "disable_aad_auth": {"key": "properties.disableAadAuth", "type": "bool"}, + "region_endpoint_enabled": {"key": "properties.regionEndpointEnabled", "type": "str"}, + "resource_stopped": {"key": "properties.resourceStopped", "type": "str"}, } def __init__( # pylint: disable=too-many-locals self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.ResourceSku"] = None, kind: Optional[Union[str, "_models.ServiceKind"]] = None, @@ -2131,19 +2350,18 @@ def __init__( # pylint: disable=too-many-locals public_network_access: str = "Enabled", disable_local_auth: bool = False, disable_aad_auth: bool = False, + region_endpoint_enabled: str = "Enabled", + resource_stopped: str = "false", **kwargs: Any ) -> None: """ - :keyword location: The GEO location of the resource. e.g. West US | East US | North Central US - | South Central US. - :paramtype location: str - :keyword tags: Tags of the service which is a list of key value pairs that describe the - resource. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str :keyword sku: The billing information of the resource. :paramtype sku: ~azure.mgmt.signalr.models.ResourceSku - :keyword kind: The kind of the service, it can be SignalR or RawWebSockets. Known values are: - "SignalR" and "RawWebSockets". + :keyword kind: The kind of the service. Known values are: "SignalR" and "RawWebSockets". :paramtype kind: str or ~azure.mgmt.signalr.models.ServiceKind :keyword identity: A class represent managed identities used for request and response. :paramtype identity: ~azure.mgmt.signalr.models.ManagedIdentity @@ -2185,12 +2403,22 @@ def __init__( # pylint: disable=too-many-locals Enable or disable aad auth When set as true, connection with AuthType=aad won't work. :paramtype disable_aad_auth: bool - """ - super().__init__(location=location, tags=tags, **kwargs) + :keyword region_endpoint_enabled: Enable or disable the regional endpoint. Default to + "Enabled". + When it's Disabled, new connections will not be routed to this endpoint, however existing + connections will not be affected. + This property is replica specific. Disable the regional endpoint without replica is not + allowed. + :paramtype region_endpoint_enabled: str + :keyword resource_stopped: Stop or start the resource. Default to "False". + When it's true, the data plane of the resource is shutdown. + When it's false, the data plane of the resource is started. + :paramtype resource_stopped: str + """ + super().__init__(tags=tags, location=location, **kwargs) self.sku = sku self.kind = kind self.identity = identity - self.system_data = None self.provisioning_state = None self.external_ip = None self.host_name = None @@ -2211,6 +2439,8 @@ def __init__( # pylint: disable=too-many-locals self.public_network_access = public_network_access self.disable_local_auth = disable_local_auth self.disable_aad_auth = disable_aad_auth + self.region_endpoint_enabled = region_endpoint_enabled + self.resource_stopped = resource_stopped class SignalRResourceList(_serialization.Model): @@ -2247,7 +2477,8 @@ def __init__( class SignalRTlsSettings(_serialization.Model): """TLS settings for the resource. - :ivar client_cert_enabled: Request client certificate during TLS handshake if enabled. + :ivar client_cert_enabled: Request client certificate during TLS handshake if enabled. Not + supported for free tier. Any input will be ignored for free tier. :vartype client_cert_enabled: bool """ @@ -2255,9 +2486,10 @@ class SignalRTlsSettings(_serialization.Model): "client_cert_enabled": {"key": "clientCertEnabled", "type": "bool"}, } - def __init__(self, *, client_cert_enabled: bool = True, **kwargs: Any) -> None: + def __init__(self, *, client_cert_enabled: bool = False, **kwargs: Any) -> None: """ - :keyword client_cert_enabled: Request client certificate during TLS handshake if enabled. + :keyword client_cert_enabled: Request client certificate during TLS handshake if enabled. Not + supported for free tier. Any input will be ignored for free tier. :paramtype client_cert_enabled: bool """ super().__init__(**kwargs) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py index 08ca30eb6629..9a33fb791794 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py @@ -101,7 +101,7 @@ class ScaleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ServiceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The kind of the service, it can be SignalR or RawWebSockets.""" + """The kind of the service.""" SIGNAL_R = "SignalR" RAW_WEB_SOCKETS = "RawWebSockets" diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py index 336c42dd5325..e15b22bc07ac 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py @@ -13,6 +13,7 @@ from ._signal_rcustom_domains_operations import SignalRCustomDomainsOperations from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations +from ._signal_rreplicas_operations import SignalRReplicasOperations from ._signal_rshared_private_link_resources_operations import SignalRSharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all @@ -27,6 +28,7 @@ "SignalRCustomDomainsOperations", "SignalRPrivateEndpointConnectionsOperations", "SignalRPrivateLinkResourcesOperations", + "SignalRReplicasOperations", "SignalRSharedPrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py index 26aec525498b..95ca3c13e0da 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/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,7 +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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,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["2023-02-01"] = 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.OperationList] = kwargs.pop("cls", None) error_map = { @@ -144,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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py index 0fd4e694d06a..c9e4108a6c81 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_r_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 @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -47,7 +43,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -61,7 +57,7 @@ def build_check_name_availability_request(location: str, subscription_id: str, * "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -78,7 +74,7 @@ def build_list_by_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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +83,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -102,7 +98,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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,10 +108,12 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ) # 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"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -130,7 +128,7 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,11 +138,20 @@ def build_get_request(resource_group_name: str, resource_name: str, subscription ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -161,7 +168,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,11 +179,20 @@ def build_create_or_update_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -195,7 +211,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,11 +221,20 @@ def build_delete_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -226,7 +251,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -237,11 +262,20 @@ def build_update_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -260,7 +294,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -270,11 +304,20 @@ def build_list_keys_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -291,7 +334,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -302,11 +345,20 @@ def build_regenerate_key_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -319,13 +371,61 @@ def build_regenerate_key_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_replica_skus_request( + resource_group_name: str, resource_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/skus", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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_restart_request( resource_group_name: str, resource_name: str, subscription_id: str, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -335,11 +435,20 @@ def build_restart_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -356,7 +465,7 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -366,11 +475,20 @@ def build_list_skus_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -473,16 +591,14 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.NameAvailability] = 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, "NameAvailabilityParameters") @@ -501,8 +617,9 @@ def check_name_availability( 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 @@ -535,9 +652,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.SignalRResour _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResourceList] = kwargs.pop("cls", None) error_map = { @@ -589,8 +704,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 @@ -611,8 +727,8 @@ def get_next(next_link=None): def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.SignalRResource"]: """Handles requests to list all resources in a resource group. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SignalRResource or the result of cls(response) @@ -622,9 +738,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["2023-02-01"] = 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.SignalRResourceList] = kwargs.pop("cls", None) error_map = { @@ -677,8 +791,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 @@ -699,8 +814,8 @@ def get_next(next_link=None): def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.SignalRResource: """Get the resource and its properties. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -720,9 +835,7 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource] = kwargs.pop("cls", None) request = build_get_request( @@ -737,8 +850,9 @@ def get(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _m 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 @@ -777,16 +891,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource]] = 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, "SignalRResource") @@ -806,8 +918,9 @@ def _create_or_update_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 @@ -845,8 +958,8 @@ def begin_create_or_update( ) -> LROPoller[_models.SignalRResource]: """Create or update a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -881,8 +994,8 @@ def begin_create_or_update( ) -> LROPoller[_models.SignalRResource]: """Create or update a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -915,8 +1028,8 @@ def begin_create_or_update( ) -> LROPoller[_models.SignalRResource]: """Create or update a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -942,9 +1055,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -971,7 +1082,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -1003,9 +1116,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["2023-02-01"] = 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( @@ -1020,8 +1131,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 @@ -1042,8 +1154,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Operation to delete a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1062,9 +1174,7 @@ def begin_delete(self, resource_group_name: str, resource_name: str, **kwargs: A _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) @@ -1124,16 +1234,14 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource]] = 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, "SignalRResource") @@ -1153,8 +1261,9 @@ def _update_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 @@ -1165,11 +1274,15 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize("SignalRResource", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -1189,8 +1302,8 @@ def begin_update( ) -> LROPoller[_models.SignalRResource]: """Operation to update an exiting resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1225,8 +1338,8 @@ def begin_update( ) -> LROPoller[_models.SignalRResource]: """Operation to update an exiting resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1259,8 +1372,8 @@ def begin_update( ) -> LROPoller[_models.SignalRResource]: """Operation to update an exiting resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1286,9 +1399,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1315,7 +1426,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -1337,8 +1450,8 @@ def get_long_running_output(pipeline_response): def list_keys(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.SignalRKeys: """Get the access keys of the resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1358,9 +1471,7 @@ def list_keys(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRKeys] = kwargs.pop("cls", None) request = build_list_keys_request( @@ -1375,8 +1486,9 @@ def list_keys(self, resource_group_name: str, resource_name: str, **kwargs: Any) 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 @@ -1415,16 +1527,14 @@ def _regenerate_key_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRKeys] = 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, "RegenerateKeyParameters") @@ -1444,23 +1554,31 @@ def _regenerate_key_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 - if response.status_code not in [202]: + if response.status_code not in [200, 202]: 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("SignalRKeys", pipeline_response) + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("SignalRKeys", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("SignalRKeys", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized + return deserialized # type: ignore _regenerate_key_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey" @@ -1479,8 +1597,8 @@ def begin_regenerate_key( """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1516,8 +1634,8 @@ def begin_regenerate_key( """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1551,8 +1669,8 @@ def begin_regenerate_key( """Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1578,9 +1696,7 @@ def begin_regenerate_key( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRKeys] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1608,7 +1724,7 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1627,6 +1743,74 @@ def get_long_running_output(pipeline_response): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey" } + @distributed_trace + def list_replica_skus( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> _models.SkuList: + """List all available skus of the replica resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SkuList or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.SkuList + :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.SkuList] = kwargs.pop("cls", None) + + request = build_list_replica_skus_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_replica_skus.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("SkuList", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_replica_skus.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/skus" + } + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, resource_name: str, **kwargs: Any ) -> None: @@ -1641,9 +1825,7 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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_restart_request( @@ -1658,8 +1840,9 @@ def _restart_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 @@ -1669,8 +1852,12 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart" @@ -1680,8 +1867,8 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements def begin_restart(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> LROPoller[None]: """Operation to restart a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1700,9 +1887,7 @@ def begin_restart(self, resource_group_name: str, resource_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) @@ -1725,7 +1910,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) @@ -1748,8 +1933,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list_skus(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> _models.SkuList: """List all available skus of the resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -1769,9 +1954,7 @@ def list_skus(self, resource_group_name: str, resource_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SkuList] = kwargs.pop("cls", None) request = build_list_skus_request( @@ -1786,8 +1969,9 @@ def list_skus(self, resource_group_name: str, resource_name: str, **kwargs: Any) 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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_operations.py index 1691533cf476..e62034b88d75 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_certificates_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 @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -49,7 +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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +55,20 @@ def build_list_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,12 +95,21 @@ def build_get_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +126,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,12 +137,21 @@ def build_create_or_update_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,12 +180,21 @@ def build_delete_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), "certificateName": _SERIALIZER.url("certificate_name", certificate_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -198,8 +230,8 @@ def list( ) -> Iterable["_models.CustomCertificate"]: """List all custom certificates. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -211,9 +243,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificateList] = kwargs.pop("cls", None) error_map = { @@ -267,8 +297,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 @@ -291,8 +322,8 @@ def get( ) -> _models.CustomCertificate: """Get a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -314,9 +345,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificate] = kwargs.pop("cls", None) request = build_get_request( @@ -332,8 +361,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 @@ -373,16 +403,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificate] = 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, "CustomCertificate") @@ -403,8 +431,9 @@ def _create_or_update_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 @@ -442,8 +471,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomCertificate]: """Create or update a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -481,8 +510,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomCertificate]: """Create or update a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -518,8 +547,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomCertificate]: """Create or update a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -546,9 +575,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomCertificate] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -576,7 +603,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -600,8 +629,8 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Delete a custom certificate. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -623,9 +652,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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( @@ -641,8 +668,9 @@ def delete( # 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 diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_operations.py index c462becc209d..9662b6e18f26 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rcustom_domains_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 @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -49,7 +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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +55,20 @@ def build_list_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,12 +95,21 @@ def build_get_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,7 +126,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,12 +137,21 @@ def build_create_or_update_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +170,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,12 +180,21 @@ def build_delete_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,8 +228,8 @@ def __init__(self, *args, **kwargs): def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> Iterable["_models.CustomDomain"]: """List all custom domains. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -209,9 +241,7 @@ def list(self, resource_group_name: str, resource_name: str, **kwargs: Any) -> I _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomainList] = kwargs.pop("cls", None) error_map = { @@ -265,8 +295,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 @@ -287,8 +318,8 @@ def get_next(next_link=None): def get(self, resource_group_name: str, resource_name: str, name: str, **kwargs: Any) -> _models.CustomDomain: """Get a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -310,9 +341,7 @@ def get(self, resource_group_name: str, resource_name: str, name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomain] = kwargs.pop("cls", None) request = build_get_request( @@ -328,8 +357,9 @@ def get(self, resource_group_name: str, resource_name: str, 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 @@ -369,16 +399,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomain] = 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, "CustomDomain") @@ -399,8 +427,9 @@ def _create_or_update_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 @@ -434,8 +463,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomDomain]: """Create or update a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -473,8 +502,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomDomain]: """Create or update a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -510,8 +539,8 @@ def begin_create_or_update( ) -> LROPoller[_models.CustomDomain]: """Create or update a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -538,9 +567,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.CustomDomain] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -568,7 +595,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -600,9 +629,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["2023-02-01"] = 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( @@ -618,8 +645,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,8 +668,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements def begin_delete(self, resource_group_name: str, resource_name: str, name: str, **kwargs: Any) -> LROPoller[None]: """Delete a custom domain. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -662,9 +690,7 @@ def begin_delete(self, resource_group_name: str, resource_name: str, name: str, _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py index b05b1b7d5863..305559f8e82f 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_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 @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -49,7 +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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +55,20 @@ def build_list_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,11 +102,20 @@ def build_get_request( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +136,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,11 +150,20 @@ def build_update_request( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,11 +199,20 @@ def build_delete_request( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,8 +248,8 @@ def list( ) -> Iterable["_models.PrivateEndpointConnection"]: """List private endpoint connections. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -230,9 +262,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateEndpointConnectionList] = kwargs.pop("cls", None) error_map = { @@ -286,8 +316,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 @@ -310,10 +341,11 @@ def get( ) -> _models.PrivateEndpointConnection: """Get the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -333,9 +365,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( @@ -351,8 +381,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 @@ -386,10 +417,11 @@ def update( ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -417,10 +449,11 @@ def update( ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -446,10 +479,11 @@ def update( ) -> _models.PrivateEndpointConnection: """Update the state of specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -475,16 +509,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateEndpointConnection] = 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, "PrivateEndpointConnection") @@ -505,8 +537,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 @@ -541,9 +574,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["2023-02-01"] = 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( @@ -559,8 +590,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 @@ -583,10 +615,11 @@ def begin_delete( ) -> LROPoller[None]: """Delete the specified private endpoint connection. - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. Required. :type private_endpoint_connection_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -605,9 +638,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py index 1ef011da45bc..f871079d813f 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_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 @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -47,7 +42,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,11 +52,20 @@ def build_list_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,8 +101,8 @@ def list( ) -> Iterable["_models.PrivateLinkResource"]: """Get the private link resources that need to be created for a resource. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -110,9 +114,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.PrivateLinkResourceList] = kwargs.pop("cls", None) error_map = { @@ -166,8 +168,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/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_operations.py new file mode 100644 index 000000000000..96a1e2028c29 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rreplicas_operations.py @@ -0,0 +1,1166 @@ +# 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 + +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, resource_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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_get_request( + resource_group_name: str, resource_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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_or_update_request( + resource_group_name: str, resource_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, resource_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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_update_request( + resource_group_name: str, resource_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_restart_request( + resource_group_name: str, resource_name: str, replica_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart", + ) # 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", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + "replicaName": _SERIALIZER.url( + "replica_name", + replica_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), + } + + _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SignalRReplicasOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.signalr.SignalRManagementClient`'s + :attr:`signal_rreplicas` 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, resource_name: str, **kwargs: Any) -> Iterable["_models.Replica"]: + """List all replicas belong to this resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either Replica or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.signalr.models.Replica] + :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.ReplicaList] = 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, + resource_name=resource_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("ReplicaList", 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.SignalRService/signalR/{resourceName}/replicas" + } + + @distributed_trace + def get(self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any) -> _models.Replica: + """Get the replica and its properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replica or the result of cls(response) + :rtype: ~azure.mgmt.signalr.models.Replica + :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.Replica] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_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("Replica", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> _models.Replica: + 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.Replica] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Replica") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_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("Replica", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("Replica", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: _models.Replica, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Create or update a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: ~azure.mgmt.signalr.models.Replica + :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 Replica or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Create or update a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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 Replica or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Create or update a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the create or update operation. Is either a Replica type or a + IO type. Required. + :type parameters: ~azure.mgmt.signalr.models.Replica or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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 Replica or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.Replica] + :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.Replica] = 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_or_update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + parameters=parameters, + 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("Replica", 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_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> None: + """Operation to delete a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_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, + resource_name=resource_name, + replica_name=replica_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.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + def _update_initial( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> _models.Replica: + 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.Replica] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Replica") + + request = build_update_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize("Replica", pipeline_response) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = self._deserialize("Replica", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: _models.Replica, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Operation to update an exiting replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the update operation. Required. + :type parameters: ~azure.mgmt.signalr.models.Replica + :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 Replica or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Operation to update an exiting replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the update operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Known values are: 'application/json', 'text/json'. 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 Replica or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.Replica] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_name: str, + replica_name: str, + parameters: Union[_models.Replica, IO], + **kwargs: Any + ) -> LROPoller[_models.Replica]: + """Operation to update an exiting replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_name: str + :param parameters: Parameters for the update operation. Is either a Replica type or a IO type. + Required. + :type parameters: ~azure.mgmt.signalr.models.Replica or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json', + 'text/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 Replica or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.signalr.models.Replica] + :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.Replica] = 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._update_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + parameters=parameters, + 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("Replica", 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": "location"}, **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_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}" + } + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, resource_name: str, replica_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_restart_request( + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._restart_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 [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) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart" + } + + @distributed_trace + def begin_restart( + self, resource_group_name: str, resource_name: str, replica_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Operation to restart a replica. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param resource_name: The name of the resource. Required. + :type resource_name: str + :param replica_name: The name of the replica. Required. + :type replica_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._restart_initial( # type: ignore + resource_group_name=resource_group_name, + resource_name=resource_name, + replica_name=replica_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, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.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_restart.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/restart" + } diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py index 56466cb71b0a..9647cafccd61 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rshared_private_link_resources_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 @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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]] @@ -49,7 +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["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,11 +55,20 @@ def build_list_request( ) # 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"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,7 +89,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,11 +102,20 @@ def build_get_request( "shared_private_link_resource_name", shared_private_link_resource_name, "str" ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,7 +136,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,11 +150,20 @@ def build_create_or_update_request( "shared_private_link_resource_name", shared_private_link_resource_name, "str" ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +186,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -176,11 +199,20 @@ def build_delete_request( "shared_private_link_resource_name", shared_private_link_resource_name, "str" ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "resourceName": _SERIALIZER.url( + "resource_name", + resource_name, + "str", + max_length=63, + min_length=3, + pattern=r"^[a-zA-Z][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]$", + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,8 +248,8 @@ def list( ) -> Iterable["_models.SharedPrivateLinkResource"]: """List shared private link resources. - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -230,9 +262,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResourceList] = kwargs.pop("cls", None) error_map = { @@ -286,8 +316,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 @@ -313,8 +344,8 @@ def get( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -334,9 +365,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResource] = kwargs.pop("cls", None) request = build_get_request( @@ -352,8 +381,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 @@ -393,16 +423,14 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResource] = 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, "SharedPrivateLinkResource") @@ -423,8 +451,9 @@ def _create_or_update_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 @@ -465,8 +494,8 @@ def begin_create_or_update( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -505,8 +534,8 @@ def begin_create_or_update( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -543,8 +572,8 @@ def begin_create_or_update( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -570,9 +599,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SharedPrivateLinkResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -600,7 +627,9 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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: @@ -632,9 +661,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["2023-02-01"] = 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( @@ -650,8 +677,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 @@ -677,8 +705,8 @@ def begin_delete( :param shared_private_link_resource_name: The name of the shared private link resource. Required. :type shared_private_link_resource_name: str - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. :type resource_group_name: str :param resource_name: The name of the resource. Required. :type resource_name: str @@ -697,9 +725,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py index 4b3f886f2d62..d48ed872f931 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_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 @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +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,7 +40,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = kwargs.pop("api_version", _params.pop("api-version", "2023-02-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,9 +96,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.SignalRUsage"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2023-02-01"] = 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.SignalRUsageList] = kwargs.pop("cls", None) error_map = { @@ -156,8 +149,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/signalr/azure-mgmt-signalr/generated_samples/operations_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py index e8fb2ce30ac7..e79c77362c77 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Operations_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py index afb9b1f1a305..ccf2e6923bc3 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_check_name_availability.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CheckNameAvailability.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py index a19a67568af4..d6865a294c01 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_create_or_update.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py index 859e0e37a97b..5b2c1fcaeeec 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_delete.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.signal_r.begin_delete( + client.signal_r.begin_delete( resource_group_name="myResourceGroup", resource_name="mySignalRService", ).result() - print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py index dd70786a3769..a3c6607c6504 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py index 8fc96915b733..02083322c5d4 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListByResourceGroup.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py index 4e951452563d..201913bf0faa 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_by_subscription.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListBySubscription.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py index e14028964caa..c72fbaaea080 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListKeys.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListKeys.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.py new file mode 100644 index 000000000000..b36dacd3c4fe --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_replica_skus.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_r_list_replica_skus.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_r.list_replica_skus( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + ) + print(response) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListReplicaSkus.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py index 3a1a19bc3349..47db232b95ce 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_list_skus.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListSkus.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_ListSkus.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py index be29a000ade5..d42c3b8bdd30 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_regenerate_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_RegenerateKey.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_RegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py index 1e8cd699c2f1..637a577d6011 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_restart.py @@ -29,13 +29,12 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.signal_r.begin_restart( + client.signal_r.begin_restart( resource_group_name="myResourceGroup", resource_name="mySignalRService", ).result() - print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Restart.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Restart.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py index 45eac2a1c7db..4a7af8c6c474 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_r_update.py @@ -79,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Update.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_Update.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py index 9ef332ffb668..22b63e33e173 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py index 65284681a9b9..bec8224d3282 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.signal_rcustom_certificates.delete( + client.signal_rcustom_certificates.delete( resource_group_name="myResourceGroup", resource_name="mySignalRService", certificate_name="myCert", ) - print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py index 0c4fdb076d23..65d1218ffc88 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py index e38bde50d997..60bc26c57e41 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_certificates_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py index 677319b5952f..4c6e71c9fc54 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py index 273d9be7be87..0f01df9c0a6e 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.signal_rcustom_domains.begin_delete( + client.signal_rcustom_domains.begin_delete( resource_group_name="myResourceGroup", resource_name="mySignalRService", name="example", ).result() - print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py index 9902cce5d9f1..e221230f6d9b 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py index 0063d6dc2447..dfce99e158e5 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rcustom_domains_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py index d69146f1f6ad..d2601e67e484 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.signal_rprivate_endpoint_connections.begin_delete( + client.signal_rprivate_endpoint_connections.begin_delete( private_endpoint_connection_name="mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", resource_group_name="myResourceGroup", resource_name="mySignalRService", ).result() - print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py index d02bd0960274..0710b311eb79 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py index e82eea06ef83..a4df76dc4dbb 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py index 85869255e91d..567b5f62478a 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_endpoint_connections_update.py @@ -35,9 +35,7 @@ def main(): resource_name="mySignalRService", parameters={ "properties": { - "privateEndpoint": { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" - }, + "privateEndpoint": {}, "privateLinkServiceConnectionState": {"actionsRequired": "None", "status": "Approved"}, } }, @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Update.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_Update.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py index 7276dd5fd126..f7348c2156e0 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rprivate_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateLinkResources_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.py new file mode 100644 index 000000000000..0a29d1a5d99a --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_create_or_update.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplicas_create_or_update.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplicas.begin_create_or_update( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + parameters={ + "location": "eastus", + "properties": {"resourceStopped": "false"}, + "sku": {"capacity": 1, "name": "Premium_P1", "tier": "Premium"}, + "tags": {"key1": "value1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.py new file mode 100644 index 000000000000..ee5af6332ca9 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_delete.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplicas_delete.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.signal_rreplicas.delete( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + ) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.py new file mode 100644 index 000000000000..a590ebb170fb --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_get.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplicas_get.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplicas.get( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + ) + print(response) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.py new file mode 100644 index 000000000000..8da70b2dd009 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_list.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplicas_list.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplicas.list( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_List.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.py new file mode 100644 index 000000000000..2bdad1bbc109 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_restart.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplicas_restart.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + client.signal_rreplicas.begin_restart( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + ).result() + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Restart.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.py new file mode 100644 index 000000000000..621877131023 --- /dev/null +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rreplicas_update.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.signalr import SignalRManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-signalr +# USAGE + python signal_rreplicas_update.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 = SignalRManagementClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.signal_rreplicas.begin_update( + resource_group_name="myResourceGroup", + resource_name="mySignalRService", + replica_name="mySignalRService-eastus", + parameters={ + "location": "eastus", + "properties": {"resourceStopped": "false"}, + "sku": {"capacity": 1, "name": "Premium_P1", "tier": "Premium"}, + "tags": {"key1": "value1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py index 67f0f305456a..1d27604a2e58 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_create_or_update.py @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py index d5cb3c727745..21507649c827 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_delete.py @@ -29,14 +29,13 @@ def main(): subscription_id="00000000-0000-0000-0000-000000000000", ) - response = client.signal_rshared_private_link_resources.begin_delete( + client.signal_rshared_private_link_resources.begin_delete( shared_private_link_resource_name="upstream", resource_group_name="myResourceGroup", resource_name="mySignalRService", ).result() - print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Delete.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_Delete.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py index 79036c84542b..b7ebf823170d 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Get.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_Get.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py index 2f2cc3d78ece..ea0565beb5c4 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/signal_rshared_private_link_resources_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_List.json if __name__ == "__main__": main() diff --git a/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py b/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py index 356dbb292a69..39ca0381ec46 100644 --- a/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py +++ b/sdk/signalr/azure-mgmt-signalr/generated_samples/usages_list.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Usages_List.json +# x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json if __name__ == "__main__": main()