From 94bef6a805e37352f0f10e548d655b053084ab66 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 25 Feb 2022 08:55:34 +0000 Subject: [PATCH] CodeGen from PR 17983 in Azure/azure-rest-api-specs Merge 6c59d76302b471168b23c77415971e97eae27b4e into 9b57fabbf3290ba091b52003991915d68132f9c6 --- .../azure-mgmt-healthcareapis/_meta.json | 10 +- .../azure/mgmt/healthcareapis/__init__.py | 9 +- .../mgmt/healthcareapis/_configuration.py | 19 +- .../_healthcare_apis_management_client.py | 131 +- .../azure/mgmt/healthcareapis/_metadata.json | 21 +- .../azure/mgmt/healthcareapis/_patch.py | 31 + .../azure/mgmt/healthcareapis/_vendor.py | 27 + .../azure/mgmt/healthcareapis/_version.py | 2 +- .../azure/mgmt/healthcareapis/aio/__init__.py | 5 + .../mgmt/healthcareapis/aio/_configuration.py | 6 +- .../aio/_healthcare_apis_management_client.py | 117 +- .../azure/mgmt/healthcareapis/aio/_patch.py | 31 + .../operations/_dicom_services_operations.py | 305 ++- .../_fhir_destinations_operations.py | 67 +- .../operations/_fhir_services_operations.py | 305 ++- ...t_connector_fhir_destination_operations.py | 186 +- .../operations/_iot_connectors_operations.py | 305 ++- .../_operation_results_operations.py | 41 +- .../aio/operations/_operations.py | 47 +- ...private_endpoint_connections_operations.py | 234 +- .../_private_link_resources_operations.py | 76 +- .../aio/operations/_services_operations.py | 386 ++- .../aio/operations/_workspaces_operations.py | 334 ++- .../mgmt/healthcareapis/models/__init__.py | 189 +- ...healthcare_apis_management_client_enums.py | 43 +- .../mgmt/healthcareapis/models/_models.py | 2146 ----------------- .../mgmt/healthcareapis/models/_models_py3.py | 1049 +++++--- .../operations/_dicom_services_operations.py | 609 +++-- .../_fhir_destinations_operations.py | 126 +- .../operations/_fhir_services_operations.py | 609 +++-- ...t_connector_fhir_destination_operations.py | 391 +-- .../operations/_iot_connectors_operations.py | 609 +++-- .../_operation_results_operations.py | 97 +- .../healthcareapis/operations/_operations.py | 85 +- ...private_endpoint_connections_operations.py | 469 ++-- .../_private_link_resources_operations.py | 180 +- .../operations/_services_operations.py | 744 ++++-- .../operations/_workspaces_operations.py | 639 +++-- 38 files changed, 4989 insertions(+), 5691 deletions(-) create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_patch.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_vendor.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_patch.py delete mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models.py diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json index 31a5d6cb922c..5dcf75bf3b2a 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "84d82e9a8f422a930f4e0ffbe037ae9dce5fce3f", + "commit": "7213fa4cf1842491137481385469fa78522b9aec", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/healthcareapis/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/healthcareapis/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/healthcareapis/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/__init__.py index e290db30af1c..f058d20da10b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['HealthcareApisManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py index 7734c25ae3b9..4c43619cd7fd 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class HealthcareApisManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py index a15df30e957d..416432b4af21 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_healthcare_apis_management_client.py @@ -6,42 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import HealthcareApisManagementClientConfiguration +from .operations import DicomServicesOperations, FhirDestinationsOperations, FhirServicesOperations, IotConnectorFhirDestinationOperations, IotConnectorsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ServicesOperations, WorkspacesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import HealthcareApisManagementClientConfiguration -from .operations import ServicesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import WorkspacesOperations -from .operations import DicomServicesOperations -from .operations import IotConnectorsOperations -from .operations import FhirDestinationsOperations -from .operations import IotConnectorFhirDestinationOperations -from .operations import FhirServicesOperations -from .operations import Operations -from .operations import OperationResultsOperations -from . import models - -class HealthcareApisManagementClient(object): +class HealthcareApisManagementClient: """Azure Healthcare APIs Client. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.healthcareapis.operations.ServicesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.healthcareapis.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.healthcareapis.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.healthcareapis.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.healthcareapis.operations.PrivateLinkResourcesOperations :ivar workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.healthcareapis.operations.WorkspacesOperations :ivar dicom_services: DicomServicesOperations operations @@ -51,7 +41,8 @@ class HealthcareApisManagementClient(object): :ivar fhir_destinations: FhirDestinationsOperations operations :vartype fhir_destinations: azure.mgmt.healthcareapis.operations.FhirDestinationsOperations :ivar iot_connector_fhir_destination: IotConnectorFhirDestinationOperations operations - :vartype iot_connector_fhir_destination: azure.mgmt.healthcareapis.operations.IotConnectorFhirDestinationOperations + :vartype iot_connector_fhir_destination: + azure.mgmt.healthcareapis.operations.IotConnectorFhirDestinationOperations :ivar fhir_services: FhirServicesOperations operations :vartype fhir_services: azure.mgmt.healthcareapis.operations.FhirServicesOperations :ivar operations: Operations operations @@ -62,68 +53,64 @@ class HealthcareApisManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = HealthcareApisManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = HealthcareApisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.dicom_services = DicomServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.iot_connectors = IotConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.fhir_destinations = FhirDestinationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.iot_connector_fhir_destination = IotConnectorFhirDestinationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.fhir_services = FhirServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dicom_services = DicomServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.iot_connectors = IotConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fhir_destinations = FhirDestinationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.iot_connector_fhir_destination = IotConnectorFhirDestinationOperations(self._client, self._config, self._serialize, self._deserialize) + self.fhir_services = FhirServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_metadata.json b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_metadata.json index b1d8ee6d63f8..fca09a5fdd4c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_metadata.json +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_metadata.json @@ -5,13 +5,13 @@ "name": "HealthcareApisManagementClient", "filename": "_healthcare_apis_management_client", "description": "Azure Healthcare APIs Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HealthcareApisManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HealthcareApisManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HealthcareApisManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HealthcareApisManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "services": "ServicesOperations", diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_vendor.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py index 653b73a4a199..e5754a47ce68 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/__init__.py index 92e937d35c70..cb8e31834bad 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/__init__.py @@ -8,3 +8,8 @@ from ._healthcare_apis_management_client import HealthcareApisManagementClient __all__ = ['HealthcareApisManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py index 36fbfd1a34c9..db5bab487b7b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(HealthcareApisManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py index 6349e33e1e1a..82c9333ee111 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_healthcare_apis_management_client.py @@ -6,40 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import HealthcareApisManagementClientConfiguration +from .operations import DicomServicesOperations, FhirDestinationsOperations, FhirServicesOperations, IotConnectorFhirDestinationOperations, IotConnectorsOperations, OperationResultsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ServicesOperations, WorkspacesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import HealthcareApisManagementClientConfiguration -from .operations import ServicesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import WorkspacesOperations -from .operations import DicomServicesOperations -from .operations import IotConnectorsOperations -from .operations import FhirDestinationsOperations -from .operations import IotConnectorFhirDestinationOperations -from .operations import FhirServicesOperations -from .operations import Operations -from .operations import OperationResultsOperations -from .. import models - - -class HealthcareApisManagementClient(object): +class HealthcareApisManagementClient: """Azure Healthcare APIs Client. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.healthcareapis.aio.operations.ServicesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.healthcareapis.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.healthcareapis.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.healthcareapis.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.healthcareapis.aio.operations.PrivateLinkResourcesOperations :ivar workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.healthcareapis.aio.operations.WorkspacesOperations :ivar dicom_services: DicomServicesOperations operations @@ -49,7 +41,8 @@ class HealthcareApisManagementClient(object): :ivar fhir_destinations: FhirDestinationsOperations operations :vartype fhir_destinations: azure.mgmt.healthcareapis.aio.operations.FhirDestinationsOperations :ivar iot_connector_fhir_destination: IotConnectorFhirDestinationOperations operations - :vartype iot_connector_fhir_destination: azure.mgmt.healthcareapis.aio.operations.IotConnectorFhirDestinationOperations + :vartype iot_connector_fhir_destination: + azure.mgmt.healthcareapis.aio.operations.IotConnectorFhirDestinationOperations :ivar fhir_services: FhirServicesOperations operations :vartype fhir_services: azure.mgmt.healthcareapis.aio.operations.FhirServicesOperations :ivar operations: Operations operations @@ -60,66 +53,64 @@ class HealthcareApisManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = HealthcareApisManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = HealthcareApisManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.dicom_services = DicomServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.iot_connectors = IotConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fhir_destinations = FhirDestinationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.iot_connector_fhir_destination = IotConnectorFhirDestinationOperations(self._client, self._config, self._serialize, self._deserialize) + self.fhir_services = FhirServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.dicom_services = DicomServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.iot_connectors = IotConnectorsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.fhir_destinations = FhirDestinationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.iot_connector_fhir_destination = IotConnectorFhirDestinationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.fhir_services = FhirServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_results = OperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_patch.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py index 787848039f2c..0ebfd666b059 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._dicom_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_workspace( :param workspace_name: The name of workspace resource. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DicomServiceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.DicomServiceCollection] + :return: An iterator like instance of either DicomServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.DicomServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomServiceCollection"] @@ -65,36 +73,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DicomServiceCollection', pipeline_response) + deserialized = self._deserialize("DicomServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -143,34 +150,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + dicom_service_name=dicom_service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DicomService', pipeline_response) @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -194,40 +193,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(dicomservice, 'DicomService') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + dicom_service_name=dicom_service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(dicomservice, 'DicomService') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DicomService', pipeline_response) @@ -242,8 +230,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +255,19 @@ async def begin_create_or_update( :type dicomservice: ~azure.mgmt.healthcareapis.models.DicomService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DicomService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DicomService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +280,21 @@ async def begin_create_or_update( workspace_name=workspace_name, dicom_service_name=dicom_service_name, dicomservice=dicomservice, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DicomService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore async def _update_initial( @@ -333,40 +322,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(dicomservice_patch_resource, 'DicomServicePatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(dicomservice_patch_resource, 'DicomServicePatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DicomService', pipeline_response) @@ -378,8 +356,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -400,15 +381,19 @@ async def begin_update( :type dicomservice_patch_resource: ~azure.mgmt.healthcareapis.models.DicomServicePatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DicomService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DicomService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] lro_delay = kwargs.pop( 'polling_interval', @@ -421,28 +406,21 @@ async def begin_update( dicom_service_name=dicom_service_name, workspace_name=workspace_name, dicomservice_patch_resource=dicomservice_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DicomService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -454,6 +432,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore async def _delete_initial( @@ -468,41 +447,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -520,15 +490,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -543,22 +515,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -570,4 +534,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py index 3fb60eb7a0ee..2a746f8e4ae1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._fhir_destinations_operations import build_list_by_iot_connector_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_iot_connector( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_iot_connector( :param iot_connector_name: The name of IoT Connector resource. :type iot_connector_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IotFhirDestinationCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.IotFhirDestinationCollection] + :return: An iterator like instance of either IotFhirDestinationCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.IotFhirDestinationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestinationCollection"] @@ -66,37 +74,35 @@ def list_by_iot_connector( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_iot_connector.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_iot_connector_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + template_url=self.list_by_iot_connector.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_iot_connector_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IotFhirDestinationCollection', pipeline_response) + deserialized = self._deserialize("IotFhirDestinationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,12 +115,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py index 8d1422d589c1..02791ed7d9c5 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._fhir_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_workspace( :param workspace_name: The name of workspace resource. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FhirServiceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.FhirServiceCollection] + :return: An iterator like instance of either FhirServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.FhirServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirServiceCollection"] @@ -65,36 +73,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FhirServiceCollection', pipeline_response) + deserialized = self._deserialize("FhirServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -143,34 +150,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + fhir_service_name=fhir_service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FhirService', pipeline_response) @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -194,40 +193,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(fhirservice, 'FhirService') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + fhir_service_name=fhir_service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(fhirservice, 'FhirService') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FhirService', pipeline_response) @@ -242,8 +230,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +255,19 @@ async def begin_create_or_update( :type fhirservice: ~azure.mgmt.healthcareapis.models.FhirService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FhirService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FhirService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +280,21 @@ async def begin_create_or_update( workspace_name=workspace_name, fhir_service_name=fhir_service_name, fhirservice=fhirservice, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FhirService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore async def _update_initial( @@ -333,40 +322,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(fhirservice_patch_resource, 'FhirServicePatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(fhirservice_patch_resource, 'FhirServicePatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FhirService', pipeline_response) @@ -378,8 +356,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -400,15 +381,19 @@ async def begin_update( :type fhirservice_patch_resource: ~azure.mgmt.healthcareapis.models.FhirServicePatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either FhirService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either FhirService or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] lro_delay = kwargs.pop( 'polling_interval', @@ -421,28 +406,21 @@ async def begin_update( fhir_service_name=fhir_service_name, workspace_name=workspace_name, fhirservice_patch_resource=fhirservice_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FhirService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -454,6 +432,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore async def _delete_initial( @@ -468,41 +447,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -520,15 +490,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -543,22 +515,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -570,4 +534,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py index 1f262c87fa0f..2b538a9f90fc 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._iot_connector_fhir_destination_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotFhirDestination', pipeline_response) @@ -107,8 +102,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -123,41 +120,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(iot_fhir_destination, 'IotFhirDestination') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(iot_fhir_destination, 'IotFhirDestination') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IotFhirDestination', pipeline_response) @@ -172,8 +158,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +187,20 @@ async def begin_create_or_update( :type iot_fhir_destination: ~azure.mgmt.healthcareapis.models.IotFhirDestination :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either IotFhirDestination or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotFhirDestination or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestination"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +214,21 @@ async def begin_create_or_update( iot_connector_name=iot_connector_name, fhir_destination_name=fhir_destination_name, iot_fhir_destination=iot_fhir_destination, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IotFhirDestination', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +240,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore async def _delete_initial( @@ -269,42 +256,33 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -325,15 +303,17 @@ async def begin_delete( :type fhir_destination_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,23 +329,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -377,4 +348,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py index 510e0a3c367e..2c4758fdbdb2 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._iot_connectors_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_workspace( :param workspace_name: The name of workspace resource. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IotConnectorCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.IotConnectorCollection] + :return: An iterator like instance of either IotConnectorCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.IotConnectorCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnectorCollection"] @@ -65,36 +73,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IotConnectorCollection', pipeline_response) + deserialized = self._deserialize("IotConnectorCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -143,34 +150,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotConnector', pipeline_response) @@ -179,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -194,40 +193,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(iot_connector, 'IotConnector') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(iot_connector, 'IotConnector') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IotConnector', pipeline_response) @@ -242,8 +230,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +255,19 @@ async def begin_create_or_update( :type iot_connector: ~azure.mgmt.healthcareapis.models.IotConnector :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either IotConnector or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotConnector or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +280,21 @@ async def begin_create_or_update( workspace_name=workspace_name, iot_connector_name=iot_connector_name, iot_connector=iot_connector, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IotConnector', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore async def _update_initial( @@ -333,40 +322,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(iot_connector_patch_resource, 'IotConnectorPatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(iot_connector_patch_resource, 'IotConnectorPatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IotConnector', pipeline_response) @@ -378,8 +356,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -400,15 +381,19 @@ async def begin_update( :type iot_connector_patch_resource: ~azure.mgmt.healthcareapis.models.IotConnectorPatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either IotConnector or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IotConnector or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] lro_delay = kwargs.pop( 'polling_interval', @@ -421,28 +406,21 @@ async def begin_update( iot_connector_name=iot_connector_name, workspace_name=workspace_name, iot_connector_patch_resource=iot_connector_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IotConnector', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -454,6 +432,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore async def _delete_initial( @@ -468,41 +447,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -520,15 +490,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -543,22 +515,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -570,4 +534,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py index 3f2cb7302c12..7843512a4756 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operation_results_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operation_results_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location_name: str, @@ -62,33 +67,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationResultId': self._serialize.url("operation_result_id", operation_result_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_result_id=operation_result_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationResultsDescription', pipeline_response) @@ -97,4 +92,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}'} # type: ignore + diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py index 72ce6cf41e2f..93d33723b5b0 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ListOperations or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ListOperations] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ListOperations] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListOperations"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListOperations', pipeline_response) + deserialized = self._deserialize("ListOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py index 5236d1f836b3..8a03dfe30ef1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_service( :param resource_name: The name of the service instance. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResultDescription or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionListResultDescription] + :return: An iterator like instance of either PrivateEndpointConnectionListResultDescription or + the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionListResultDescription] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultDescription"] @@ -65,36 +73,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResultDescription', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResultDescription", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,34 +151,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionDescription', pipeline_response) @@ -180,8 +177,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -195,40 +194,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionDescription', pipeline_response) @@ -236,8 +224,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -259,15 +250,20 @@ async def begin_create_or_update( :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnectionDescription + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +276,21 @@ async def begin_create_or_update( resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnectionDescription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -313,6 +302,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -327,41 +317,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -380,15 +361,17 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -403,22 +386,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -430,4 +405,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py index ba07bc065640..48551092ccd7 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_by_service_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_service( self, resource_group_name: str, @@ -62,33 +67,23 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResultDescription', pipeline_response) @@ -97,8 +92,11 @@ async def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -124,34 +122,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'groupName': self._serialize.url("group_name", group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + group_name=group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceDescription', pipeline_response) @@ -160,4 +148,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}'} # type: ignore + diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py index 06ab811652ac..2b2cea73e0cf 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_services_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,33 +71,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServicesDescription', pipeline_response) @@ -100,8 +96,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -114,39 +112,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(service_description, 'ServicesDescription') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(service_description, 'ServicesDescription') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ServicesDescription', pipeline_response) @@ -158,8 +145,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -177,15 +167,20 @@ async def begin_create_or_update( :type service_description: ~azure.mgmt.healthcareapis.models.ServicesDescription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServicesDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServicesDescription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -197,27 +192,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, service_description=service_description, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServicesDescription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -229,6 +218,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore async def _update_initial( @@ -243,39 +233,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(service_patch_description, 'ServicesPatchDescription') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(service_patch_description, 'ServicesPatchDescription') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServicesDescription', pipeline_response) @@ -283,8 +262,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -302,15 +284,20 @@ async def begin_update( :type service_patch_description: ~azure.mgmt.healthcareapis.models.ServicesPatchDescription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServicesDescription or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServicesDescription or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -322,27 +309,21 @@ async def begin_update( resource_group_name=resource_group_name, resource_name=resource_name, service_patch_description=service_patch_description, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServicesDescription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,6 +335,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore async def _delete_initial( @@ -367,40 +349,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -415,15 +388,17 @@ async def begin_delete( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -437,21 +412,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -463,8 +431,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -472,8 +442,10 @@ def list( """Get all the service instances in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServicesDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] + :return: An iterator like instance of either ServicesDescriptionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescriptionListResult"] @@ -481,34 +453,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServicesDescriptionListResult', pipeline_response) + deserialized = self._deserialize("ServicesDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -521,17 +488,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -542,8 +511,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group that contains the service instance. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServicesDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] + :return: An iterator like instance of either ServicesDescriptionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescriptionListResult"] @@ -551,35 +522,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServicesDescriptionListResult', pipeline_response) + deserialized = self._deserialize("ServicesDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,17 +559,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services'} # type: ignore + @distributed_trace_async async def check_name_availability( self, check_name_availability_inputs: "_models.CheckNameAvailabilityParameters", @@ -612,7 +581,8 @@ async def check_name_availability( :param check_name_availability_inputs: Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. - :type check_name_availability_inputs: ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters + :type check_name_availability_inputs: + ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ServicesNameAvailabilityInfo, or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo @@ -623,36 +593,26 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_name_availability_inputs, 'CheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(check_name_availability_inputs, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServicesNameAvailabilityInfo', pipeline_response) @@ -661,4 +621,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability'} # type: ignore + diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py index a1e1b1a5d1d4..c855d3549704 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspaces_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -51,7 +57,8 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.WorkspaceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.WorkspaceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] @@ -59,34 +66,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,17 +101,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -121,7 +125,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.WorkspaceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.WorkspaceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] @@ -129,35 +134,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -170,17 +171,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -203,33 +206,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Workspace', pipeline_response) @@ -238,8 +231,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -252,39 +247,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(workspace, 'Workspace') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -299,8 +283,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -318,15 +305,19 @@ async def begin_create_or_update( :type workspace: ~azure.mgmt.healthcareapis.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -338,27 +329,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace=workspace, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,6 +355,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore async def _update_initial( @@ -384,39 +370,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(workspace_patch_resource, 'WorkspacePatchResource') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace_patch_resource, 'WorkspacePatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -428,8 +403,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -447,15 +425,19 @@ async def begin_update( :type workspace_patch_resource: ~azure.mgmt.healthcareapis.models.WorkspacePatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -467,27 +449,21 @@ async def begin_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace_patch_resource=workspace_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -499,6 +475,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore async def _delete_initial( @@ -512,40 +489,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -560,15 +528,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -582,21 +552,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -608,4 +571,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py index 29d388266366..86012083e812 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/__init__.py @@ -6,132 +6,69 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CheckNameAvailabilityParameters - from ._models_py3 import DicomService - from ._models_py3 import DicomServiceAuthenticationConfiguration - from ._models_py3 import DicomServiceCollection - from ._models_py3 import DicomServicePatchResource - from ._models_py3 import Error - from ._models_py3 import ErrorDetails - from ._models_py3 import ErrorDetailsInternal - from ._models_py3 import FhirService - from ._models_py3 import FhirServiceAccessPolicyEntry - from ._models_py3 import FhirServiceAcrConfiguration - from ._models_py3 import FhirServiceAuthenticationConfiguration - from ._models_py3 import FhirServiceCollection - from ._models_py3 import FhirServiceCorsConfiguration - from ._models_py3 import FhirServiceExportConfiguration - from ._models_py3 import FhirServicePatchResource - from ._models_py3 import IotConnector - from ._models_py3 import IotConnectorCollection - from ._models_py3 import IotConnectorPatchResource - from ._models_py3 import IotDestinationProperties - from ._models_py3 import IotEventHubIngestionEndpointConfiguration - from ._models_py3 import IotFhirDestination - from ._models_py3 import IotFhirDestinationCollection - from ._models_py3 import IotFhirDestinationProperties - from ._models_py3 import IotMappingProperties - from ._models_py3 import ListOperations - from ._models_py3 import LocationBasedResource - from ._models_py3 import OperationDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationResultsDescription - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionDescription - from ._models_py3 import PrivateEndpointConnectionListResultDescription - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceDescription - from ._models_py3 import PrivateLinkResourceListResultDescription - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import ResourceCore - from ._models_py3 import ResourceTags - from ._models_py3 import ServiceAccessPolicyEntry - from ._models_py3 import ServiceAcrConfigurationInfo - from ._models_py3 import ServiceAuthenticationConfigurationInfo - from ._models_py3 import ServiceCorsConfigurationInfo - from ._models_py3 import ServiceCosmosDbConfigurationInfo - from ._models_py3 import ServiceExportConfigurationInfo - from ._models_py3 import ServiceManagedIdentity - from ._models_py3 import ServiceManagedIdentityIdentity - from ._models_py3 import ServicesDescription - from ._models_py3 import ServicesDescriptionListResult - from ._models_py3 import ServicesNameAvailabilityInfo - from ._models_py3 import ServicesPatchDescription - from ._models_py3 import ServicesProperties - from ._models_py3 import ServicesResource - from ._models_py3 import ServicesResourceIdentity - from ._models_py3 import SystemData - from ._models_py3 import TaggedResource - from ._models_py3 import Workspace - from ._models_py3 import WorkspaceList - from ._models_py3 import WorkspacePatchResource - from ._models_py3 import WorkspaceProperties -except (SyntaxError, ImportError): - from ._models import CheckNameAvailabilityParameters # type: ignore - from ._models import DicomService # type: ignore - from ._models import DicomServiceAuthenticationConfiguration # type: ignore - from ._models import DicomServiceCollection # type: ignore - from ._models import DicomServicePatchResource # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorDetails # type: ignore - from ._models import ErrorDetailsInternal # type: ignore - from ._models import FhirService # type: ignore - from ._models import FhirServiceAccessPolicyEntry # type: ignore - from ._models import FhirServiceAcrConfiguration # type: ignore - from ._models import FhirServiceAuthenticationConfiguration # type: ignore - from ._models import FhirServiceCollection # type: ignore - from ._models import FhirServiceCorsConfiguration # type: ignore - from ._models import FhirServiceExportConfiguration # type: ignore - from ._models import FhirServicePatchResource # type: ignore - from ._models import IotConnector # type: ignore - from ._models import IotConnectorCollection # type: ignore - from ._models import IotConnectorPatchResource # type: ignore - from ._models import IotDestinationProperties # type: ignore - from ._models import IotEventHubIngestionEndpointConfiguration # type: ignore - from ._models import IotFhirDestination # type: ignore - from ._models import IotFhirDestinationCollection # type: ignore - from ._models import IotFhirDestinationProperties # type: ignore - from ._models import IotMappingProperties # type: ignore - from ._models import ListOperations # type: ignore - from ._models import LocationBasedResource # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationResultsDescription # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionDescription # type: ignore - from ._models import PrivateEndpointConnectionListResultDescription # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceDescription # type: ignore - from ._models import PrivateLinkResourceListResultDescription # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceCore # type: ignore - from ._models import ResourceTags # type: ignore - from ._models import ServiceAccessPolicyEntry # type: ignore - from ._models import ServiceAcrConfigurationInfo # type: ignore - from ._models import ServiceAuthenticationConfigurationInfo # type: ignore - from ._models import ServiceCorsConfigurationInfo # type: ignore - from ._models import ServiceCosmosDbConfigurationInfo # type: ignore - from ._models import ServiceExportConfigurationInfo # type: ignore - from ._models import ServiceManagedIdentity # type: ignore - from ._models import ServiceManagedIdentityIdentity # type: ignore - from ._models import ServicesDescription # type: ignore - from ._models import ServicesDescriptionListResult # type: ignore - from ._models import ServicesNameAvailabilityInfo # type: ignore - from ._models import ServicesPatchDescription # type: ignore - from ._models import ServicesProperties # type: ignore - from ._models import ServicesResource # type: ignore - from ._models import ServicesResourceIdentity # type: ignore - from ._models import SystemData # type: ignore - from ._models import TaggedResource # type: ignore - from ._models import Workspace # type: ignore - from ._models import WorkspaceList # type: ignore - from ._models import WorkspacePatchResource # type: ignore - from ._models import WorkspaceProperties # type: ignore +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import DicomService +from ._models_py3 import DicomServiceAuthenticationConfiguration +from ._models_py3 import DicomServiceCollection +from ._models_py3 import DicomServicePatchResource +from ._models_py3 import Error +from ._models_py3 import ErrorDetails +from ._models_py3 import ErrorDetailsInternal +from ._models_py3 import FhirService +from ._models_py3 import FhirServiceAccessPolicyEntry +from ._models_py3 import FhirServiceAcrConfiguration +from ._models_py3 import FhirServiceAuthenticationConfiguration +from ._models_py3 import FhirServiceCollection +from ._models_py3 import FhirServiceCorsConfiguration +from ._models_py3 import FhirServiceExportConfiguration +from ._models_py3 import FhirServicePatchResource +from ._models_py3 import IotConnector +from ._models_py3 import IotConnectorCollection +from ._models_py3 import IotConnectorPatchResource +from ._models_py3 import IotDestinationProperties +from ._models_py3 import IotEventHubIngestionEndpointConfiguration +from ._models_py3 import IotFhirDestination +from ._models_py3 import IotFhirDestinationCollection +from ._models_py3 import IotFhirDestinationProperties +from ._models_py3 import IotMappingProperties +from ._models_py3 import ListOperations +from ._models_py3 import LocationBasedResource +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationResultsDescription +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionDescription +from ._models_py3 import PrivateEndpointConnectionListResultDescription +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceDescription +from ._models_py3 import PrivateLinkResourceListResultDescription +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceCore +from ._models_py3 import ResourceTags +from ._models_py3 import ServiceAccessPolicyEntry +from ._models_py3 import ServiceAcrConfigurationInfo +from ._models_py3 import ServiceAuthenticationConfigurationInfo +from ._models_py3 import ServiceCorsConfigurationInfo +from ._models_py3 import ServiceCosmosDbConfigurationInfo +from ._models_py3 import ServiceExportConfigurationInfo +from ._models_py3 import ServiceManagedIdentity +from ._models_py3 import ServiceManagedIdentityIdentity +from ._models_py3 import ServicesDescription +from ._models_py3 import ServicesDescriptionListResult +from ._models_py3 import ServicesNameAvailabilityInfo +from ._models_py3 import ServicesPatchDescription +from ._models_py3 import ServicesProperties +from ._models_py3 import ServicesResource +from ._models_py3 import ServicesResourceIdentity +from ._models_py3 import SystemData +from ._models_py3 import TaggedResource +from ._models_py3 import Workspace +from ._models_py3 import WorkspaceList +from ._models_py3 import WorkspacePatchResource +from ._models_py3 import WorkspaceProperties + from ._healthcare_apis_management_client_enums import ( ActionType, diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py index 571eb62aadad..7b24187848ef 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_healthcare_apis_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -41,21 +26,21 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class FhirServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FhirServiceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of the service. """ FHIR_STU3 = "fhir-Stu3" FHIR_R4 = "fhir-R4" -class IotIdentityResolutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IotIdentityResolutionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of IoT identity resolution to use with the destination. """ CREATE = "Create" LOOKUP = "Lookup" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of the service. """ @@ -63,14 +48,14 @@ class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FHIR_STU3 = "fhir-Stu3" FHIR_R4 = "fhir-R4" -class ManagedServiceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of identity being specified, currently SystemAssigned and None are allowed. """ SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" -class OperationResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the operation being performed. """ @@ -80,7 +65,7 @@ class OperationResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) REQUESTED = "Requested" RUNNING = "Running" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -89,7 +74,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -97,7 +82,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state. """ @@ -115,7 +100,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNED = "Warned" SYSTEM_MAINTENANCE = "SystemMaintenance" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. """ @@ -123,7 +108,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class ServiceNameUnavailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceNameUnavailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason for unavailability. """ diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models.py deleted file mode 100644 index 9664b3639c39..000000000000 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models.py +++ /dev/null @@ -1,2146 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class CheckNameAvailabilityParameters(msrest.serialization.Model): - """Input values. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the service instance to check. - :type name: str - :param type: Required. The fully qualified resource type which includes provider namespace. - :type type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class ResourceCore(msrest.serialization.Model): - """The common properties for any resource, tracked or proxy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceCore, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = kwargs.get('etag', None) - - -class LocationBasedResource(ResourceCore): - """The common properties for any location based resource, tracked or proxy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LocationBasedResource, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - - -class ResourceTags(msrest.serialization.Model): - """List of key value pairs that describe the resource. This will overwrite the existing tags. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceTags, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class TaggedResource(ResourceTags, LocationBasedResource): - """The common properties of tracked resources in the service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TaggedResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = kwargs.get('etag', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class DicomService(TaggedResource): - """The description of Dicom Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param authentication_configuration: Dicom Service authentication configuration. - :type authentication_configuration: - ~azure.mgmt.healthcareapis.models.DicomServiceAuthenticationConfiguration - :ivar service_url: The url of the Dicom Services. - :vartype service_url: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'service_url': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'authentication_configuration': {'key': 'properties.authenticationConfiguration', 'type': 'DicomServiceAuthenticationConfiguration'}, - 'service_url': {'key': 'properties.serviceUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DicomService, self).__init__(**kwargs) - self.system_data = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.authentication_configuration = kwargs.get('authentication_configuration', None) - self.service_url = None - - -class DicomServiceAuthenticationConfiguration(msrest.serialization.Model): - """Authentication configuration information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar authority: The authority url for the service. - :vartype authority: str - :ivar audiences: The audiences for the service. - :vartype audiences: list[str] - """ - - _validation = { - 'authority': {'readonly': True}, - 'audiences': {'readonly': True}, - } - - _attribute_map = { - 'authority': {'key': 'authority', 'type': 'str'}, - 'audiences': {'key': 'audiences', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DicomServiceAuthenticationConfiguration, self).__init__(**kwargs) - self.authority = None - self.audiences = None - - -class DicomServiceCollection(msrest.serialization.Model): - """The collection of Dicom Services. - - :param next_link: The link used to get the next page of Dicom Services. - :type next_link: str - :param value: The list of Dicom Services. - :type value: list[~azure.mgmt.healthcareapis.models.DicomService] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[DicomService]'}, - } - - def __init__( - self, - **kwargs - ): - super(DicomServiceCollection, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class DicomServicePatchResource(ResourceTags): - """Dicom Service patch properties. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DicomServicePatchResource, self).__init__(**kwargs) - - -class Error(msrest.serialization.Model): - """Error details. - - :param error: Error details. - :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetailsInternal'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorDetails(msrest.serialization.Model): - """Error details. - - :param error: Error details. - :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetailsInternal'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetails, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorDetailsInternal(msrest.serialization.Model): - """Error details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The target of the particular error. - :vartype target: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetailsInternal, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - - -class ServiceManagedIdentity(msrest.serialization.Model): - """The managed identity of a service. - - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ServiceManagedIdentityIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceManagedIdentity, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - - -class FhirService(TaggedResource, ServiceManagedIdentity): - """The description of Fhir Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param kind: The kind of the service. Possible values include: "fhir-Stu3", "fhir-R4". - :type kind: str or ~azure.mgmt.healthcareapis.models.FhirServiceKind - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param access_policies: Fhir Service access policies. - :type access_policies: list[~azure.mgmt.healthcareapis.models.FhirServiceAccessPolicyEntry] - :param acr_configuration: Fhir Service Azure container registry configuration. - :type acr_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceAcrConfiguration - :param authentication_configuration: Fhir Service authentication configuration. - :type authentication_configuration: - ~azure.mgmt.healthcareapis.models.FhirServiceAuthenticationConfiguration - :param cors_configuration: Fhir Service Cors configuration. - :type cors_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceCorsConfiguration - :param export_configuration: Fhir Service export configuration. - :type export_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceExportConfiguration - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ServiceManagedIdentityIdentity'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'access_policies': {'key': 'properties.accessPolicies', 'type': '[FhirServiceAccessPolicyEntry]'}, - 'acr_configuration': {'key': 'properties.acrConfiguration', 'type': 'FhirServiceAcrConfiguration'}, - 'authentication_configuration': {'key': 'properties.authenticationConfiguration', 'type': 'FhirServiceAuthenticationConfiguration'}, - 'cors_configuration': {'key': 'properties.corsConfiguration', 'type': 'FhirServiceCorsConfiguration'}, - 'export_configuration': {'key': 'properties.exportConfiguration', 'type': 'FhirServiceExportConfiguration'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirService, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.kind = kwargs.get('kind', None) - self.system_data = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.access_policies = kwargs.get('access_policies', None) - self.acr_configuration = kwargs.get('acr_configuration', None) - self.authentication_configuration = kwargs.get('authentication_configuration', None) - self.cors_configuration = kwargs.get('cors_configuration', None) - self.export_configuration = kwargs.get('export_configuration', None) - self.id = None - self.name = None - self.type = None - self.etag = kwargs.get('etag', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.kind = kwargs.get('kind', None) - self.system_data = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.access_policies = kwargs.get('access_policies', None) - self.acr_configuration = kwargs.get('acr_configuration', None) - self.authentication_configuration = kwargs.get('authentication_configuration', None) - self.cors_configuration = kwargs.get('cors_configuration', None) - self.export_configuration = kwargs.get('export_configuration', None) - - -class FhirServiceAccessPolicyEntry(msrest.serialization.Model): - """An access policy entry. - - All required parameters must be populated in order to send to Azure. - - :param object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to the - FHIR service. - :type object_id: str - """ - - _validation = { - 'object_id': {'required': True, 'pattern': r'^(([0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}){1})+$'}, - } - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServiceAccessPolicyEntry, self).__init__(**kwargs) - self.object_id = kwargs['object_id'] - - -class FhirServiceAcrConfiguration(msrest.serialization.Model): - """Azure container registry configuration information. - - :param login_servers: The list of the Azure container registry login servers. - :type login_servers: list[str] - """ - - _attribute_map = { - 'login_servers': {'key': 'loginServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServiceAcrConfiguration, self).__init__(**kwargs) - self.login_servers = kwargs.get('login_servers', None) - - -class FhirServiceAuthenticationConfiguration(msrest.serialization.Model): - """Authentication configuration information. - - :param authority: The authority url for the service. - :type authority: str - :param audience: The audience url for the service. - :type audience: str - :param smart_proxy_enabled: If the SMART on FHIR proxy is enabled. - :type smart_proxy_enabled: bool - """ - - _attribute_map = { - 'authority': {'key': 'authority', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'smart_proxy_enabled': {'key': 'smartProxyEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServiceAuthenticationConfiguration, self).__init__(**kwargs) - self.authority = kwargs.get('authority', None) - self.audience = kwargs.get('audience', None) - self.smart_proxy_enabled = kwargs.get('smart_proxy_enabled', None) - - -class FhirServiceCollection(msrest.serialization.Model): - """A collection of Fhir services. - - :param next_link: The link used to get the next page of Fhir Services. - :type next_link: str - :param value: The list of Fhir Services. - :type value: list[~azure.mgmt.healthcareapis.models.FhirService] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[FhirService]'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServiceCollection, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class FhirServiceCorsConfiguration(msrest.serialization.Model): - """The settings for the CORS configuration of the service instance. - - :param origins: The origins to be allowed via CORS. - :type origins: list[str] - :param headers: The headers to be allowed via CORS. - :type headers: list[str] - :param methods: The methods to be allowed via CORS. - :type methods: list[str] - :param max_age: The max age to be allowed via CORS. - :type max_age: int - :param allow_credentials: If credentials are allowed via CORS. - :type allow_credentials: bool - """ - - _validation = { - 'max_age': {'maximum': 99999, 'minimum': 0}, - } - - _attribute_map = { - 'origins': {'key': 'origins', 'type': '[str]'}, - 'headers': {'key': 'headers', 'type': '[str]'}, - 'methods': {'key': 'methods', 'type': '[str]'}, - 'max_age': {'key': 'maxAge', 'type': 'int'}, - 'allow_credentials': {'key': 'allowCredentials', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServiceCorsConfiguration, self).__init__(**kwargs) - self.origins = kwargs.get('origins', None) - self.headers = kwargs.get('headers', None) - self.methods = kwargs.get('methods', None) - self.max_age = kwargs.get('max_age', None) - self.allow_credentials = kwargs.get('allow_credentials', None) - - -class FhirServiceExportConfiguration(msrest.serialization.Model): - """Export operation configuration information. - - :param storage_account_name: The name of the default export storage account. - :type storage_account_name: str - """ - - _attribute_map = { - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServiceExportConfiguration, self).__init__(**kwargs) - self.storage_account_name = kwargs.get('storage_account_name', None) - - -class FhirServicePatchResource(ResourceTags, ServiceManagedIdentity): - """FhirService patch properties. - - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ServiceManagedIdentityIdentity'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(FhirServicePatchResource, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - - -class IotConnector(TaggedResource, ServiceManagedIdentity): - """IoT Connector definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param ingestion_endpoint_configuration: Source configuration. - :type ingestion_endpoint_configuration: - ~azure.mgmt.healthcareapis.models.IotEventHubIngestionEndpointConfiguration - :param device_mapping: Device Mappings. - :type device_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ServiceManagedIdentityIdentity'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'ingestion_endpoint_configuration': {'key': 'properties.ingestionEndpointConfiguration', 'type': 'IotEventHubIngestionEndpointConfiguration'}, - 'device_mapping': {'key': 'properties.deviceMapping', 'type': 'IotMappingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(IotConnector, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.ingestion_endpoint_configuration = kwargs.get('ingestion_endpoint_configuration', None) - self.device_mapping = kwargs.get('device_mapping', None) - self.id = None - self.name = None - self.type = None - self.etag = kwargs.get('etag', None) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.system_data = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.ingestion_endpoint_configuration = kwargs.get('ingestion_endpoint_configuration', None) - self.device_mapping = kwargs.get('device_mapping', None) - - -class IotConnectorCollection(msrest.serialization.Model): - """A collection of IoT Connectors. - - :param next_link: The link used to get the next page of IoT Connectors. - :type next_link: str - :param value: The list of IoT Connectors. - :type value: list[~azure.mgmt.healthcareapis.models.IotConnector] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[IotConnector]'}, - } - - def __init__( - self, - **kwargs - ): - super(IotConnectorCollection, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class IotConnectorPatchResource(ResourceTags, ServiceManagedIdentity): - """Iot Connector patch properties. - - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'ServiceManagedIdentityIdentity'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(IotConnectorPatchResource, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.tags = kwargs.get('tags', None) - - -class IotDestinationProperties(msrest.serialization.Model): - """Common IoT Connector destination properties. - - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - """ - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IotDestinationProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class IotEventHubIngestionEndpointConfiguration(msrest.serialization.Model): - """Event Hub ingestion endpoint configuration. - - :param event_hub_name: Event Hub name to connect to. - :type event_hub_name: str - :param consumer_group: Consumer group of the event hub to connected to. - :type consumer_group: str - :param fully_qualified_event_hub_namespace: Fully qualified namespace of the Event Hub to - connect to. - :type fully_qualified_event_hub_namespace: str - """ - - _attribute_map = { - 'event_hub_name': {'key': 'eventHubName', 'type': 'str'}, - 'consumer_group': {'key': 'consumerGroup', 'type': 'str'}, - 'fully_qualified_event_hub_namespace': {'key': 'fullyQualifiedEventHubNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IotEventHubIngestionEndpointConfiguration, self).__init__(**kwargs) - self.event_hub_name = kwargs.get('event_hub_name', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.fully_qualified_event_hub_namespace = kwargs.get('fully_qualified_event_hub_namespace', None) - - -class IotFhirDestination(LocationBasedResource): - """IoT Connector FHIR destination definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param resource_identity_resolution_type: Required. Determines how resource identity is - resolved on the destination. Possible values include: "Create", "Lookup". - :type resource_identity_resolution_type: str or - ~azure.mgmt.healthcareapis.models.IotIdentityResolutionType - :param fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to - connect to. - :type fhir_service_resource_id: str - :param fhir_mapping: Required. FHIR Mappings. - :type fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'resource_identity_resolution_type': {'required': True}, - 'fhir_service_resource_id': {'required': True}, - 'fhir_mapping': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'resource_identity_resolution_type': {'key': 'properties.resourceIdentityResolutionType', 'type': 'str'}, - 'fhir_service_resource_id': {'key': 'properties.fhirServiceResourceId', 'type': 'str'}, - 'fhir_mapping': {'key': 'properties.fhirMapping', 'type': 'IotMappingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(IotFhirDestination, self).__init__(**kwargs) - self.system_data = None - self.provisioning_state = kwargs.get('provisioning_state', None) - self.resource_identity_resolution_type = kwargs['resource_identity_resolution_type'] - self.fhir_service_resource_id = kwargs['fhir_service_resource_id'] - self.fhir_mapping = kwargs['fhir_mapping'] - - -class IotFhirDestinationCollection(msrest.serialization.Model): - """A collection of IoT Connector FHIR destinations. - - :param next_link: The link used to get the next page of IoT FHIR destinations. - :type next_link: str - :param value: The list of IoT Connector FHIR destinations. - :type value: list[~azure.mgmt.healthcareapis.models.IotFhirDestination] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[IotFhirDestination]'}, - } - - def __init__( - self, - **kwargs - ): - super(IotFhirDestinationCollection, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class IotFhirDestinationProperties(IotDestinationProperties): - """IoT Connector destination properties for an Azure FHIR service. - - All required parameters must be populated in order to send to Azure. - - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param resource_identity_resolution_type: Required. Determines how resource identity is - resolved on the destination. Possible values include: "Create", "Lookup". - :type resource_identity_resolution_type: str or - ~azure.mgmt.healthcareapis.models.IotIdentityResolutionType - :param fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to - connect to. - :type fhir_service_resource_id: str - :param fhir_mapping: Required. FHIR Mappings. - :type fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties - """ - - _validation = { - 'resource_identity_resolution_type': {'required': True}, - 'fhir_service_resource_id': {'required': True}, - 'fhir_mapping': {'required': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_identity_resolution_type': {'key': 'resourceIdentityResolutionType', 'type': 'str'}, - 'fhir_service_resource_id': {'key': 'fhirServiceResourceId', 'type': 'str'}, - 'fhir_mapping': {'key': 'fhirMapping', 'type': 'IotMappingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(IotFhirDestinationProperties, self).__init__(**kwargs) - self.resource_identity_resolution_type = kwargs['resource_identity_resolution_type'] - self.fhir_service_resource_id = kwargs['fhir_service_resource_id'] - self.fhir_mapping = kwargs['fhir_mapping'] - - -class IotMappingProperties(msrest.serialization.Model): - """The mapping content. - - :param content: The mapping. - :type content: any - """ - - _attribute_map = { - 'content': {'key': 'content', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(IotMappingProperties, self).__init__(**kwargs) - self.content = kwargs.get('content', None) - - -class ListOperations(msrest.serialization.Model): - """Available operations of the service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.healthcareapis.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :type next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListOperations, self).__init__(**kwargs) - self.value = None - self.next_link = kwargs.get('next_link', None) - - -class OperationDetail(msrest.serialization.Model): - """Service REST API operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the operation. - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.healthcareapis.models.OperationDisplay - :ivar origin: Default value is 'user,system'. - :vartype origin: str - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.healthcareapis.models.ActionType - """ - - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDetail, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = kwargs.get('display', None) - self.origin = None - self.action_type = None - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: Service provider: Microsoft.HealthcareApis. - :vartype provider: str - :ivar resource: Resource Type: Services. - :vartype resource: str - :ivar operation: Name of the operation. - :vartype operation: str - :ivar description: Friendly description for the operation,. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationResultsDescription(msrest.serialization.Model): - """The properties indicating the operation result of an operation on a service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ID of the operation returned. - :vartype id: str - :ivar name: The name of the operation result. - :vartype name: str - :ivar status: The status of the operation being performed. Possible values include: "Canceled", - "Succeeded", "Failed", "Requested", "Running". - :vartype status: str or ~azure.mgmt.healthcareapis.models.OperationResultStatus - :ivar start_time: The time that the operation was started. - :vartype start_time: str - :param properties: Additional properties of the operation result. - :type properties: any - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'start_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResultsDescription, self).__init__(**kwargs) - self.id = None - self.name = None - self.status = None - self.start_time = None - self.properties = kwargs.get('properties', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.healthcareapis.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionDescription(PrivateEndpointConnection): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~azure.mgmt.healthcareapis.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionProvisioningState - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionDescription, self).__init__(**kwargs) - self.system_data = None - - -class PrivateEndpointConnectionListResultDescription(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResultDescription, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceDescription(PrivateLinkResource): - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceDescription, self).__init__(**kwargs) - self.system_data = None - - -class PrivateLinkResourceListResultDescription(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResourceDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResultDescription, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.healthcareapis.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ServiceAccessPolicyEntry(msrest.serialization.Model): - """An access policy entry. - - All required parameters must be populated in order to send to Azure. - - :param object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to the - FHIR service. - :type object_id: str - """ - - _validation = { - 'object_id': {'required': True, 'pattern': r'^(([0-9A-Fa-f]{8}[-]?(?:[0-9A-Fa-f]{4}[-]?){3}[0-9A-Fa-f]{12}){1})+$'}, - } - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceAccessPolicyEntry, self).__init__(**kwargs) - self.object_id = kwargs['object_id'] - - -class ServiceAcrConfigurationInfo(msrest.serialization.Model): - """Azure container registry configuration information. - - :param login_servers: The list of the ACR login servers. - :type login_servers: list[str] - """ - - _attribute_map = { - 'login_servers': {'key': 'loginServers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceAcrConfigurationInfo, self).__init__(**kwargs) - self.login_servers = kwargs.get('login_servers', None) - - -class ServiceAuthenticationConfigurationInfo(msrest.serialization.Model): - """Authentication configuration information. - - :param authority: The authority url for the service. - :type authority: str - :param audience: The audience url for the service. - :type audience: str - :param smart_proxy_enabled: If the SMART on FHIR proxy is enabled. - :type smart_proxy_enabled: bool - """ - - _attribute_map = { - 'authority': {'key': 'authority', 'type': 'str'}, - 'audience': {'key': 'audience', 'type': 'str'}, - 'smart_proxy_enabled': {'key': 'smartProxyEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceAuthenticationConfigurationInfo, self).__init__(**kwargs) - self.authority = kwargs.get('authority', None) - self.audience = kwargs.get('audience', None) - self.smart_proxy_enabled = kwargs.get('smart_proxy_enabled', None) - - -class ServiceCorsConfigurationInfo(msrest.serialization.Model): - """The settings for the CORS configuration of the service instance. - - :param origins: The origins to be allowed via CORS. - :type origins: list[str] - :param headers: The headers to be allowed via CORS. - :type headers: list[str] - :param methods: The methods to be allowed via CORS. - :type methods: list[str] - :param max_age: The max age to be allowed via CORS. - :type max_age: int - :param allow_credentials: If credentials are allowed via CORS. - :type allow_credentials: bool - """ - - _validation = { - 'max_age': {'maximum': 99999, 'minimum': 0}, - } - - _attribute_map = { - 'origins': {'key': 'origins', 'type': '[str]'}, - 'headers': {'key': 'headers', 'type': '[str]'}, - 'methods': {'key': 'methods', 'type': '[str]'}, - 'max_age': {'key': 'maxAge', 'type': 'int'}, - 'allow_credentials': {'key': 'allowCredentials', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceCorsConfigurationInfo, self).__init__(**kwargs) - self.origins = kwargs.get('origins', None) - self.headers = kwargs.get('headers', None) - self.methods = kwargs.get('methods', None) - self.max_age = kwargs.get('max_age', None) - self.allow_credentials = kwargs.get('allow_credentials', None) - - -class ServiceCosmosDbConfigurationInfo(msrest.serialization.Model): - """The settings for the Cosmos DB database backing the service. - - :param offer_throughput: The provisioned throughput for the backing database. - :type offer_throughput: int - :param key_vault_key_uri: The URI of the customer-managed key for the backing database. - :type key_vault_key_uri: str - """ - - _validation = { - 'offer_throughput': {'maximum': 10000, 'minimum': 400}, - } - - _attribute_map = { - 'offer_throughput': {'key': 'offerThroughput', 'type': 'int'}, - 'key_vault_key_uri': {'key': 'keyVaultKeyUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceCosmosDbConfigurationInfo, self).__init__(**kwargs) - self.offer_throughput = kwargs.get('offer_throughput', None) - self.key_vault_key_uri = kwargs.get('key_vault_key_uri', None) - - -class ServiceExportConfigurationInfo(msrest.serialization.Model): - """Export operation configuration information. - - :param storage_account_name: The name of the default export storage account. - :type storage_account_name: str - """ - - _attribute_map = { - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceExportConfigurationInfo, self).__init__(**kwargs) - self.storage_account_name = kwargs.get('storage_account_name', None) - - -class ServiceManagedIdentityIdentity(msrest.serialization.Model): - """Setting indicating whether the service has a managed identity associated with it. - - :param type: Type of identity being specified, currently SystemAssigned and None are allowed. - Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceManagedIdentityIdentity, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - - -class ServicesResource(msrest.serialization.Model): - """The common properties of a service. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", - "fhir-R4". - :type kind: str or ~azure.mgmt.healthcareapis.models.Kind - :param location: Required. The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ServicesResourceIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.kind = kwargs['kind'] - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.etag = kwargs.get('etag', None) - self.identity = kwargs.get('identity', None) - - -class ServicesDescription(ServicesResource): - """The description of the service. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", - "fhir-R4". - :type kind: str or ~azure.mgmt.healthcareapis.models.Kind - :param location: Required. The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param identity: Setting indicating whether the service has a managed identity associated with - it. - :type identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity - :param properties: The common properties of a service. - :type properties: ~azure.mgmt.healthcareapis.models.ServicesProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ServicesResourceIdentity'}, - 'properties': {'key': 'properties', 'type': 'ServicesProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesDescription, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class ServicesDescriptionListResult(msrest.serialization.Model): - """A list of service description objects with a next link. - - :param next_link: The link used to get the next page of service description objects. - :type next_link: str - :param value: A list of service description objects. - :type value: list[~azure.mgmt.healthcareapis.models.ServicesDescription] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[ServicesDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesDescriptionListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class ServicesNameAvailabilityInfo(msrest.serialization.Model): - """The properties indicating whether a given service name is available. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: The value which indicates whether the provided name is available. - :vartype name_available: bool - :ivar reason: The reason for unavailability. Possible values include: "Invalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.healthcareapis.models.ServiceNameUnavailabilityReason - :param message: The detailed reason message. - :type message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesNameAvailabilityInfo, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = kwargs.get('message', None) - - -class ServicesPatchDescription(msrest.serialization.Model): - """The description of the service. - - :param tags: A set of tags. Instance tags. - :type tags: dict[str, str] - :param public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesPatchDescription, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class ServicesProperties(msrest.serialization.Model): - """The properties of a service instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param access_policies: The access policies of the service instance. - :type access_policies: list[~azure.mgmt.healthcareapis.models.ServiceAccessPolicyEntry] - :param cosmos_db_configuration: The settings for the Cosmos DB database backing the service. - :type cosmos_db_configuration: - ~azure.mgmt.healthcareapis.models.ServiceCosmosDbConfigurationInfo - :param authentication_configuration: The authentication configuration for the service instance. - :type authentication_configuration: - ~azure.mgmt.healthcareapis.models.ServiceAuthenticationConfigurationInfo - :param cors_configuration: The settings for the CORS configuration of the service instance. - :type cors_configuration: ~azure.mgmt.healthcareapis.models.ServiceCorsConfigurationInfo - :param export_configuration: The settings for the export operation of the service instance. - :type export_configuration: ~azure.mgmt.healthcareapis.models.ServiceExportConfigurationInfo - :param private_endpoint_connections: The list of private endpoint connections that are set up - for this resource. - :type private_endpoint_connections: - list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnection] - :param public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess - :param acr_configuration: The azure container registry settings used for convert data operation - of the service instance. - :type acr_configuration: ~azure.mgmt.healthcareapis.models.ServiceAcrConfigurationInfo - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[ServiceAccessPolicyEntry]'}, - 'cosmos_db_configuration': {'key': 'cosmosDbConfiguration', 'type': 'ServiceCosmosDbConfigurationInfo'}, - 'authentication_configuration': {'key': 'authenticationConfiguration', 'type': 'ServiceAuthenticationConfigurationInfo'}, - 'cors_configuration': {'key': 'corsConfiguration', 'type': 'ServiceCorsConfigurationInfo'}, - 'export_configuration': {'key': 'exportConfiguration', 'type': 'ServiceExportConfigurationInfo'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'acr_configuration': {'key': 'acrConfiguration', 'type': 'ServiceAcrConfigurationInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.access_policies = kwargs.get('access_policies', None) - self.cosmos_db_configuration = kwargs.get('cosmos_db_configuration', None) - self.authentication_configuration = kwargs.get('authentication_configuration', None) - self.cors_configuration = kwargs.get('cors_configuration', None) - self.export_configuration = kwargs.get('export_configuration', None) - self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) - self.public_network_access = kwargs.get('public_network_access', None) - self.acr_configuration = kwargs.get('acr_configuration', None) - - -class ServicesResourceIdentity(msrest.serialization.Model): - """Setting indicating whether the service has a managed identity associated with it. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the resource. - :vartype tenant_id: str - :param type: Type of identity being specified, currently SystemAssigned and None are allowed. - Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServicesResourceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Workspace(TaggedResource): - """Workspace resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing - it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Workspaces resource specific properties. - :type properties: ~azure.mgmt.healthcareapis.models.WorkspaceProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True, 'pattern': r'^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$'}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'WorkspaceProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Workspace, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class WorkspaceList(msrest.serialization.Model): - """Collection of workspace object with a next link. - - :param next_link: The link used to get the next page. - :type next_link: str - :param value: Collection of resources. - :type value: list[~azure.mgmt.healthcareapis.models.Workspace] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Workspace]'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceList, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class WorkspacePatchResource(ResourceTags): - """Workspace patch properties. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspacePatchResource, self).__init__(**kwargs) - - -class WorkspaceProperties(msrest.serialization.Model): - """Workspaces resource specific properties. - - :param provisioning_state: The provisioning state. Possible values include: "Deleting", - "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - """ - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceProperties, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py index f573719be079..40e43e65c3a3 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models_py3.py @@ -20,10 +20,10 @@ class CheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the service instance to check. - :type name: str - :param type: Required. The fully qualified resource type which includes provider namespace. - :type type: str + :ivar name: Required. The name of the service instance to check. + :vartype name: str + :ivar type: Required. The fully qualified resource type which includes provider namespace. + :vartype type: str """ _validation = { @@ -43,6 +43,12 @@ def __init__( type: str, **kwargs ): + """ + :keyword name: Required. The name of the service instance to check. + :paramtype name: str + :keyword type: Required. The fully qualified resource type which includes provider namespace. + :paramtype type: str + """ super(CheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name self.type = type @@ -59,9 +65,9 @@ class ResourceCore(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str + :vartype etag: str """ _validation = { @@ -83,6 +89,11 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + """ super(ResourceCore, self).__init__(**kwargs) self.id = None self.name = None @@ -101,11 +112,11 @@ class LocationBasedResource(ResourceCore): :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str + :vartype etag: str + :ivar location: The resource location. + :vartype location: str """ _validation = { @@ -129,6 +140,13 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + """ super(LocationBasedResource, self).__init__(etag=etag, **kwargs) self.location = location @@ -136,8 +154,8 @@ def __init__( class ResourceTags(msrest.serialization.Model): """List of key value pairs that describe the resource. This will overwrite the existing tags. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -150,6 +168,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ResourceTags, self).__init__(**kwargs) self.tags = tags @@ -165,13 +187,13 @@ class TaggedResource(ResourceTags, LocationBasedResource): :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :vartype etag: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -197,6 +219,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(TaggedResource, self).__init__(tags=tags, etag=etag, location=location, **kwargs) self.id = None self.name = None @@ -217,21 +248,21 @@ class DicomService(TaggedResource): :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :vartype etag: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param authentication_configuration: Dicom Service authentication configuration. - :type authentication_configuration: + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :ivar authentication_configuration: Dicom Service authentication configuration. + :vartype authentication_configuration: ~azure.mgmt.healthcareapis.models.DicomServiceAuthenticationConfiguration :ivar service_url: The url of the Dicom Services. :vartype service_url: str @@ -268,6 +299,22 @@ def __init__( authentication_configuration: Optional["DicomServiceAuthenticationConfiguration"] = None, **kwargs ): + """ + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :keyword authentication_configuration: Dicom Service authentication configuration. + :paramtype authentication_configuration: + ~azure.mgmt.healthcareapis.models.DicomServiceAuthenticationConfiguration + """ super(DicomService, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.system_data = None self.provisioning_state = provisioning_state @@ -300,6 +347,8 @@ def __init__( self, **kwargs ): + """ + """ super(DicomServiceAuthenticationConfiguration, self).__init__(**kwargs) self.authority = None self.audiences = None @@ -308,10 +357,10 @@ def __init__( class DicomServiceCollection(msrest.serialization.Model): """The collection of Dicom Services. - :param next_link: The link used to get the next page of Dicom Services. - :type next_link: str - :param value: The list of Dicom Services. - :type value: list[~azure.mgmt.healthcareapis.models.DicomService] + :ivar next_link: The link used to get the next page of Dicom Services. + :vartype next_link: str + :ivar value: The list of Dicom Services. + :vartype value: list[~azure.mgmt.healthcareapis.models.DicomService] """ _attribute_map = { @@ -326,6 +375,12 @@ def __init__( value: Optional[List["DicomService"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of Dicom Services. + :paramtype next_link: str + :keyword value: The list of Dicom Services. + :paramtype value: list[~azure.mgmt.healthcareapis.models.DicomService] + """ super(DicomServiceCollection, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -334,8 +389,8 @@ def __init__( class DicomServicePatchResource(ResourceTags): """Dicom Service patch properties. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -348,14 +403,18 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DicomServicePatchResource, self).__init__(tags=tags, **kwargs) class Error(msrest.serialization.Model): """Error details. - :param error: Error details. - :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + :ivar error: Error details. + :vartype error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal """ _attribute_map = { @@ -368,6 +427,10 @@ def __init__( error: Optional["ErrorDetailsInternal"] = None, **kwargs ): + """ + :keyword error: Error details. + :paramtype error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + """ super(Error, self).__init__(**kwargs) self.error = error @@ -375,8 +438,8 @@ def __init__( class ErrorDetails(msrest.serialization.Model): """Error details. - :param error: Error details. - :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + :ivar error: Error details. + :vartype error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal """ _attribute_map = { @@ -389,6 +452,10 @@ def __init__( error: Optional["ErrorDetailsInternal"] = None, **kwargs ): + """ + :keyword error: Error details. + :paramtype error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + """ super(ErrorDetails, self).__init__(**kwargs) self.error = error @@ -422,6 +489,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetailsInternal, self).__init__(**kwargs) self.code = None self.message = None @@ -431,9 +500,9 @@ def __init__( class ServiceManagedIdentity(msrest.serialization.Model): """The managed identity of a service. - :param identity: Setting indicating whether the service has a managed identity associated with + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :vartype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity """ _attribute_map = { @@ -446,6 +515,11 @@ def __init__( identity: Optional["ServiceManagedIdentityIdentity"] = None, **kwargs ): + """ + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + """ super(ServiceManagedIdentity, self).__init__(**kwargs) self.identity = identity @@ -455,41 +529,41 @@ class FhirService(TaggedResource, ServiceManagedIdentity): Variables are only populated by the server, and will be ignored when sending a request. - :param identity: Setting indicating whether the service has a managed identity associated with + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :vartype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity :ivar id: The resource identifier. :vartype id: str :ivar name: The resource name. :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param kind: The kind of the service. Possible values include: "fhir-Stu3", "fhir-R4". - :type kind: str or ~azure.mgmt.healthcareapis.models.FhirServiceKind + :vartype etag: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar kind: The kind of the service. Possible values include: "fhir-Stu3", "fhir-R4". + :vartype kind: str or ~azure.mgmt.healthcareapis.models.FhirServiceKind :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param access_policies: Fhir Service access policies. - :type access_policies: list[~azure.mgmt.healthcareapis.models.FhirServiceAccessPolicyEntry] - :param acr_configuration: Fhir Service Azure container registry configuration. - :type acr_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceAcrConfiguration - :param authentication_configuration: Fhir Service authentication configuration. - :type authentication_configuration: + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :ivar access_policies: Fhir Service access policies. + :vartype access_policies: list[~azure.mgmt.healthcareapis.models.FhirServiceAccessPolicyEntry] + :ivar acr_configuration: Fhir Service Azure container registry configuration. + :vartype acr_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceAcrConfiguration + :ivar authentication_configuration: Fhir Service authentication configuration. + :vartype authentication_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceAuthenticationConfiguration - :param cors_configuration: Fhir Service Cors configuration. - :type cors_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceCorsConfiguration - :param export_configuration: Fhir Service export configuration. - :type export_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceExportConfiguration + :ivar cors_configuration: Fhir Service Cors configuration. + :vartype cors_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceCorsConfiguration + :ivar export_configuration: Fhir Service export configuration. + :vartype export_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceExportConfiguration """ _validation = { @@ -533,6 +607,37 @@ def __init__( export_configuration: Optional["FhirServiceExportConfiguration"] = None, **kwargs ): + """ + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword kind: The kind of the service. Possible values include: "fhir-Stu3", "fhir-R4". + :paramtype kind: str or ~azure.mgmt.healthcareapis.models.FhirServiceKind + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :keyword access_policies: Fhir Service access policies. + :paramtype access_policies: + list[~azure.mgmt.healthcareapis.models.FhirServiceAccessPolicyEntry] + :keyword acr_configuration: Fhir Service Azure container registry configuration. + :paramtype acr_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceAcrConfiguration + :keyword authentication_configuration: Fhir Service authentication configuration. + :paramtype authentication_configuration: + ~azure.mgmt.healthcareapis.models.FhirServiceAuthenticationConfiguration + :keyword cors_configuration: Fhir Service Cors configuration. + :paramtype cors_configuration: ~azure.mgmt.healthcareapis.models.FhirServiceCorsConfiguration + :keyword export_configuration: Fhir Service export configuration. + :paramtype export_configuration: + ~azure.mgmt.healthcareapis.models.FhirServiceExportConfiguration + """ super(FhirService, self).__init__(etag=etag, location=location, tags=tags, identity=identity, **kwargs) self.identity = identity self.kind = kind @@ -564,9 +669,9 @@ class FhirServiceAccessPolicyEntry(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to the + :ivar object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to the FHIR service. - :type object_id: str + :vartype object_id: str """ _validation = { @@ -583,6 +688,11 @@ def __init__( object_id: str, **kwargs ): + """ + :keyword object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to + the FHIR service. + :paramtype object_id: str + """ super(FhirServiceAccessPolicyEntry, self).__init__(**kwargs) self.object_id = object_id @@ -590,8 +700,8 @@ def __init__( class FhirServiceAcrConfiguration(msrest.serialization.Model): """Azure container registry configuration information. - :param login_servers: The list of the Azure container registry login servers. - :type login_servers: list[str] + :ivar login_servers: The list of the Azure container registry login servers. + :vartype login_servers: list[str] """ _attribute_map = { @@ -604,6 +714,10 @@ def __init__( login_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword login_servers: The list of the Azure container registry login servers. + :paramtype login_servers: list[str] + """ super(FhirServiceAcrConfiguration, self).__init__(**kwargs) self.login_servers = login_servers @@ -611,12 +725,12 @@ def __init__( class FhirServiceAuthenticationConfiguration(msrest.serialization.Model): """Authentication configuration information. - :param authority: The authority url for the service. - :type authority: str - :param audience: The audience url for the service. - :type audience: str - :param smart_proxy_enabled: If the SMART on FHIR proxy is enabled. - :type smart_proxy_enabled: bool + :ivar authority: The authority url for the service. + :vartype authority: str + :ivar audience: The audience url for the service. + :vartype audience: str + :ivar smart_proxy_enabled: If the SMART on FHIR proxy is enabled. + :vartype smart_proxy_enabled: bool """ _attribute_map = { @@ -633,6 +747,14 @@ def __init__( smart_proxy_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword authority: The authority url for the service. + :paramtype authority: str + :keyword audience: The audience url for the service. + :paramtype audience: str + :keyword smart_proxy_enabled: If the SMART on FHIR proxy is enabled. + :paramtype smart_proxy_enabled: bool + """ super(FhirServiceAuthenticationConfiguration, self).__init__(**kwargs) self.authority = authority self.audience = audience @@ -642,10 +764,10 @@ def __init__( class FhirServiceCollection(msrest.serialization.Model): """A collection of Fhir services. - :param next_link: The link used to get the next page of Fhir Services. - :type next_link: str - :param value: The list of Fhir Services. - :type value: list[~azure.mgmt.healthcareapis.models.FhirService] + :ivar next_link: The link used to get the next page of Fhir Services. + :vartype next_link: str + :ivar value: The list of Fhir Services. + :vartype value: list[~azure.mgmt.healthcareapis.models.FhirService] """ _attribute_map = { @@ -660,6 +782,12 @@ def __init__( value: Optional[List["FhirService"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of Fhir Services. + :paramtype next_link: str + :keyword value: The list of Fhir Services. + :paramtype value: list[~azure.mgmt.healthcareapis.models.FhirService] + """ super(FhirServiceCollection, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -668,16 +796,16 @@ def __init__( class FhirServiceCorsConfiguration(msrest.serialization.Model): """The settings for the CORS configuration of the service instance. - :param origins: The origins to be allowed via CORS. - :type origins: list[str] - :param headers: The headers to be allowed via CORS. - :type headers: list[str] - :param methods: The methods to be allowed via CORS. - :type methods: list[str] - :param max_age: The max age to be allowed via CORS. - :type max_age: int - :param allow_credentials: If credentials are allowed via CORS. - :type allow_credentials: bool + :ivar origins: The origins to be allowed via CORS. + :vartype origins: list[str] + :ivar headers: The headers to be allowed via CORS. + :vartype headers: list[str] + :ivar methods: The methods to be allowed via CORS. + :vartype methods: list[str] + :ivar max_age: The max age to be allowed via CORS. + :vartype max_age: int + :ivar allow_credentials: If credentials are allowed via CORS. + :vartype allow_credentials: bool """ _validation = { @@ -702,6 +830,18 @@ def __init__( allow_credentials: Optional[bool] = None, **kwargs ): + """ + :keyword origins: The origins to be allowed via CORS. + :paramtype origins: list[str] + :keyword headers: The headers to be allowed via CORS. + :paramtype headers: list[str] + :keyword methods: The methods to be allowed via CORS. + :paramtype methods: list[str] + :keyword max_age: The max age to be allowed via CORS. + :paramtype max_age: int + :keyword allow_credentials: If credentials are allowed via CORS. + :paramtype allow_credentials: bool + """ super(FhirServiceCorsConfiguration, self).__init__(**kwargs) self.origins = origins self.headers = headers @@ -713,8 +853,8 @@ def __init__( class FhirServiceExportConfiguration(msrest.serialization.Model): """Export operation configuration information. - :param storage_account_name: The name of the default export storage account. - :type storage_account_name: str + :ivar storage_account_name: The name of the default export storage account. + :vartype storage_account_name: str """ _attribute_map = { @@ -727,6 +867,10 @@ def __init__( storage_account_name: Optional[str] = None, **kwargs ): + """ + :keyword storage_account_name: The name of the default export storage account. + :paramtype storage_account_name: str + """ super(FhirServiceExportConfiguration, self).__init__(**kwargs) self.storage_account_name = storage_account_name @@ -734,11 +878,11 @@ def __init__( class FhirServicePatchResource(ResourceTags, ServiceManagedIdentity): """FhirService patch properties. - :param identity: Setting indicating whether the service has a managed identity associated with + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :vartype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -753,6 +897,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(FhirServicePatchResource, self).__init__(tags=tags, identity=identity, **kwargs) self.identity = identity self.tags = tags @@ -763,33 +914,33 @@ class IotConnector(TaggedResource, ServiceManagedIdentity): Variables are only populated by the server, and will be ignored when sending a request. - :param identity: Setting indicating whether the service has a managed identity associated with + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :vartype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity :ivar id: The resource identifier. :vartype id: str :ivar name: The resource name. :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :vartype etag: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param ingestion_endpoint_configuration: Source configuration. - :type ingestion_endpoint_configuration: + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :ivar ingestion_endpoint_configuration: Source configuration. + :vartype ingestion_endpoint_configuration: ~azure.mgmt.healthcareapis.models.IotEventHubIngestionEndpointConfiguration - :param device_mapping: Device Mappings. - :type device_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties + :ivar device_mapping: Device Mappings. + :vartype device_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties """ _validation = { @@ -825,6 +976,27 @@ def __init__( device_mapping: Optional["IotMappingProperties"] = None, **kwargs ): + """ + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :keyword ingestion_endpoint_configuration: Source configuration. + :paramtype ingestion_endpoint_configuration: + ~azure.mgmt.healthcareapis.models.IotEventHubIngestionEndpointConfiguration + :keyword device_mapping: Device Mappings. + :paramtype device_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties + """ super(IotConnector, self).__init__(etag=etag, location=location, tags=tags, identity=identity, **kwargs) self.identity = identity self.system_data = None @@ -846,10 +1018,10 @@ def __init__( class IotConnectorCollection(msrest.serialization.Model): """A collection of IoT Connectors. - :param next_link: The link used to get the next page of IoT Connectors. - :type next_link: str - :param value: The list of IoT Connectors. - :type value: list[~azure.mgmt.healthcareapis.models.IotConnector] + :ivar next_link: The link used to get the next page of IoT Connectors. + :vartype next_link: str + :ivar value: The list of IoT Connectors. + :vartype value: list[~azure.mgmt.healthcareapis.models.IotConnector] """ _attribute_map = { @@ -864,6 +1036,12 @@ def __init__( value: Optional[List["IotConnector"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of IoT Connectors. + :paramtype next_link: str + :keyword value: The list of IoT Connectors. + :paramtype value: list[~azure.mgmt.healthcareapis.models.IotConnector] + """ super(IotConnectorCollection, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -872,11 +1050,11 @@ def __init__( class IotConnectorPatchResource(ResourceTags, ServiceManagedIdentity): """Iot Connector patch properties. - :param identity: Setting indicating whether the service has a managed identity associated with + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :vartype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -891,6 +1069,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServiceManagedIdentityIdentity + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(IotConnectorPatchResource, self).__init__(tags=tags, identity=identity, **kwargs) self.identity = identity self.tags = tags @@ -899,10 +1084,10 @@ def __init__( class IotDestinationProperties(msrest.serialization.Model): """Common IoT Connector destination properties. - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState """ _attribute_map = { @@ -915,6 +1100,12 @@ def __init__( provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, **kwargs ): + """ + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + """ super(IotDestinationProperties, self).__init__(**kwargs) self.provisioning_state = provisioning_state @@ -922,13 +1113,13 @@ def __init__( class IotEventHubIngestionEndpointConfiguration(msrest.serialization.Model): """Event Hub ingestion endpoint configuration. - :param event_hub_name: Event Hub name to connect to. - :type event_hub_name: str - :param consumer_group: Consumer group of the event hub to connected to. - :type consumer_group: str - :param fully_qualified_event_hub_namespace: Fully qualified namespace of the Event Hub to + :ivar event_hub_name: Event Hub name to connect to. + :vartype event_hub_name: str + :ivar consumer_group: Consumer group of the event hub to connected to. + :vartype consumer_group: str + :ivar fully_qualified_event_hub_namespace: Fully qualified namespace of the Event Hub to connect to. - :type fully_qualified_event_hub_namespace: str + :vartype fully_qualified_event_hub_namespace: str """ _attribute_map = { @@ -945,6 +1136,15 @@ def __init__( fully_qualified_event_hub_namespace: Optional[str] = None, **kwargs ): + """ + :keyword event_hub_name: Event Hub name to connect to. + :paramtype event_hub_name: str + :keyword consumer_group: Consumer group of the event hub to connected to. + :paramtype consumer_group: str + :keyword fully_qualified_event_hub_namespace: Fully qualified namespace of the Event Hub to + connect to. + :paramtype fully_qualified_event_hub_namespace: str + """ super(IotEventHubIngestionEndpointConfiguration, self).__init__(**kwargs) self.event_hub_name = event_hub_name self.consumer_group = consumer_group @@ -964,26 +1164,26 @@ class IotFhirDestination(LocationBasedResource): :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str + :vartype etag: str + :ivar location: The resource location. + :vartype location: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param resource_identity_resolution_type: Required. Determines how resource identity is - resolved on the destination. Possible values include: "Create", "Lookup". - :type resource_identity_resolution_type: str or + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :ivar resource_identity_resolution_type: Required. Determines how resource identity is resolved + on the destination. Possible values include: "Create", "Lookup". + :vartype resource_identity_resolution_type: str or ~azure.mgmt.healthcareapis.models.IotIdentityResolutionType - :param fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to + :ivar fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to connect to. - :type fhir_service_resource_id: str - :param fhir_mapping: Required. FHIR Mappings. - :type fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties + :vartype fhir_service_resource_id: str + :ivar fhir_mapping: Required. FHIR Mappings. + :vartype fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties """ _validation = { @@ -1020,6 +1220,26 @@ def __init__( provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, **kwargs ): + """ + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :keyword resource_identity_resolution_type: Required. Determines how resource identity is + resolved on the destination. Possible values include: "Create", "Lookup". + :paramtype resource_identity_resolution_type: str or + ~azure.mgmt.healthcareapis.models.IotIdentityResolutionType + :keyword fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to + connect to. + :paramtype fhir_service_resource_id: str + :keyword fhir_mapping: Required. FHIR Mappings. + :paramtype fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties + """ super(IotFhirDestination, self).__init__(etag=etag, location=location, **kwargs) self.system_data = None self.provisioning_state = provisioning_state @@ -1031,10 +1251,10 @@ def __init__( class IotFhirDestinationCollection(msrest.serialization.Model): """A collection of IoT Connector FHIR destinations. - :param next_link: The link used to get the next page of IoT FHIR destinations. - :type next_link: str - :param value: The list of IoT Connector FHIR destinations. - :type value: list[~azure.mgmt.healthcareapis.models.IotFhirDestination] + :ivar next_link: The link used to get the next page of IoT FHIR destinations. + :vartype next_link: str + :ivar value: The list of IoT Connector FHIR destinations. + :vartype value: list[~azure.mgmt.healthcareapis.models.IotFhirDestination] """ _attribute_map = { @@ -1049,6 +1269,12 @@ def __init__( value: Optional[List["IotFhirDestination"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of IoT FHIR destinations. + :paramtype next_link: str + :keyword value: The list of IoT Connector FHIR destinations. + :paramtype value: list[~azure.mgmt.healthcareapis.models.IotFhirDestination] + """ super(IotFhirDestinationCollection, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -1059,19 +1285,19 @@ class IotFhirDestinationProperties(IotDestinationProperties): All required parameters must be populated in order to send to Azure. - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param resource_identity_resolution_type: Required. Determines how resource identity is - resolved on the destination. Possible values include: "Create", "Lookup". - :type resource_identity_resolution_type: str or + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :ivar resource_identity_resolution_type: Required. Determines how resource identity is resolved + on the destination. Possible values include: "Create", "Lookup". + :vartype resource_identity_resolution_type: str or ~azure.mgmt.healthcareapis.models.IotIdentityResolutionType - :param fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to + :ivar fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to connect to. - :type fhir_service_resource_id: str - :param fhir_mapping: Required. FHIR Mappings. - :type fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties + :vartype fhir_service_resource_id: str + :ivar fhir_mapping: Required. FHIR Mappings. + :vartype fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties """ _validation = { @@ -1096,6 +1322,21 @@ def __init__( provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, **kwargs ): + """ + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :keyword resource_identity_resolution_type: Required. Determines how resource identity is + resolved on the destination. Possible values include: "Create", "Lookup". + :paramtype resource_identity_resolution_type: str or + ~azure.mgmt.healthcareapis.models.IotIdentityResolutionType + :keyword fhir_service_resource_id: Required. Fully qualified resource id of the FHIR service to + connect to. + :paramtype fhir_service_resource_id: str + :keyword fhir_mapping: Required. FHIR Mappings. + :paramtype fhir_mapping: ~azure.mgmt.healthcareapis.models.IotMappingProperties + """ super(IotFhirDestinationProperties, self).__init__(provisioning_state=provisioning_state, **kwargs) self.resource_identity_resolution_type = resource_identity_resolution_type self.fhir_service_resource_id = fhir_service_resource_id @@ -1105,8 +1346,8 @@ def __init__( class IotMappingProperties(msrest.serialization.Model): """The mapping content. - :param content: The mapping. - :type content: any + :ivar content: The mapping. + :vartype content: any """ _attribute_map = { @@ -1119,6 +1360,10 @@ def __init__( content: Optional[Any] = None, **kwargs ): + """ + :keyword content: The mapping. + :paramtype content: any + """ super(IotMappingProperties, self).__init__(**kwargs) self.content = content @@ -1130,9 +1375,9 @@ class ListOperations(msrest.serialization.Model): :ivar value: Collection of available operation details. :vartype value: list[~azure.mgmt.healthcareapis.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _validation = { @@ -1150,6 +1395,11 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ListOperations, self).__init__(**kwargs) self.value = None self.next_link = next_link @@ -1165,8 +1415,8 @@ class OperationDetail(msrest.serialization.Model): :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.healthcareapis.models.OperationDisplay + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.healthcareapis.models.OperationDisplay :ivar origin: Default value is 'user,system'. :vartype origin: str :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for @@ -1195,6 +1445,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.healthcareapis.models.OperationDisplay + """ super(OperationDetail, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -1236,6 +1490,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -1257,8 +1513,8 @@ class OperationResultsDescription(msrest.serialization.Model): :vartype status: str or ~azure.mgmt.healthcareapis.models.OperationResultStatus :ivar start_time: The time that the operation was started. :vartype start_time: str - :param properties: Additional properties of the operation result. - :type properties: any + :ivar properties: Additional properties of the operation result. + :vartype properties: any """ _validation = { @@ -1282,6 +1538,10 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword properties: Additional properties of the operation result. + :paramtype properties: any + """ super(OperationResultsDescription, self).__init__(**kwargs) self.id = None self.name = None @@ -1311,6 +1571,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1346,6 +1608,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1365,11 +1629,11 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.healthcareapis.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -1400,6 +1664,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.healthcareapis.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1419,11 +1691,11 @@ class PrivateEndpointConnectionDescription(PrivateEndpointConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: ~azure.mgmt.healthcareapis.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". @@ -1458,6 +1730,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.healthcareapis.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.healthcareapis.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionDescription, self).__init__(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state, **kwargs) self.system_data = None @@ -1465,8 +1745,8 @@ def __init__( class PrivateEndpointConnectionListResultDescription(msrest.serialization.Model): """List of private endpoint connection associated with the specified storage account. - :param value: Array of private endpoint connections. - :type value: list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] """ _attribute_map = { @@ -1479,6 +1759,10 @@ def __init__( value: Optional[List["PrivateEndpointConnectionDescription"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] + """ super(PrivateEndpointConnectionListResultDescription, self).__init__(**kwargs) self.value = value @@ -1500,8 +1784,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -1527,6 +1811,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1550,8 +1838,8 @@ class PrivateLinkResourceDescription(PrivateLinkResource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -1581,6 +1869,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResourceDescription, self).__init__(required_zone_names=required_zone_names, **kwargs) self.system_data = None @@ -1588,8 +1880,8 @@ def __init__( class PrivateLinkResourceListResultDescription(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription] """ _attribute_map = { @@ -1602,6 +1894,10 @@ def __init__( value: Optional[List["PrivateLinkResourceDescription"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.healthcareapis.models.PrivateLinkResourceDescription] + """ super(PrivateLinkResourceListResultDescription, self).__init__(**kwargs) self.value = value @@ -1609,14 +1905,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or ~azure.mgmt.healthcareapis.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~azure.mgmt.healthcareapis.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -1633,6 +1930,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.healthcareapis.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1644,9 +1952,9 @@ class ServiceAccessPolicyEntry(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to the + :ivar object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to the FHIR service. - :type object_id: str + :vartype object_id: str """ _validation = { @@ -1663,6 +1971,11 @@ def __init__( object_id: str, **kwargs ): + """ + :keyword object_id: Required. An Azure AD object ID (User or Apps) that is allowed access to + the FHIR service. + :paramtype object_id: str + """ super(ServiceAccessPolicyEntry, self).__init__(**kwargs) self.object_id = object_id @@ -1670,8 +1983,8 @@ def __init__( class ServiceAcrConfigurationInfo(msrest.serialization.Model): """Azure container registry configuration information. - :param login_servers: The list of the ACR login servers. - :type login_servers: list[str] + :ivar login_servers: The list of the ACR login servers. + :vartype login_servers: list[str] """ _attribute_map = { @@ -1684,6 +1997,10 @@ def __init__( login_servers: Optional[List[str]] = None, **kwargs ): + """ + :keyword login_servers: The list of the ACR login servers. + :paramtype login_servers: list[str] + """ super(ServiceAcrConfigurationInfo, self).__init__(**kwargs) self.login_servers = login_servers @@ -1691,12 +2008,12 @@ def __init__( class ServiceAuthenticationConfigurationInfo(msrest.serialization.Model): """Authentication configuration information. - :param authority: The authority url for the service. - :type authority: str - :param audience: The audience url for the service. - :type audience: str - :param smart_proxy_enabled: If the SMART on FHIR proxy is enabled. - :type smart_proxy_enabled: bool + :ivar authority: The authority url for the service. + :vartype authority: str + :ivar audience: The audience url for the service. + :vartype audience: str + :ivar smart_proxy_enabled: If the SMART on FHIR proxy is enabled. + :vartype smart_proxy_enabled: bool """ _attribute_map = { @@ -1713,6 +2030,14 @@ def __init__( smart_proxy_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword authority: The authority url for the service. + :paramtype authority: str + :keyword audience: The audience url for the service. + :paramtype audience: str + :keyword smart_proxy_enabled: If the SMART on FHIR proxy is enabled. + :paramtype smart_proxy_enabled: bool + """ super(ServiceAuthenticationConfigurationInfo, self).__init__(**kwargs) self.authority = authority self.audience = audience @@ -1722,16 +2047,16 @@ def __init__( class ServiceCorsConfigurationInfo(msrest.serialization.Model): """The settings for the CORS configuration of the service instance. - :param origins: The origins to be allowed via CORS. - :type origins: list[str] - :param headers: The headers to be allowed via CORS. - :type headers: list[str] - :param methods: The methods to be allowed via CORS. - :type methods: list[str] - :param max_age: The max age to be allowed via CORS. - :type max_age: int - :param allow_credentials: If credentials are allowed via CORS. - :type allow_credentials: bool + :ivar origins: The origins to be allowed via CORS. + :vartype origins: list[str] + :ivar headers: The headers to be allowed via CORS. + :vartype headers: list[str] + :ivar methods: The methods to be allowed via CORS. + :vartype methods: list[str] + :ivar max_age: The max age to be allowed via CORS. + :vartype max_age: int + :ivar allow_credentials: If credentials are allowed via CORS. + :vartype allow_credentials: bool """ _validation = { @@ -1756,6 +2081,18 @@ def __init__( allow_credentials: Optional[bool] = None, **kwargs ): + """ + :keyword origins: The origins to be allowed via CORS. + :paramtype origins: list[str] + :keyword headers: The headers to be allowed via CORS. + :paramtype headers: list[str] + :keyword methods: The methods to be allowed via CORS. + :paramtype methods: list[str] + :keyword max_age: The max age to be allowed via CORS. + :paramtype max_age: int + :keyword allow_credentials: If credentials are allowed via CORS. + :paramtype allow_credentials: bool + """ super(ServiceCorsConfigurationInfo, self).__init__(**kwargs) self.origins = origins self.headers = headers @@ -1767,10 +2104,10 @@ def __init__( class ServiceCosmosDbConfigurationInfo(msrest.serialization.Model): """The settings for the Cosmos DB database backing the service. - :param offer_throughput: The provisioned throughput for the backing database. - :type offer_throughput: int - :param key_vault_key_uri: The URI of the customer-managed key for the backing database. - :type key_vault_key_uri: str + :ivar offer_throughput: The provisioned throughput for the backing database. + :vartype offer_throughput: int + :ivar key_vault_key_uri: The URI of the customer-managed key for the backing database. + :vartype key_vault_key_uri: str """ _validation = { @@ -1789,6 +2126,12 @@ def __init__( key_vault_key_uri: Optional[str] = None, **kwargs ): + """ + :keyword offer_throughput: The provisioned throughput for the backing database. + :paramtype offer_throughput: int + :keyword key_vault_key_uri: The URI of the customer-managed key for the backing database. + :paramtype key_vault_key_uri: str + """ super(ServiceCosmosDbConfigurationInfo, self).__init__(**kwargs) self.offer_throughput = offer_throughput self.key_vault_key_uri = key_vault_key_uri @@ -1797,8 +2140,8 @@ def __init__( class ServiceExportConfigurationInfo(msrest.serialization.Model): """Export operation configuration information. - :param storage_account_name: The name of the default export storage account. - :type storage_account_name: str + :ivar storage_account_name: The name of the default export storage account. + :vartype storage_account_name: str """ _attribute_map = { @@ -1811,6 +2154,10 @@ def __init__( storage_account_name: Optional[str] = None, **kwargs ): + """ + :keyword storage_account_name: The name of the default export storage account. + :paramtype storage_account_name: str + """ super(ServiceExportConfigurationInfo, self).__init__(**kwargs) self.storage_account_name = storage_account_name @@ -1818,9 +2165,9 @@ def __init__( class ServiceManagedIdentityIdentity(msrest.serialization.Model): """Setting indicating whether the service has a managed identity associated with it. - :param type: Type of identity being specified, currently SystemAssigned and None are allowed. + :ivar type: Type of identity being specified, currently SystemAssigned and None are allowed. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType + :vartype type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType """ _attribute_map = { @@ -1833,6 +2180,11 @@ def __init__( type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, **kwargs ): + """ + :keyword type: Type of identity being specified, currently SystemAssigned and None are allowed. + Possible values include: "SystemAssigned", "None". + :paramtype type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType + """ super(ServiceManagedIdentityIdentity, self).__init__(**kwargs) self.type = type @@ -1850,19 +2202,19 @@ class ServicesResource(msrest.serialization.Model): :vartype name: str :ivar type: The resource type. :vartype type: str - :param kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", + :ivar kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", "fhir-R4". - :type kind: str or ~azure.mgmt.healthcareapis.models.Kind - :param location: Required. The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :vartype kind: str or ~azure.mgmt.healthcareapis.models.Kind + :ivar location: Required. The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param identity: Setting indicating whether the service has a managed identity associated with + :vartype etag: str + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity + :vartype identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity """ _validation = { @@ -1894,6 +2246,21 @@ def __init__( identity: Optional["ServicesResourceIdentity"] = None, **kwargs ): + """ + :keyword kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", + "fhir-R4". + :paramtype kind: str or ~azure.mgmt.healthcareapis.models.Kind + :keyword location: Required. The resource location. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity + """ super(ServicesResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1918,21 +2285,21 @@ class ServicesDescription(ServicesResource): :vartype name: str :ivar type: The resource type. :vartype type: str - :param kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", + :ivar kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", "fhir-R4". - :type kind: str or ~azure.mgmt.healthcareapis.models.Kind - :param location: Required. The resource location. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :vartype kind: str or ~azure.mgmt.healthcareapis.models.Kind + :ivar location: Required. The resource location. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param identity: Setting indicating whether the service has a managed identity associated with + :vartype etag: str + :ivar identity: Setting indicating whether the service has a managed identity associated with it. - :type identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity - :param properties: The common properties of a service. - :type properties: ~azure.mgmt.healthcareapis.models.ServicesProperties + :vartype identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity + :ivar properties: The common properties of a service. + :vartype properties: ~azure.mgmt.healthcareapis.models.ServicesProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -1970,6 +2337,23 @@ def __init__( properties: Optional["ServicesProperties"] = None, **kwargs ): + """ + :keyword kind: Required. The kind of the service. Possible values include: "fhir", "fhir-Stu3", + "fhir-R4". + :paramtype kind: str or ~azure.mgmt.healthcareapis.models.Kind + :keyword location: Required. The resource location. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword identity: Setting indicating whether the service has a managed identity associated + with it. + :paramtype identity: ~azure.mgmt.healthcareapis.models.ServicesResourceIdentity + :keyword properties: The common properties of a service. + :paramtype properties: ~azure.mgmt.healthcareapis.models.ServicesProperties + """ super(ServicesDescription, self).__init__(kind=kind, location=location, tags=tags, etag=etag, identity=identity, **kwargs) self.properties = properties self.system_data = None @@ -1978,10 +2362,10 @@ def __init__( class ServicesDescriptionListResult(msrest.serialization.Model): """A list of service description objects with a next link. - :param next_link: The link used to get the next page of service description objects. - :type next_link: str - :param value: A list of service description objects. - :type value: list[~azure.mgmt.healthcareapis.models.ServicesDescription] + :ivar next_link: The link used to get the next page of service description objects. + :vartype next_link: str + :ivar value: A list of service description objects. + :vartype value: list[~azure.mgmt.healthcareapis.models.ServicesDescription] """ _attribute_map = { @@ -1996,6 +2380,12 @@ def __init__( value: Optional[List["ServicesDescription"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of service description objects. + :paramtype next_link: str + :keyword value: A list of service description objects. + :paramtype value: list[~azure.mgmt.healthcareapis.models.ServicesDescription] + """ super(ServicesDescriptionListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -2011,8 +2401,8 @@ class ServicesNameAvailabilityInfo(msrest.serialization.Model): :ivar reason: The reason for unavailability. Possible values include: "Invalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.healthcareapis.models.ServiceNameUnavailabilityReason - :param message: The detailed reason message. - :type message: str + :ivar message: The detailed reason message. + :vartype message: str """ _validation = { @@ -2032,6 +2422,10 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword message: The detailed reason message. + :paramtype message: str + """ super(ServicesNameAvailabilityInfo, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -2041,11 +2435,11 @@ def __init__( class ServicesPatchDescription(msrest.serialization.Model): """The description of the service. - :param tags: A set of tags. Instance tags. - :type tags: dict[str, str] - :param public_network_access: Control permission for data plane traffic coming from public + :ivar tags: A set of tags. Instance tags. + :vartype tags: dict[str, str] + :ivar public_network_access: Control permission for data plane traffic coming from public networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess + :vartype public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess """ _attribute_map = { @@ -2060,6 +2454,13 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Instance tags. + :paramtype tags: dict[str, str] + :keyword public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess + """ super(ServicesPatchDescription, self).__init__(**kwargs) self.tags = tags self.public_network_access = public_network_access @@ -2074,28 +2475,28 @@ class ServicesProperties(msrest.serialization.Model): "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState - :param access_policies: The access policies of the service instance. - :type access_policies: list[~azure.mgmt.healthcareapis.models.ServiceAccessPolicyEntry] - :param cosmos_db_configuration: The settings for the Cosmos DB database backing the service. - :type cosmos_db_configuration: + :ivar access_policies: The access policies of the service instance. + :vartype access_policies: list[~azure.mgmt.healthcareapis.models.ServiceAccessPolicyEntry] + :ivar cosmos_db_configuration: The settings for the Cosmos DB database backing the service. + :vartype cosmos_db_configuration: ~azure.mgmt.healthcareapis.models.ServiceCosmosDbConfigurationInfo - :param authentication_configuration: The authentication configuration for the service instance. - :type authentication_configuration: + :ivar authentication_configuration: The authentication configuration for the service instance. + :vartype authentication_configuration: ~azure.mgmt.healthcareapis.models.ServiceAuthenticationConfigurationInfo - :param cors_configuration: The settings for the CORS configuration of the service instance. - :type cors_configuration: ~azure.mgmt.healthcareapis.models.ServiceCorsConfigurationInfo - :param export_configuration: The settings for the export operation of the service instance. - :type export_configuration: ~azure.mgmt.healthcareapis.models.ServiceExportConfigurationInfo - :param private_endpoint_connections: The list of private endpoint connections that are set up + :ivar cors_configuration: The settings for the CORS configuration of the service instance. + :vartype cors_configuration: ~azure.mgmt.healthcareapis.models.ServiceCorsConfigurationInfo + :ivar export_configuration: The settings for the export operation of the service instance. + :vartype export_configuration: ~azure.mgmt.healthcareapis.models.ServiceExportConfigurationInfo + :ivar private_endpoint_connections: The list of private endpoint connections that are set up for this resource. - :type private_endpoint_connections: + :vartype private_endpoint_connections: list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnection] - :param public_network_access: Control permission for data plane traffic coming from public + :ivar public_network_access: Control permission for data plane traffic coming from public networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess - :param acr_configuration: The azure container registry settings used for convert data operation + :vartype public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess + :ivar acr_configuration: The azure container registry settings used for convert data operation of the service instance. - :type acr_configuration: ~azure.mgmt.healthcareapis.models.ServiceAcrConfigurationInfo + :vartype acr_configuration: ~azure.mgmt.healthcareapis.models.ServiceAcrConfigurationInfo """ _validation = { @@ -2127,6 +2528,32 @@ def __init__( acr_configuration: Optional["ServiceAcrConfigurationInfo"] = None, **kwargs ): + """ + :keyword access_policies: The access policies of the service instance. + :paramtype access_policies: list[~azure.mgmt.healthcareapis.models.ServiceAccessPolicyEntry] + :keyword cosmos_db_configuration: The settings for the Cosmos DB database backing the service. + :paramtype cosmos_db_configuration: + ~azure.mgmt.healthcareapis.models.ServiceCosmosDbConfigurationInfo + :keyword authentication_configuration: The authentication configuration for the service + instance. + :paramtype authentication_configuration: + ~azure.mgmt.healthcareapis.models.ServiceAuthenticationConfigurationInfo + :keyword cors_configuration: The settings for the CORS configuration of the service instance. + :paramtype cors_configuration: ~azure.mgmt.healthcareapis.models.ServiceCorsConfigurationInfo + :keyword export_configuration: The settings for the export operation of the service instance. + :paramtype export_configuration: + ~azure.mgmt.healthcareapis.models.ServiceExportConfigurationInfo + :keyword private_endpoint_connections: The list of private endpoint connections that are set up + for this resource. + :paramtype private_endpoint_connections: + list[~azure.mgmt.healthcareapis.models.PrivateEndpointConnection] + :keyword public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or ~azure.mgmt.healthcareapis.models.PublicNetworkAccess + :keyword acr_configuration: The azure container registry settings used for convert data + operation of the service instance. + :paramtype acr_configuration: ~azure.mgmt.healthcareapis.models.ServiceAcrConfigurationInfo + """ super(ServicesProperties, self).__init__(**kwargs) self.provisioning_state = None self.access_policies = access_policies @@ -2148,9 +2575,9 @@ class ServicesResourceIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of the resource. :vartype tenant_id: str - :param type: Type of identity being specified, currently SystemAssigned and None are allowed. + :ivar type: Type of identity being specified, currently SystemAssigned and None are allowed. Possible values include: "SystemAssigned", "None". - :type type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType + :vartype type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType """ _validation = { @@ -2170,6 +2597,11 @@ def __init__( type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, **kwargs ): + """ + :keyword type: Type of identity being specified, currently SystemAssigned and None are allowed. + Possible values include: "SystemAssigned", "None". + :paramtype type: str or ~azure.mgmt.healthcareapis.models.ManagedServiceIdentityType + """ super(ServicesResourceIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2179,20 +2611,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2215,6 +2647,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.healthcareapis.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -2235,15 +2683,15 @@ class Workspace(TaggedResource): :vartype name: str :ivar type: The resource type. :vartype type: str - :param etag: An etag associated with the resource, used for optimistic concurrency when editing + :ivar etag: An etag associated with the resource, used for optimistic concurrency when editing it. - :type etag: str - :param location: The resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Workspaces resource specific properties. - :type properties: ~azure.mgmt.healthcareapis.models.WorkspaceProperties + :vartype etag: str + :ivar location: The resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Workspaces resource specific properties. + :vartype properties: ~azure.mgmt.healthcareapis.models.WorkspaceProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -2275,6 +2723,17 @@ def __init__( properties: Optional["WorkspaceProperties"] = None, **kwargs ): + """ + :keyword etag: An etag associated with the resource, used for optimistic concurrency when + editing it. + :paramtype etag: str + :keyword location: The resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Workspaces resource specific properties. + :paramtype properties: ~azure.mgmt.healthcareapis.models.WorkspaceProperties + """ super(Workspace, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.properties = properties self.system_data = None @@ -2283,10 +2742,10 @@ def __init__( class WorkspaceList(msrest.serialization.Model): """Collection of workspace object with a next link. - :param next_link: The link used to get the next page. - :type next_link: str - :param value: Collection of resources. - :type value: list[~azure.mgmt.healthcareapis.models.Workspace] + :ivar next_link: The link used to get the next page. + :vartype next_link: str + :ivar value: Collection of resources. + :vartype value: list[~azure.mgmt.healthcareapis.models.Workspace] """ _attribute_map = { @@ -2301,6 +2760,12 @@ def __init__( value: Optional[List["Workspace"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page. + :paramtype next_link: str + :keyword value: Collection of resources. + :paramtype value: list[~azure.mgmt.healthcareapis.models.Workspace] + """ super(WorkspaceList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -2309,8 +2774,8 @@ def __init__( class WorkspacePatchResource(ResourceTags): """Workspace patch properties. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -2323,16 +2788,20 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(WorkspacePatchResource, self).__init__(tags=tags, **kwargs) class WorkspaceProperties(msrest.serialization.Model): """Workspaces resource specific properties. - :param provisioning_state: The provisioning state. Possible values include: "Deleting", + :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". - :type provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState """ _attribute_map = { @@ -2345,5 +2814,11 @@ def __init__( provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, **kwargs ): + """ + :keyword provisioning_state: The provisioning state. Possible values include: "Deleting", + "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", + "Deprovisioned", "Moving", "Suspended", "Warned", "SystemMaintenance". + :paramtype provisioning_state: str or ~azure.mgmt.healthcareapis.models.ProvisioningState + """ super(WorkspaceProperties, self).__init__(**kwargs) self.provisioning_state = provisioning_state diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py index e105deecd45b..881ddf781019 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py @@ -5,25 +5,229 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + dicom_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "dicomServiceName": _SERIALIZER.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + dicom_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "dicomServiceName": _SERIALIZER.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + subscription_id: str, + dicom_service_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "dicomServiceName": _SERIALIZER.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "dicomServiceName": _SERIALIZER.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DicomServicesOperations(object): """DicomServicesOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DicomServiceCollection"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.DicomServiceCollection"]: """Lists all DICOM Services for the given workspace. :param resource_group_name: The name of the resource group that contains the service instance. @@ -61,7 +265,8 @@ def list_by_workspace( :param workspace_name: The name of workspace resource. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DicomServiceCollection or the result of cls(response) + :return: An iterator like instance of either DicomServiceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.DicomServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +275,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DicomServiceCollection', pipeline_response) + deserialized = self._deserialize("DicomServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +314,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - dicom_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DicomService" + resource_group_name: str, + workspace_name: str, + dicom_service_name: str, + **kwargs: Any + ) -> "_models.DicomService": """Gets the properties of the specified DICOM Service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -149,34 +352,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + dicom_service_name=dicom_service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DicomService', pipeline_response) @@ -185,56 +378,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - dicom_service_name, # type: str - dicomservice, # type: "_models.DicomService" - **kwargs # type: Any - ): - # type: (...) -> "_models.DicomService" + resource_group_name: str, + workspace_name: str, + dicom_service_name: str, + dicomservice: "_models.DicomService", + **kwargs: Any + ) -> "_models.DicomService": cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(dicomservice, 'DicomService') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + dicom_service_name=dicom_service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(dicomservice, 'DicomService') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DicomService', pipeline_response) @@ -249,17 +432,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - dicom_service_name, # type: str - dicomservice, # type: "_models.DicomService" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DicomService"] + resource_group_name: str, + workspace_name: str, + dicom_service_name: str, + dicomservice: "_models.DicomService", + **kwargs: Any + ) -> LROPoller["_models.DicomService"]: """Creates or updates a DICOM Service resource with the specified parameters. :param resource_group_name: The name of the resource group that contains the service instance. @@ -272,15 +457,19 @@ def begin_create_or_update( :type dicomservice: ~azure.mgmt.healthcareapis.models.DicomService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DicomService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DicomService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +482,21 @@ def begin_create_or_update( workspace_name=workspace_name, dicom_service_name=dicom_service_name, dicomservice=dicomservice, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DicomService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,56 +508,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - dicom_service_name, # type: str - workspace_name, # type: str - dicomservice_patch_resource, # type: "_models.DicomServicePatchResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DicomService" + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + dicomservice_patch_resource: "_models.DicomServicePatchResource", + **kwargs: Any + ) -> "_models.DicomService": cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(dicomservice_patch_resource, 'DicomServicePatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(dicomservice_patch_resource, 'DicomServicePatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DicomService', pipeline_response) @@ -387,17 +558,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - dicom_service_name, # type: str - workspace_name, # type: str - dicomservice_patch_resource, # type: "_models.DicomServicePatchResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DicomService"] + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + dicomservice_patch_resource: "_models.DicomServicePatchResource", + **kwargs: Any + ) -> LROPoller["_models.DicomService"]: """Patch DICOM Service details. :param resource_group_name: The name of the resource group that contains the service instance. @@ -410,15 +583,19 @@ def begin_update( :type dicomservice_patch_resource: ~azure.mgmt.healthcareapis.models.DicomServicePatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DicomService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DicomService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,28 +608,21 @@ def begin_update( dicom_service_name=dicom_service_name, workspace_name=workspace_name, dicomservice_patch_resource=dicomservice_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DicomService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -464,64 +634,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - dicom_service_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - dicom_service_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a DICOM Service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -532,15 +692,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -555,22 +717,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'dicomServiceName': self._serialize.url("dicom_service_name", dicom_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -582,4 +736,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py index 881183343b67..966c09cb0dab 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py @@ -5,23 +5,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_iot_connector_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + iot_connector_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FhirDestinationsOperations(object): """FhirDestinationsOperations operations. @@ -45,14 +84,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_iot_connector( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.IotFhirDestinationCollection"] + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + **kwargs: Any + ) -> Iterable["_models.IotFhirDestinationCollection"]: """Lists all FHIR destinations for the given IoT Connector. :param resource_group_name: The name of the resource group that contains the service instance. @@ -62,8 +101,10 @@ def list_by_iot_connector( :param iot_connector_name: The name of IoT Connector resource. :type iot_connector_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IotFhirDestinationCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.IotFhirDestinationCollection] + :return: An iterator like instance of either IotFhirDestinationCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.IotFhirDestinationCollection] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestinationCollection"] @@ -71,37 +112,35 @@ def list_by_iot_connector( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_iot_connector.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_iot_connector_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + template_url=self.list_by_iot_connector.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_iot_connector_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IotFhirDestinationCollection', pipeline_response) + deserialized = self._deserialize("IotFhirDestinationCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,12 +153,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py index 6a2a9287a30e..847f50a960cb 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py @@ -5,25 +5,229 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + fhir_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "fhirServiceName": _SERIALIZER.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + fhir_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "fhirServiceName": _SERIALIZER.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + subscription_id: str, + fhir_service_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "fhirServiceName": _SERIALIZER.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "fhirServiceName": _SERIALIZER.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class FhirServicesOperations(object): """FhirServicesOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FhirServiceCollection"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.FhirServiceCollection"]: """Lists all FHIR Services for the given workspace. :param resource_group_name: The name of the resource group that contains the service instance. @@ -61,7 +265,8 @@ def list_by_workspace( :param workspace_name: The name of workspace resource. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FhirServiceCollection or the result of cls(response) + :return: An iterator like instance of either FhirServiceCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.FhirServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +275,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FhirServiceCollection', pipeline_response) + deserialized = self._deserialize("FhirServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +314,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - fhir_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FhirService" + resource_group_name: str, + workspace_name: str, + fhir_service_name: str, + **kwargs: Any + ) -> "_models.FhirService": """Gets the properties of the specified FHIR Service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -149,34 +352,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + fhir_service_name=fhir_service_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FhirService', pipeline_response) @@ -185,56 +378,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - fhir_service_name, # type: str - fhirservice, # type: "_models.FhirService" - **kwargs # type: Any - ): - # type: (...) -> "_models.FhirService" + resource_group_name: str, + workspace_name: str, + fhir_service_name: str, + fhirservice: "_models.FhirService", + **kwargs: Any + ) -> "_models.FhirService": cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(fhirservice, 'FhirService') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + fhir_service_name=fhir_service_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(fhirservice, 'FhirService') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FhirService', pipeline_response) @@ -249,17 +432,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - fhir_service_name, # type: str - fhirservice, # type: "_models.FhirService" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FhirService"] + resource_group_name: str, + workspace_name: str, + fhir_service_name: str, + fhirservice: "_models.FhirService", + **kwargs: Any + ) -> LROPoller["_models.FhirService"]: """Creates or updates a FHIR Service resource with the specified parameters. :param resource_group_name: The name of the resource group that contains the service instance. @@ -272,15 +457,19 @@ def begin_create_or_update( :type fhirservice: ~azure.mgmt.healthcareapis.models.FhirService :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either FhirService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FhirService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +482,21 @@ def begin_create_or_update( workspace_name=workspace_name, fhir_service_name=fhir_service_name, fhirservice=fhirservice, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FhirService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,56 +508,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - fhir_service_name, # type: str - workspace_name, # type: str - fhirservice_patch_resource, # type: "_models.FhirServicePatchResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.FhirService" + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + fhirservice_patch_resource: "_models.FhirServicePatchResource", + **kwargs: Any + ) -> "_models.FhirService": cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(fhirservice_patch_resource, 'FhirServicePatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(fhirservice_patch_resource, 'FhirServicePatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('FhirService', pipeline_response) @@ -387,17 +558,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - fhir_service_name, # type: str - workspace_name, # type: str - fhirservice_patch_resource, # type: "_models.FhirServicePatchResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FhirService"] + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + fhirservice_patch_resource: "_models.FhirServicePatchResource", + **kwargs: Any + ) -> LROPoller["_models.FhirService"]: """Patch FHIR Service details. :param resource_group_name: The name of the resource group that contains the service instance. @@ -410,15 +583,19 @@ def begin_update( :type fhirservice_patch_resource: ~azure.mgmt.healthcareapis.models.FhirServicePatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either FhirService or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either FhirService or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,28 +608,21 @@ def begin_update( fhir_service_name=fhir_service_name, workspace_name=workspace_name, fhirservice_patch_resource=fhirservice_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('FhirService', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -464,64 +634,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - fhir_service_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - fhir_service_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a FHIR Service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -532,15 +692,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -555,22 +717,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'fhirServiceName': self._serialize.url("fhir_service_name", fhir_service_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -582,4 +736,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py index a31325669583..29da1e48fbc5 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py @@ -5,24 +5,153 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + "fhirDestinationName": _SERIALIZER.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + "fhirDestinationName": _SERIALIZER.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + "fhirDestinationName": _SERIALIZER.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IotConnectorFhirDestinationOperations(object): """IotConnectorFhirDestinationOperations operations. @@ -46,15 +175,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - fhir_destination_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IotFhirDestination" + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + **kwargs: Any + ) -> "_models.IotFhirDestination": """Gets the properties of the specified Iot Connector FHIR destination. :param resource_group_name: The name of the resource group that contains the service instance. @@ -75,35 +204,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotFhirDestination', pipeline_response) @@ -112,58 +231,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - fhir_destination_name, # type: str - iot_fhir_destination, # type: "_models.IotFhirDestination" - **kwargs # type: Any - ): - # type: (...) -> "_models.IotFhirDestination" + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + iot_fhir_destination: "_models.IotFhirDestination", + **kwargs: Any + ) -> "_models.IotFhirDestination": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestination"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(iot_fhir_destination, 'IotFhirDestination') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(iot_fhir_destination, 'IotFhirDestination') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IotFhirDestination', pipeline_response) @@ -178,18 +287,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - fhir_destination_name, # type: str - iot_fhir_destination, # type: "_models.IotFhirDestination" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.IotFhirDestination"] + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + iot_fhir_destination: "_models.IotFhirDestination", + **kwargs: Any + ) -> LROPoller["_models.IotFhirDestination"]: """Creates or updates an IoT Connector FHIR destination resource with the specified parameters. :param resource_group_name: The name of the resource group that contains the service instance. @@ -205,15 +316,19 @@ def begin_create_or_update( :type iot_fhir_destination: ~azure.mgmt.healthcareapis.models.IotFhirDestination :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either IotFhirDestination or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IotFhirDestination or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestination"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +342,21 @@ def begin_create_or_update( iot_connector_name=iot_connector_name, fhir_destination_name=fhir_destination_name, iot_fhir_destination=iot_fhir_destination, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IotFhirDestination', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,67 +368,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - fhir_destination_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - fhir_destination_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an IoT Connector FHIR destination. :param resource_group_name: The name of the resource group that contains the service instance. @@ -334,15 +431,17 @@ def begin_delete( :type fhir_destination_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -358,23 +457,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'fhirDestinationName': self._serialize.url("fhir_destination_name", fhir_destination_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -386,4 +476,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations/{fhirDestinationName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py index a2fec3d2b7e3..12025df1364f 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py @@ -5,25 +5,229 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + iot_connector_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + iot_connector_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + subscription_id: str, + iot_connector_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "iotConnectorName": _SERIALIZER.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IotConnectorsOperations(object): """IotConnectorsOperations operations. @@ -47,13 +251,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.IotConnectorCollection"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.IotConnectorCollection"]: """Lists all IoT Connectors for the given workspace. :param resource_group_name: The name of the resource group that contains the service instance. @@ -61,7 +265,8 @@ def list_by_workspace( :param workspace_name: The name of workspace resource. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IotConnectorCollection or the result of cls(response) + :return: An iterator like instance of either IotConnectorCollection or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.IotConnectorCollection] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +275,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IotConnectorCollection', pipeline_response) + deserialized = self._deserialize("IotConnectorCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +314,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IotConnector" + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + **kwargs: Any + ) -> "_models.IotConnector": """Gets the properties of the specified IoT Connector. :param resource_group_name: The name of the resource group that contains the service instance. @@ -149,34 +352,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IotConnector', pipeline_response) @@ -185,56 +378,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - iot_connector, # type: "_models.IotConnector" - **kwargs # type: Any - ): - # type: (...) -> "_models.IotConnector" + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + iot_connector: "_models.IotConnector", + **kwargs: Any + ) -> "_models.IotConnector": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(iot_connector, 'IotConnector') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(iot_connector, 'IotConnector') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IotConnector', pipeline_response) @@ -249,17 +432,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - iot_connector_name, # type: str - iot_connector, # type: "_models.IotConnector" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.IotConnector"] + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + iot_connector: "_models.IotConnector", + **kwargs: Any + ) -> LROPoller["_models.IotConnector"]: """Creates or updates an IoT Connector resource with the specified parameters. :param resource_group_name: The name of the resource group that contains the service instance. @@ -272,15 +457,19 @@ def begin_create_or_update( :type iot_connector: ~azure.mgmt.healthcareapis.models.IotConnector :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either IotConnector or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IotConnector or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +482,21 @@ def begin_create_or_update( workspace_name=workspace_name, iot_connector_name=iot_connector_name, iot_connector=iot_connector, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IotConnector', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,56 +508,45 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - iot_connector_name, # type: str - workspace_name, # type: str - iot_connector_patch_resource, # type: "_models.IotConnectorPatchResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.IotConnector" + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + iot_connector_patch_resource: "_models.IotConnectorPatchResource", + **kwargs: Any + ) -> "_models.IotConnector": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(iot_connector_patch_resource, 'IotConnectorPatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(iot_connector_patch_resource, 'IotConnectorPatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IotConnector', pipeline_response) @@ -387,17 +558,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - iot_connector_name, # type: str - workspace_name, # type: str - iot_connector_patch_resource, # type: "_models.IotConnectorPatchResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.IotConnector"] + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + iot_connector_patch_resource: "_models.IotConnectorPatchResource", + **kwargs: Any + ) -> LROPoller["_models.IotConnector"]: """Patch an IoT Connector. :param resource_group_name: The name of the resource group that contains the service instance. @@ -410,15 +583,19 @@ def begin_update( :type iot_connector_patch_resource: ~azure.mgmt.healthcareapis.models.IotConnectorPatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either IotConnector or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IotConnector or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] lro_delay = kwargs.pop( 'polling_interval', @@ -431,28 +608,21 @@ def begin_update( iot_connector_name=iot_connector_name, workspace_name=workspace_name, iot_connector_patch_resource=iot_connector_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IotConnector', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -464,64 +634,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - iot_connector_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - iot_connector_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes an IoT Connector. :param resource_group_name: The name of the resource group that contains the service instance. @@ -532,15 +692,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -555,22 +717,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'iotConnectorName': self._serialize.url("iot_connector_name", iot_connector_name, 'str', max_length=24, min_length=3), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -582,4 +736,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py index 05f3a0723176..742e28b2bb09 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operation_results_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + location_name: str, + operation_result_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "locationName": _SERIALIZER.url("location_name", location_name, 'str'), + "operationResultId": _SERIALIZER.url("operation_result_id", operation_result_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OperationResultsOperations(object): """OperationResultsOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location_name, # type: str - operation_result_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationResultsDescription" + location_name: str, + operation_result_id: str, + **kwargs: Any + ) -> "_models.OperationResultsDescription": """Get the operation result for a long running operation. :param location_name: The location of the operation. @@ -67,33 +104,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'locationName': self._serialize.url("location_name", location_name, 'str'), - 'operationResultId': self._serialize.url("operation_result_id", operation_result_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + operation_result_id=operation_result_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationResultsDescription', pipeline_response) @@ -102,4 +129,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/locations/{locationName}/operationresults/{operationResultId}'} # type: ignore + diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py index 8f1a61bfb031..a3f06f18313b 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.HealthcareApis/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListOperations"] + **kwargs: Any + ) -> Iterable["_models.ListOperations"]: """Lists all of the available operations supported by Microsoft Healthcare resource provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListOperations', pipeline_response) + deserialized = self._deserialize("ListOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +122,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py index 1735caa3fb7a..aac47c04ebd1 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_service_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResultDescription"] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResultDescription"]: """Lists all private endpoint connections for a service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -61,8 +219,10 @@ def list_by_service( :param resource_name: The name of the service instance. :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResultDescription or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionListResultDescription] + :return: An iterator like instance of either PrivateEndpointConnectionListResultDescription or + the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionListResultDescription] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultDescription"] @@ -70,36 +230,33 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResultDescription', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResultDescription", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +269,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionDescription" + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionDescription": """Gets the specified private endpoint connection associated with the service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -150,34 +308,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionDescription', pipeline_response) @@ -186,56 +334,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionDescription" + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionDescription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionDescription', pipeline_response) @@ -243,17 +381,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - resource_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnectionDescription"] + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnectionDescription"]: """Update the state of the specified private endpoint connection associated with the service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -267,15 +407,20 @@ def begin_create_or_update( :type properties: ~azure.mgmt.healthcareapis.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnectionDescription or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnectionDescription or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionDescription] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,28 +433,21 @@ def begin_create_or_update( resource_name=resource_name, private_endpoint_connection_name=private_endpoint_connection_name, properties=properties, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnectionDescription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -321,64 +459,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - resource_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - resource_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a private endpoint connection. :param resource_group_name: The name of the resource group that contains the service instance. @@ -390,15 +518,17 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -413,22 +543,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -440,4 +562,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py index 3904668b9a53..82cda7392231 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_private_link_resources_operations.py @@ -5,22 +5,96 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_service_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + "groupName": _SERIALIZER.url("group_name", group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +118,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_service( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResultDescription" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResultDescription": """Gets the private link resources that need to be created for a service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -67,33 +141,23 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.list_by_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResultDescription', pipeline_response) @@ -102,16 +166,18 @@ def list_by_service( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceDescription" + resource_group_name: str, + resource_name: str, + group_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceDescription": """Gets a private link resource that need to be created for a service. :param resource_group_name: The name of the resource group that contains the service instance. @@ -130,34 +196,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - 'groupName': self._serialize.url("group_name", group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + group_name=group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceDescription', pipeline_response) @@ -166,4 +222,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}/privateLinkResources/{groupName}'} # type: ignore + diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py index 3a523501ffc0..b787e2badd5d 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_services_operations.py @@ -5,25 +5,290 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "resourceName": _SERIALIZER.url("resource_name", resource_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +312,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServicesDescription" + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.ServicesDescription": """Get the metadata of a service instance. :param resource_group_name: The name of the resource group that contains the service instance. @@ -70,33 +335,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServicesDescription', pipeline_response) @@ -105,54 +360,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - service_description, # type: "_models.ServicesDescription" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServicesDescription" + resource_group_name: str, + resource_name: str, + service_description: "_models.ServicesDescription", + **kwargs: Any + ) -> "_models.ServicesDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(service_description, 'ServicesDescription') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(service_description, 'ServicesDescription') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ServicesDescription', pipeline_response) @@ -164,16 +409,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - resource_name, # type: str - service_description, # type: "_models.ServicesDescription" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServicesDescription"] + resource_group_name: str, + resource_name: str, + service_description: "_models.ServicesDescription", + **kwargs: Any + ) -> LROPoller["_models.ServicesDescription"]: """Create or update the metadata of a service instance. :param resource_group_name: The name of the resource group that contains the service instance. @@ -184,15 +431,19 @@ def begin_create_or_update( :type service_description: ~azure.mgmt.healthcareapis.models.ServicesDescription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServicesDescription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServicesDescription or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -204,27 +455,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, resource_name=resource_name, service_description=service_description, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServicesDescription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -236,54 +481,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - resource_name, # type: str - service_patch_description, # type: "_models.ServicesPatchDescription" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServicesDescription" + resource_group_name: str, + resource_name: str, + service_patch_description: "_models.ServicesPatchDescription", + **kwargs: Any + ) -> "_models.ServicesDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(service_patch_description, 'ServicesPatchDescription') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(service_patch_description, 'ServicesPatchDescription') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServicesDescription', pipeline_response) @@ -291,16 +525,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - resource_name, # type: str - service_patch_description, # type: "_models.ServicesPatchDescription" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServicesDescription"] + resource_group_name: str, + resource_name: str, + service_patch_description: "_models.ServicesPatchDescription", + **kwargs: Any + ) -> LROPoller["_models.ServicesDescription"]: """Update the metadata of a service instance. :param resource_group_name: The name of the resource group that contains the service instance. @@ -311,15 +547,19 @@ def begin_update( :type service_patch_description: ~azure.mgmt.healthcareapis.models.ServicesPatchDescription :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServicesDescription or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServicesDescription or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.ServicesDescription] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescription"] lro_delay = kwargs.pop( 'polling_interval', @@ -331,27 +571,21 @@ def begin_update( resource_group_name=resource_group_name, resource_name=resource_name, service_patch_description=service_patch_description, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServicesDescription', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,61 +597,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + resource_name=resource_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a service instance. :param resource_group_name: The name of the resource group that contains the service instance. @@ -426,15 +650,17 @@ def begin_delete( :type resource_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -448,21 +674,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'resourceName': self._serialize.url("resource_name", resource_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -474,18 +693,21 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services/{resourceName}'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServicesDescriptionListResult"] + **kwargs: Any + ) -> Iterable["_models.ServicesDescriptionListResult"]: """Get all the service instances in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServicesDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] + :return: An iterator like instance of either ServicesDescriptionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescriptionListResult"] @@ -493,34 +715,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServicesDescriptionListResult', pipeline_response) + deserialized = self._deserialize("ServicesDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -533,30 +750,33 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/services'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServicesDescriptionListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServicesDescriptionListResult"]: """Get all the service instances in a resource group. :param resource_group_name: The name of the resource group that contains the service instance. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServicesDescriptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] + :return: An iterator like instance of either ServicesDescriptionListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ServicesDescriptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServicesDescriptionListResult"] @@ -564,35 +784,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServicesDescriptionListResult', pipeline_response) + deserialized = self._deserialize("ServicesDescriptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -605,28 +821,30 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/services'} # type: ignore + @distributed_trace def check_name_availability( self, - check_name_availability_inputs, # type: "_models.CheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServicesNameAvailabilityInfo" + check_name_availability_inputs: "_models.CheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.ServicesNameAvailabilityInfo": """Check if a service instance name is available. :param check_name_availability_inputs: Set the name parameter in the CheckNameAvailabilityParameters structure to the name of the service instance to check. - :type check_name_availability_inputs: ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters + :type check_name_availability_inputs: + ~azure.mgmt.healthcareapis.models.CheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ServicesNameAvailabilityInfo, or the result of cls(response) :rtype: ~azure.mgmt.healthcareapis.models.ServicesNameAvailabilityInfo @@ -637,36 +855,26 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_name_availability_inputs, 'CheckNameAvailabilityParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(check_name_availability_inputs, 'CheckNameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServicesNameAvailabilityInfo', pipeline_response) @@ -675,4 +883,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/checkNameAvailability'} # type: ignore + diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py index b49c90ed7091..e6fea33e8777 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspacesOperations(object): """WorkspacesOperations operations. @@ -47,11 +272,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceList"] + **kwargs: Any + ) -> Iterable["_models.WorkspaceList"]: """Lists all the available workspaces under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -64,34 +289,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,23 +324,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HealthcareApis/workspaces'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkspaceList"]: """Lists all the available workspaces under the specified resource group. :param resource_group_name: The name of the resource group that contains the service instance. @@ -135,35 +356,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -176,24 +393,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.Workspace": """Gets the properties of the specified workspace. :param resource_group_name: The name of the resource group that contains the service instance. @@ -210,33 +428,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Workspace', pipeline_response) @@ -245,54 +453,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + workspace: "_models.Workspace", + **kwargs: Any + ) -> "_models.Workspace": cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace, 'Workspace') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -307,16 +505,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + workspace: "_models.Workspace", + **kwargs: Any + ) -> LROPoller["_models.Workspace"]: """Creates or updates a workspace resource with the specified parameters. :param resource_group_name: The name of the resource group that contains the service instance. @@ -327,15 +527,18 @@ def begin_create_or_update( :type workspace: ~azure.mgmt.healthcareapis.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -347,27 +550,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace=workspace, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -379,54 +576,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace_patch_resource, # type: "_models.WorkspacePatchResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + workspace_patch_resource: "_models.WorkspacePatchResource", + **kwargs: Any + ) -> "_models.Workspace": cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace_patch_resource, 'WorkspacePatchResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace_patch_resource, 'WorkspacePatchResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -438,16 +624,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace_patch_resource, # type: "_models.WorkspacePatchResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + workspace_patch_resource: "_models.WorkspacePatchResource", + **kwargs: Any + ) -> LROPoller["_models.Workspace"]: """Patch workspace details. :param resource_group_name: The name of the resource group that contains the service instance. @@ -458,15 +646,18 @@ def begin_update( :type workspace_patch_resource: ~azure.mgmt.healthcareapis.models.WorkspacePatchResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -478,27 +669,21 @@ def begin_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace_patch_resource=workspace_patch_resource, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -510,61 +695,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.Error, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a specified workspace. :param resource_group_name: The name of the resource group that contains the service instance. @@ -573,15 +748,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -595,21 +772,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -621,4 +791,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore