diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/apiview-properties.json index 326bdd8a7bfa..eb65a06ddf06 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/apiview-properties.json +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/apiview-properties.json @@ -1,12 +1,20 @@ { "CrossLanguagePackageId": "_Specs_.Azure.ClientGenerator.Core.ExactName", "CrossLanguageDefinitionId": { + "specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig": "_Specs_.Azure.ClientGenerator.Core.ExactName.EnumValue.EndpointConfig", "specs.azure.clientgenerator.core.exactname.model.models.My_model": "_Specs_.Azure.ClientGenerator.Core.ExactName.Model.ExactModel", "specs.azure.clientgenerator.core.exactname.property.models.ScopedModel": "_Specs_.Azure.ClientGenerator.Core.ExactName.Property.ScopedModel", + "specs.azure.clientgenerator.core.exactname.models.AgentEndpointProtocol": "_Specs_.Azure.ClientGenerator.Core.ExactName.EnumValue.AgentEndpointProtocol", "specs.azure.clientgenerator.core.exactname.operations.ModelOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Model.send", "specs.azure.clientgenerator.core.exactname.aio.operations.ModelOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Model.send", "specs.azure.clientgenerator.core.exactname.operations.PropertyOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Property.send", - "specs.azure.clientgenerator.core.exactname.aio.operations.PropertyOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Property.send" + "specs.azure.clientgenerator.core.exactname.aio.operations.PropertyOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Property.send", + "specs.azure.clientgenerator.core.exactname.operations.EnumValueOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.EnumValue.send", + "specs.azure.clientgenerator.core.exactname.aio.operations.EnumValueOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.EnumValue.send", + "specs.azure.clientgenerator.core.exactname.operations.OperationOperations.myOp": "_Specs_.Azure.ClientGenerator.Core.ExactName.Operation.myOp", + "specs.azure.clientgenerator.core.exactname.aio.operations.OperationOperations.myOp": "_Specs_.Azure.ClientGenerator.Core.ExactName.Operation.myOp", + "specs.azure.clientgenerator.core.exactname.operations.ParameterOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Parameter.send", + "specs.azure.clientgenerator.core.exactname.aio.operations.ParameterOperations.send": "_Specs_.Azure.ClientGenerator.Core.ExactName.Parameter.send" }, - "CrossLanguageVersion": "cc4f69ca2424" + "CrossLanguageVersion": "29dab5aacd02" } \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_enum_value_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_enum_value_operations.py new file mode 100644 index 000000000000..474107c950e7 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_enum_value_operations.py @@ -0,0 +1,24 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ExactNameClientTestBase, ExactNamePreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestExactNameEnumValueOperations(ExactNameClientTestBase): + @ExactNamePreparer() + @recorded_by_proxy + def test_enum_value_send(self, exactname_endpoint): + client = self.create_client(endpoint=exactname_endpoint) + response = client.enum_value.send( + body={"protocol": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_enum_value_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_enum_value_operations_async.py new file mode 100644 index 000000000000..5c7defe80076 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_enum_value_operations_async.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ExactNamePreparer +from testpreparer_async import ExactNameClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestExactNameEnumValueOperationsAsync(ExactNameClientTestBaseAsync): + @ExactNamePreparer() + @recorded_by_proxy_async + async def test_enum_value_send(self, exactname_endpoint): + client = self.create_async_client(endpoint=exactname_endpoint) + response = await client.enum_value.send( + body={"protocol": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_operation_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_operation_operations.py new file mode 100644 index 000000000000..f5e3b38307a5 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_operation_operations.py @@ -0,0 +1,22 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ExactNameClientTestBase, ExactNamePreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestExactNameOperationOperations(ExactNameClientTestBase): + @ExactNamePreparer() + @recorded_by_proxy + def test_operation_myOp(self, exactname_endpoint): + client = self.create_client(endpoint=exactname_endpoint) + response = client.operation.myOp() + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_operation_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_operation_operations_async.py new file mode 100644 index 000000000000..f25007b29410 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_operation_operations_async.py @@ -0,0 +1,23 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ExactNamePreparer +from testpreparer_async import ExactNameClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestExactNameOperationOperationsAsync(ExactNameClientTestBaseAsync): + @ExactNamePreparer() + @recorded_by_proxy_async + async def test_operation_myOp(self, exactname_endpoint): + client = self.create_async_client(endpoint=exactname_endpoint) + response = await client.operation.myOp() + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_parameter_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_parameter_operations.py new file mode 100644 index 000000000000..391b2f9bd2ed --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_parameter_operations.py @@ -0,0 +1,24 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import ExactNameClientTestBase, ExactNamePreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestExactNameParameterOperations(ExactNameClientTestBase): + @ExactNamePreparer() + @recorded_by_proxy + def test_parameter_send(self, exactname_endpoint): + client = self.create_client(endpoint=exactname_endpoint) + response = client.parameter.send( + myParam="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_parameter_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_parameter_operations_async.py new file mode 100644 index 000000000000..cb191bba9791 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/generated_tests/test_exact_name_parameter_operations_async.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import ExactNamePreparer +from testpreparer_async import ExactNameClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestExactNameParameterOperationsAsync(ExactNameClientTestBaseAsync): + @ExactNamePreparer() + @recorded_by_proxy_async + async def test_parameter_send(self, exactname_endpoint): + client = self.create_async_client(endpoint=exactname_endpoint) + response = await client.parameter.send( + myParam="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/_client.py index 35b7bba12e6c..4c72280dec32 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/_client.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/_client.py @@ -16,7 +16,10 @@ from ._configuration import ExactNameClientConfiguration from ._utils.serialization import Deserializer, Serializer +from .enumvalue.operations import EnumValueOperations from .model.operations import ModelOperations +from .operation.operations import OperationOperations +from .parameter.operations import ParameterOperations from .property.operations import PropertyOperations if sys.version_info >= (3, 11): @@ -32,6 +35,12 @@ class ExactNameClient: # pylint: disable=client-accepts-api-version-keyword :vartype model: specs.azure.clientgenerator.core.exactname.operations.ModelOperations :ivar property: PropertyOperations operations :vartype property: specs.azure.clientgenerator.core.exactname.operations.PropertyOperations + :ivar enum_value: EnumValueOperations operations + :vartype enum_value: specs.azure.clientgenerator.core.exactname.operations.EnumValueOperations + :ivar operation: OperationOperations operations + :vartype operation: specs.azure.clientgenerator.core.exactname.operations.OperationOperations + :ivar parameter: ParameterOperations operations + :vartype parameter: specs.azure.clientgenerator.core.exactname.operations.ParameterOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -66,6 +75,9 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._serialize.client_side_validation = False self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) + self.enum_value = EnumValueOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.parameter = ParameterOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/aio/_client.py index c3f605866702..5562671580d5 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/aio/_client.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/aio/_client.py @@ -15,7 +15,10 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from .._utils.serialization import Deserializer, Serializer +from ..enumvalue.aio.operations import EnumValueOperations from ..model.aio.operations import ModelOperations +from ..operation.aio.operations import OperationOperations +from ..parameter.aio.operations import ParameterOperations from ..property.aio.operations import PropertyOperations from ._configuration import ExactNameClientConfiguration @@ -32,6 +35,15 @@ class ExactNameClient: # pylint: disable=client-accepts-api-version-keyword :vartype model: specs.azure.clientgenerator.core.exactname.aio.operations.ModelOperations :ivar property: PropertyOperations operations :vartype property: specs.azure.clientgenerator.core.exactname.aio.operations.PropertyOperations + :ivar enum_value: EnumValueOperations operations + :vartype enum_value: + specs.azure.clientgenerator.core.exactname.aio.operations.EnumValueOperations + :ivar operation: OperationOperations operations + :vartype operation: + specs.azure.clientgenerator.core.exactname.aio.operations.OperationOperations + :ivar parameter: ParameterOperations operations + :vartype parameter: + specs.azure.clientgenerator.core.exactname.aio.operations.ParameterOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -66,6 +78,9 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self._serialize.client_side_validation = False self.model = ModelOperations(self._client, self._config, self._serialize, self._deserialize) self.property = PropertyOperations(self._client, self._config, self._serialize, self._deserialize) + self.enum_value = EnumValueOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation = OperationOperations(self._client, self._config, self._serialize, self._deserialize) + self.parameter = ParameterOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/__init__.py new file mode 100644 index 000000000000..1bbd9d9cfbc8 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import EnumValueOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EnumValueOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/_operations.py new file mode 100644 index 000000000000..daf995a1c367 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/_operations.py @@ -0,0 +1,175 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict + +from ... import models as _models2 +from ...._utils.model_base import SdkJSONEncoder, _deserialize +from ...._utils.serialization import Deserializer, Serializer +from ....aio._configuration import ExactNameClientConfiguration +from ...operations._operations import build_enum_value_send_request + +JSON = MutableMapping[str, Any] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class EnumValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.exactname.aio.ExactNameClient`'s + :attr:`enum_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ExactNameClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def send( + self, body: _models2.EndpointConfig, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.EndpointConfig: + """send. + + :param body: Required. + :type body: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def send( + self, body: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.EndpointConfig: + """send. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def send( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models2.EndpointConfig: + """send. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def send( + self, body: Union[_models2.EndpointConfig, JSON, IO[bytes]], **kwargs: Any + ) -> _models2.EndpointConfig: + """send. + + :param body: Is one of the following types: EndpointConfig, JSON, IO[bytes] Required. + :type body: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig or JSON + or IO[bytes] + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models2.EndpointConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_enum_value_send_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models2.EndpointConfig, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/__init__.py new file mode 100644 index 000000000000..675050397f8f --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/__init__.py @@ -0,0 +1,32 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + EndpointConfig, +) + +from ._enums import ( # type: ignore + AgentEndpointProtocol, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EndpointConfig", + "AgentEndpointProtocol", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_enums.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_enums.py new file mode 100644 index 000000000000..a82305e35f9d --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_enums.py @@ -0,0 +1,23 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AgentEndpointProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of AgentEndpointProtocol.""" + + ACTIVITY = "activity" + """ACTIVITY.""" + RESPONSES = "responses" + """RESPONSES.""" + A2A = "a2a" + """A2A.""" + MCP = "mcp" + """MCP.""" diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_models.py new file mode 100644 index 000000000000..0666b51f0365 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_models.py @@ -0,0 +1,46 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +from typing import Any, Mapping, TYPE_CHECKING, Union, overload + +from ..._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class EndpointConfig(_Model): + """EndpointConfig. + + :ivar protocol: Required. Known values are: "activity", "responses", "a2a", and "mcp". + :vartype protocol: str or + ~specs.azure.clientgenerator.core.exactname.enumvalue.models.AgentEndpointProtocol + """ + + protocol: Union[str, "_models.AgentEndpointProtocol"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Required. Known values are: \"activity\", \"responses\", \"a2a\", and \"mcp\".""" + + @overload + def __init__( + self, + *, + protocol: Union[str, "_models.AgentEndpointProtocol"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/models/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/__init__.py new file mode 100644 index 000000000000..1bbd9d9cfbc8 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import EnumValueOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "EnumValueOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/_operations.py new file mode 100644 index 000000000000..da764d2377bb --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/_operations.py @@ -0,0 +1,190 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from .. import models as _models1 +from ..._configuration import ExactNameClientConfiguration +from ..._utils.model_base import SdkJSONEncoder, _deserialize +from ..._utils.serialization import Deserializer, Serializer + +JSON = MutableMapping[str, Any] +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_enum_value_send_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/azure/client-generator-core/exact-name/enum-value" + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, headers=_headers, **kwargs) + + +class EnumValueOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.exactname.ExactNameClient`'s + :attr:`enum_value` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ExactNameClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def send( + self, body: _models1.EndpointConfig, *, content_type: str = "application/json", **kwargs: Any + ) -> _models1.EndpointConfig: + """send. + + :param body: Required. + :type body: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def send(self, body: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models1.EndpointConfig: + """send. + + :param body: Required. + :type body: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def send( + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models1.EndpointConfig: + """send. + + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def send(self, body: Union[_models1.EndpointConfig, JSON, IO[bytes]], **kwargs: Any) -> _models1.EndpointConfig: + """send. + + :param body: Is one of the following types: EndpointConfig, JSON, IO[bytes] Required. + :type body: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig or JSON + or IO[bytes] + :return: EndpointConfig. The EndpointConfig is compatible with MutableMapping + :rtype: ~specs.azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models1.EndpointConfig] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_enum_value_send_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models1.EndpointConfig, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/enumvalue/operations/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/__init__.py new file mode 100644 index 000000000000..946aa7df9d4f --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import OperationOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "OperationOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/_operations.py new file mode 100644 index 000000000000..404c7e15109d --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/_operations.py @@ -0,0 +1,91 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._utils.serialization import Deserializer, Serializer +from ....aio._configuration import ExactNameClientConfiguration +from ...operations._operations import build_operation_myOp_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class OperationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.exactname.aio.ExactNameClient`'s + :attr:`operation` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ExactNameClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def myOp(self, **kwargs: Any) -> None: + """myOp. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_operation_myOp_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/__init__.py new file mode 100644 index 000000000000..946aa7df9d4f --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import OperationOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "OperationOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/_operations.py new file mode 100644 index 000000000000..d5eaa8adaaf0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/_operations.py @@ -0,0 +1,100 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from ..._configuration import ExactNameClientConfiguration +from ..._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_operation_myOp_request(**kwargs: Any) -> HttpRequest: + # Construct URL + _url = "/azure/client-generator-core/exact-name/operation" + + return HttpRequest(method="GET", url=_url, **kwargs) + + +class OperationOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.exactname.ExactNameClient`'s + :attr:`operation` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ExactNameClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def myOp(self, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """myOp. + + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_operation_myOp_request( + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/operation/operations/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/__init__.py new file mode 100644 index 000000000000..d55ccad1f573 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/__init__.py new file mode 100644 index 000000000000..95b293895049 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import ParameterOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ParameterOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/_operations.py new file mode 100644 index 000000000000..85558f08c6bb --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/_operations.py @@ -0,0 +1,94 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ...._utils.serialization import Deserializer, Serializer +from ....aio._configuration import ExactNameClientConfiguration +from ...operations._operations import build_parameter_send_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] + + +class ParameterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.exactname.aio.ExactNameClient`'s + :attr:`parameter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ExactNameClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def send(self, *, myParam: str, **kwargs: Any) -> None: + """send. + + :keyword myParam: Required. + :paramtype myParam: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_parameter_send_request( + myParam=myParam, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/__init__.py new file mode 100644 index 000000000000..95b293895049 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/__init__.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import ParameterOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ParameterOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/_operations.py new file mode 100644 index 000000000000..ca5ca604b7ec --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/_operations.py @@ -0,0 +1,109 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from typing import Any, Callable, Optional, TypeVar + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict + +from ..._configuration import ExactNameClientConfiguration +from ..._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_parameter_send_request(*, myParam: str, **kwargs: Any) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + # Construct URL + _url = "/azure/client-generator-core/exact-name/parameter" + + # Construct parameters + _params["myParam"] = _SERIALIZER.query("myParam", myParam, "str") + + return HttpRequest(method="GET", url=_url, params=_params, **kwargs) + + +class ParameterOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.exactname.ExactNameClient`'s + :attr:`parameter` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ExactNameClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def send(self, *, myParam: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """send. + + :keyword myParam: Required. + :paramtype myParam: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_parameter_send_request( + myParam=myParam, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/_patch.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/_patch.py new file mode 100644 index 000000000000..87676c65a8f0 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-exact-name/specs/azure/clientgenerator/core/exactname/parameter/operations/_patch.py @@ -0,0 +1,21 @@ +# 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. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" + + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/apiview-properties.json b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/apiview-properties.json index 890152c06346..a0d36c5ae3f0 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/apiview-properties.json +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/apiview-properties.json @@ -2,6 +2,8 @@ "CrossLanguagePackageId": "_Specs_.Azure.ClientGenerator.Core.Usage", "CrossLanguageDefinitionId": { "specs.azure.clientgenerator.core.usage.models.InputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.InputModel", + "specs.azure.clientgenerator.core.usage.models.NamespaceModel": "_Specs_.Azure.ClientGenerator.Core.Usage.Models.NamespaceModel", + "specs.azure.clientgenerator.core.usage.models.NestedNamespaceModel": "_Specs_.Azure.ClientGenerator.Core.Usage.Models.Nested.NestedNamespaceModel", "specs.azure.clientgenerator.core.usage.models.OrphanModel": "_Specs_.Azure.ClientGenerator.Core.Usage.OrphanModel", "specs.azure.clientgenerator.core.usage.models.OutputModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.OutputModel", "specs.azure.clientgenerator.core.usage.models.ResultModel": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.ResultModel", @@ -13,7 +15,9 @@ "specs.azure.clientgenerator.core.usage.operations.ModelInOperationOperations.model_in_read_only_property": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", "specs.azure.clientgenerator.core.usage.aio.operations.ModelInOperationOperations.model_in_read_only_property": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.modelInReadOnlyProperty", "specs.azure.clientgenerator.core.usage.operations.ModelInOperationOperations.orphan_model_serializable": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.orphanModelSerializable", - "specs.azure.clientgenerator.core.usage.aio.operations.ModelInOperationOperations.orphan_model_serializable": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.orphanModelSerializable" + "specs.azure.clientgenerator.core.usage.aio.operations.ModelInOperationOperations.orphan_model_serializable": "_Specs_.Azure.ClientGenerator.Core.Usage.ModelInOperation.orphanModelSerializable", + "specs.azure.clientgenerator.core.usage.operations.NamespaceUsageOperations.namespace_model_serializable": "_Specs_.Azure.ClientGenerator.Core.Usage.NamespaceUsage.namespaceModelSerializable", + "specs.azure.clientgenerator.core.usage.aio.operations.NamespaceUsageOperations.namespace_model_serializable": "_Specs_.Azure.ClientGenerator.Core.Usage.NamespaceUsage.namespaceModelSerializable" }, - "CrossLanguageVersion": "fa69fb13e4f3" + "CrossLanguageVersion": "1443e84b75d8" } \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/generated_tests/test_usage_namespace_usage_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/generated_tests/test_usage_namespace_usage_operations.py new file mode 100644 index 000000000000..31ef60551865 --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/generated_tests/test_usage_namespace_usage_operations.py @@ -0,0 +1,25 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils import recorded_by_proxy +from testpreparer import UsageClientTestBase, UsagePreparer + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestUsageNamespaceUsageOperations(UsageClientTestBase): + @UsagePreparer() + @recorded_by_proxy + def test_namespace_usage_namespace_model_serializable(self, usage_endpoint): + client = self.create_client(endpoint=usage_endpoint) + response = client.namespace_usage.namespace_model_serializable( + body={}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/generated_tests/test_usage_namespace_usage_operations_async.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/generated_tests/test_usage_namespace_usage_operations_async.py new file mode 100644 index 000000000000..04d1df11d01e --- /dev/null +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/generated_tests/test_usage_namespace_usage_operations_async.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from devtools_testutils.aio import recorded_by_proxy_async +from testpreparer import UsagePreparer +from testpreparer_async import UsageClientTestBaseAsync + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestUsageNamespaceUsageOperationsAsync(UsageClientTestBaseAsync): + @UsagePreparer() + @recorded_by_proxy_async + async def test_namespace_usage_namespace_model_serializable(self, usage_endpoint): + client = self.create_async_client(endpoint=usage_endpoint) + response = await client.namespace_usage.namespace_model_serializable( + body={}, + content_type="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py index f196d51a2121..b2f0881e7119 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/_client.py @@ -16,7 +16,7 @@ from ._configuration import UsageClientConfiguration from ._utils.serialization import Deserializer, Serializer -from .operations import ModelInOperationOperations +from .operations import ModelInOperationOperations, NamespaceUsageOperations if sys.version_info >= (3, 11): from typing import Self @@ -30,6 +30,9 @@ class UsageClient: # pylint: disable=client-accepts-api-version-keyword :ivar model_in_operation: ModelInOperationOperations operations :vartype model_in_operation: specs.azure.clientgenerator.core.usage.operations.ModelInOperationOperations + :ivar namespace_usage: NamespaceUsageOperations operations + :vartype namespace_usage: + specs.azure.clientgenerator.core.usage.operations.NamespaceUsageOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -65,6 +68,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.model_in_operation = ModelInOperationOperations( self._client, self._config, self._serialize, self._deserialize ) + self.namespace_usage = NamespaceUsageOperations(self._client, self._config, self._serialize, self._deserialize) def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py index c6eaeceec6c6..8b33676439d3 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/_client.py @@ -16,7 +16,7 @@ from .._utils.serialization import Deserializer, Serializer from ._configuration import UsageClientConfiguration -from .operations import ModelInOperationOperations +from .operations import ModelInOperationOperations, NamespaceUsageOperations if sys.version_info >= (3, 11): from typing import Self @@ -30,6 +30,9 @@ class UsageClient: # pylint: disable=client-accepts-api-version-keyword :ivar model_in_operation: ModelInOperationOperations operations :vartype model_in_operation: specs.azure.clientgenerator.core.usage.aio.operations.ModelInOperationOperations + :ivar namespace_usage: NamespaceUsageOperations operations + :vartype namespace_usage: + specs.azure.clientgenerator.core.usage.aio.operations.NamespaceUsageOperations :keyword endpoint: Service host. Default value is "http://localhost:3000". :paramtype endpoint: str """ @@ -65,6 +68,7 @@ def __init__( # pylint: disable=missing-client-constructor-parameter-credential self.model_in_operation = ModelInOperationOperations( self._client, self._config, self._serialize, self._deserialize ) + self.namespace_usage = NamespaceUsageOperations(self._client, self._config, self._serialize, self._deserialize) def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/__init__.py index 9a46cfc7af85..94fbf98448fb 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/__init__.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/__init__.py @@ -13,6 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import ModelInOperationOperations # type: ignore +from ._operations import NamespaceUsageOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -20,6 +21,7 @@ __all__ = [ "ModelInOperationOperations", + "NamespaceUsageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py index 2ea448fe57f3..2bdb7ae06594 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/aio/operations/_operations.py @@ -34,6 +34,7 @@ build_model_in_operation_model_in_read_only_property_request, build_model_in_operation_orphan_model_serializable_request, build_model_in_operation_output_to_input_output_request, + build_namespace_usage_namespace_model_serializable_request, ) from .._configuration import UsageClientConfiguration @@ -494,3 +495,80 @@ async def orphan_model_serializable(self, body: Any, **kwargs: Any) -> None: if cls: return cls(pipeline_response, None, {}) # type: ignore + + +class NamespaceUsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.usage.aio.UsageClient`'s + :attr:`namespace_usage` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: UsageClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def namespace_model_serializable(self, body: Any, **kwargs: Any) -> None: + """Serialize the 'NamespaceModel' as request body. + + Expected body parameter: + + .. code-block:: json + + { + "name": "test" + }. + + :param body: Required. + :type body: any + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_namespace_usage_namespace_model_serializable_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/__init__.py index e5ed72eb8fc8..79fc02cef3bc 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/__init__.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/__init__.py @@ -15,6 +15,8 @@ from ._models import ( # type: ignore InputModel, + NamespaceModel, + NestedNamespaceModel, OrphanModel, OutputModel, ResultModel, @@ -26,6 +28,8 @@ __all__ = [ "InputModel", + "NamespaceModel", + "NestedNamespaceModel", "OrphanModel", "OutputModel", "ResultModel", diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_models.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_models.py index 79676ce729b4..86762d410987 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_models.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/models/_models.py @@ -43,6 +43,62 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class NamespaceModel(_Model): + """NamespaceModel. + + :ivar name: Required. + :vartype name: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NestedNamespaceModel(_Model): + """NestedNamespaceModel. + + :ivar value: Required. + :vartype value: str + """ + + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Required.""" + + @overload + def __init__( + self, + *, + value: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + class OrphanModel(_Model): """Not used anywhere, but access is override to public so still need to be generated and exported with serialization. diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/__init__.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/__init__.py index 9a46cfc7af85..94fbf98448fb 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/__init__.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/__init__.py @@ -13,6 +13,7 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import ModelInOperationOperations # type: ignore +from ._operations import NamespaceUsageOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -20,6 +21,7 @@ __all__ = [ "ModelInOperationOperations", + "NamespaceUsageOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py index a9b04b1c0147..9d6a44774b73 100644 --- a/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py +++ b/eng/tools/azure-sdk-tools/emitter/generated/azure/azure-client-generator-core-usage/specs/azure/clientgenerator/core/usage/operations/_operations.py @@ -105,6 +105,21 @@ def build_model_in_operation_orphan_model_serializable_request( # pylint: disab return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) +def build_namespace_usage_namespace_model_serializable_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + + content_type: str = kwargs.pop("content_type") + # Construct URL + _url = "/azure/client-generator-core/usage/namespaceModelSerializable" + + # Construct headers + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="PUT", url=_url, headers=_headers, **kwargs) + + class ModelInOperationOperations: """ .. warning:: @@ -559,3 +574,82 @@ def orphan_model_serializable( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) # type: ignore + + +class NamespaceUsageOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~specs.azure.clientgenerator.core.usage.UsageClient`'s + :attr:`namespace_usage` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: UsageClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def namespace_model_serializable( # pylint: disable=inconsistent-return-statements + self, body: Any, **kwargs: Any + ) -> None: + """Serialize the 'NamespaceModel' as request body. + + Expected body parameter: + + .. code-block:: json + + { + "name": "test" + }. + + :param body: Required. + :type body: any + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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 = kwargs.pop("params", {}) or {} + + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_namespace_usage_namespace_model_serializable_request( + content_type=content_type, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore