From 0bd54914deb85f1248eca03e3348ebf88c193d8e Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Thu, 26 Aug 2021 16:20:30 +0800 Subject: [PATCH] [AutoRelease] t2-healthcareapis-2021-08-26-27542 (#20422) * CodeGen from PR 15381 in Azure/azure-rest-api-specs Update readme.md (#15381) * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines --- .../azure-mgmt-healthcareapis/CHANGELOG.md | 11 + .../azure-mgmt-healthcareapis/_meta.json | 11 +- .../mgmt/healthcareapis/_configuration.py | 2 +- .../_healthcare_apis_management_client.py | 69 +- .../azure/mgmt/healthcareapis/_metadata.json | 26 +- .../azure/mgmt/healthcareapis/_version.py | 2 +- .../mgmt/healthcareapis/aio/_configuration.py | 2 +- .../aio/_healthcare_apis_management_client.py | 68 +- .../healthcareapis/aio/operations/__init__.py | 20 +- .../operations/_dicom_services_operations.py | 573 +++++++ .../_fhir_destinations_operations.py | 121 ++ .../operations/_fhir_services_operations.py | 573 +++++++ ...t_connector_fhir_destination_operations.py | 380 +++++ .../operations/_iot_connectors_operations.py | 573 +++++++ .../_operation_results_operations.py | 22 +- .../aio/operations/_operations.py | 16 +- ...private_endpoint_connections_operations.py | 28 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_services_operations.py | 46 +- .../aio/operations/_workspaces_operations.py | 611 ++++++++ .../mgmt/healthcareapis/models/__init__.py | 114 +- ...healthcare_apis_management_client_enums.py | 24 + .../mgmt/healthcareapis/models/_models.py | 1195 ++++++++++++++- .../mgmt/healthcareapis/models/_models_py3.py | 1318 ++++++++++++++++- .../healthcareapis/operations/__init__.py | 20 +- .../operations/_dicom_services_operations.py | 585 ++++++++ .../_fhir_destinations_operations.py | 126 ++ .../operations/_fhir_services_operations.py | 585 ++++++++ ...t_connector_fhir_destination_operations.py | 389 +++++ .../operations/_iot_connectors_operations.py | 585 ++++++++ .../_operation_results_operations.py | 20 +- .../healthcareapis/operations/_operations.py | 14 +- ...private_endpoint_connections_operations.py | 16 +- .../_private_link_resources_operations.py | 4 +- .../operations/_services_operations.py | 26 +- .../operations/_workspaces_operations.py | 624 ++++++++ 36 files changed, 8515 insertions(+), 292 deletions(-) create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py create mode 100644 sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/CHANGELOG.md b/sdk/healthcareapis/azure-mgmt-healthcareapis/CHANGELOG.md index 499aea9a8eb4..e9615bf64034 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/CHANGELOG.md +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/CHANGELOG.md @@ -1,5 +1,16 @@ # Release History +## 1.1.0b1 (2021-08-26) + +**Features** + + - Added operation group IotConnectorFhirDestinationOperations + - Added operation group WorkspacesOperations + - Added operation group FhirDestinationsOperations + - Added operation group DicomServicesOperations + - Added operation group FhirServicesOperations + - Added operation group IotConnectorsOperations + ## 1.0.0 (2021-04-12) **Features** diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json index 1dd8c52e49c7..31a5d6cb922c 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.0.6369", - "use": "@autorest/python@5.6.2", - "commit": "273cebe601c137222c802504425047845d4be409", + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "84d82e9a8f422a930f4e0ffbe037ae9dce5fce3f", "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.6.2 --version=3.0.6369", + "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", "readme": "specification/healthcareapis/resource-manager/readme.md" } \ No newline at end of file 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 12a172be523d..7734c25ae3b9 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-01-11" + self.api_version = "2021-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-healthcareapis/{}'.format(VERSION)) self._configure(**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 4ce2bdcec7f4..a15df30e957d 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 @@ -16,13 +16,20 @@ 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 Operations -from .operations import OperationResultsOperations 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 @@ -31,14 +38,26 @@ class HealthcareApisManagementClient(object): :ivar services: ServicesOperations operations :vartype services: azure.mgmt.healthcareapis.operations.ServicesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.healthcareapis.operations.Operations - :ivar operation_results: OperationResultsOperations operations - :vartype operation_results: azure.mgmt.healthcareapis.operations.OperationResultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.healthcareapis.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :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 + :vartype dicom_services: azure.mgmt.healthcareapis.operations.DicomServicesOperations + :ivar iot_connectors: IotConnectorsOperations operations + :vartype iot_connectors: azure.mgmt.healthcareapis.operations.IotConnectorsOperations + :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 + :ivar fhir_services: FhirServicesOperations operations + :vartype fhir_services: azure.mgmt.healthcareapis.operations.FhirServicesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.healthcareapis.operations.Operations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.healthcareapis.operations.OperationResultsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. @@ -67,14 +86,44 @@ def __init__( self.services = ServicesOperations( 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.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 + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 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 90bc0f84324b..b1d8ee6d63f8 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_metadata.json +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2021-01-11", - "total_api_version_list": ["2021-01-11"], + "chosen_version": "2021-06-01-preview", + "total_api_version_list": ["2021-06-01-preview"], "client": { "name": "HealthcareApisManagementClient", "filename": "_healthcare_apis_management_client", @@ -10,8 +10,8 @@ "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\"]}}}", - "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\"]}}}" + "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\"]}}}" }, "global_parameters": { "sync": { @@ -99,15 +99,15 @@ }, "operation_groups": { "services": "ServicesOperations", - "operations": "Operations", - "operation_results": "OperationResultsOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", - "private_link_resources": "PrivateLinkResourcesOperations" - }, - "operation_mixins": { - "sync_imports": "None", - "async_imports": "None", - "operations": { - } + "private_link_resources": "PrivateLinkResourcesOperations", + "workspaces": "WorkspacesOperations", + "dicom_services": "DicomServicesOperations", + "iot_connectors": "IotConnectorsOperations", + "fhir_destinations": "FhirDestinationsOperations", + "iot_connector_fhir_destination": "IotConnectorFhirDestinationOperations", + "fhir_services": "FhirServicesOperations", + "operations": "Operations", + "operation_results": "OperationResultsOperations" } } \ No newline at end of file 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 c47f66669f1b..653b73a4a199 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.0.0" +VERSION = "1.1.0b1" 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 416b4d5c686d..36fbfd1a34c9 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-01-11" + self.api_version = "2021-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-healthcareapis/{}'.format(VERSION)) self._configure(**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 cfa42db6f02c..6349e33e1e1a 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -17,10 +18,16 @@ from ._configuration import HealthcareApisManagementClientConfiguration from .operations import ServicesOperations -from .operations import Operations -from .operations import OperationResultsOperations 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 @@ -29,14 +36,26 @@ class HealthcareApisManagementClient(object): :ivar services: ServicesOperations operations :vartype services: azure.mgmt.healthcareapis.aio.operations.ServicesOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.healthcareapis.aio.operations.Operations - :ivar operation_results: OperationResultsOperations operations - :vartype operation_results: azure.mgmt.healthcareapis.aio.operations.OperationResultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :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 + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.healthcareapis.aio.operations.WorkspacesOperations + :ivar dicom_services: DicomServicesOperations operations + :vartype dicom_services: azure.mgmt.healthcareapis.aio.operations.DicomServicesOperations + :ivar iot_connectors: IotConnectorsOperations operations + :vartype iot_connectors: azure.mgmt.healthcareapis.aio.operations.IotConnectorsOperations + :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 + :ivar fhir_services: FhirServicesOperations operations + :vartype fhir_services: azure.mgmt.healthcareapis.aio.operations.FhirServicesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.healthcareapis.aio.operations.Operations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: azure.mgmt.healthcareapis.aio.operations.OperationResultsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. @@ -64,14 +83,43 @@ def __init__( self.services = ServicesOperations( 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.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: + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 async def close(self) -> None: await self._client.close() diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/__init__.py index a7371eb34ba7..8fc42e6f4ecb 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/__init__.py @@ -7,15 +7,27 @@ # -------------------------------------------------------------------------- from ._services_operations import ServicesOperations -from ._operations import Operations -from ._operation_results_operations import OperationResultsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._workspaces_operations import WorkspacesOperations +from ._dicom_services_operations import DicomServicesOperations +from ._iot_connectors_operations import IotConnectorsOperations +from ._fhir_destinations_operations import FhirDestinationsOperations +from ._iot_connector_fhir_destination_operations import IotConnectorFhirDestinationOperations +from ._fhir_services_operations import FhirServicesOperations +from ._operations import Operations +from ._operation_results_operations import OperationResultsOperations __all__ = [ 'ServicesOperations', - 'Operations', - 'OperationResultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'WorkspacesOperations', + 'DicomServicesOperations', + 'IotConnectorsOperations', + 'FhirDestinationsOperations', + 'IotConnectorFhirDestinationOperations', + 'FhirServicesOperations', + 'Operations', + 'OperationResultsOperations', ] 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 new file mode 100644 index 000000000000..787848039f2c --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_dicom_services_operations.py @@ -0,0 +1,573 @@ +# 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 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DicomServicesOperations: + """DicomServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomServiceCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DicomServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + async def get( + self, + 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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DicomService, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.DicomService + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DicomService', pipeline_response) + + if cls: + 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, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('DicomService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DicomService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DicomService', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + dicom_service_name: str, + dicomservice: "_models.DicomService", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :param dicomservice: The parameters for creating or updating a Dicom Service resource. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dicom_service_name=dicom_service_name, + dicomservice=dicomservice, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('DicomService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DicomService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + dicomservice_patch_resource: "_models.DicomServicePatchResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DicomService"]: + """Patch DICOM Service details. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param dicomservice_patch_resource: The parameters for updating a Dicom Service. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.DicomService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + dicomservice_patch_resource=dicomservice_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + dicom_service_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a DICOM Service. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 new file mode 100644 index 000000000000..3fb60eb7a0ee --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_destinations_operations.py @@ -0,0 +1,121 @@ +# 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 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FhirDestinationsOperations: + """FhirDestinationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_iot_connector( + self, + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestinationCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotFhirDestinationCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_iot_connector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations'} # type: ignore 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 new file mode 100644 index 000000000000..8d1422d589c1 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_fhir_services_operations.py @@ -0,0 +1,573 @@ +# 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 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FhirServicesOperations: + """FhirServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirServiceCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('FhirServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + async def get( + self, + 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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FhirService, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.FhirService + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FhirService', pipeline_response) + + if cls: + 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, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('FhirService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FhirService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('FhirService', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + fhir_service_name: str, + fhirservice: "_models.FhirService", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :param fhirservice: The parameters for creating or updating a Fhir Service resource. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + fhir_service_name=fhir_service_name, + fhirservice=fhirservice, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('FhirService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('FhirService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + fhirservice_patch_resource: "_models.FhirServicePatchResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.FhirService"]: + """Patch FHIR Service details. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param fhirservice_patch_resource: The parameters for updating a Fhir Service. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.FhirService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + fhirservice_patch_resource=fhirservice_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + fhir_service_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a FHIR Service. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 new file mode 100644 index 000000000000..1f262c87fa0f --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connector_fhir_destination_operations.py @@ -0,0 +1,380 @@ +# 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 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotConnectorFhirDestinationOperations: + """IotConnectorFhirDestinationOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + 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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param fhir_destination_name: The name of IoT Connector FHIR destination resource. + :type fhir_destination_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotFhirDestination, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.IotFhirDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if cls: + 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, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + iot_fhir_destination: "_models.IotFhirDestination", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param fhir_destination_name: The name of IoT Connector FHIR destination resource. + :type fhir_destination_name: str + :param iot_fhir_destination: The parameters for creating or updating an IoT Connector FHIR + destination resource. + :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. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestination"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + iot_fhir_destination=iot_fhir_destination, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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 = 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) + + 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 + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + fhir_destination_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an IoT Connector FHIR destination. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param fhir_destination_name: The name of IoT Connector FHIR destination resource. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 new file mode 100644 index 000000000000..510e0a3c367e --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_iot_connectors_operations.py @@ -0,0 +1,573 @@ +# 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 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IotConnectorsOperations: + """IotConnectorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnectorCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IotConnectorCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + async def get( + self, + 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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :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: IotConnector, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.IotConnector + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotConnector', pipeline_response) + + if cls: + 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, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + iot_connector_name: str, + iot_connector: "_models.IotConnector", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param iot_connector: The parameters for creating or updating an IoT Connectors resource. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + iot_connector=iot_connector, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + iot_connector_patch_resource: "_models.IotConnectorPatchResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.IotConnector"]: + """Patch an IoT Connector. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_patch_resource: The parameters for updating an IoT Connector. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.IotConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + iot_connector_patch_resource=iot_connector_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + iot_connector_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an IoT Connector. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 2309354ff99a..3f2cb7302c12 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,7 +5,7 @@ # 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 Any, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -44,8 +44,8 @@ async def get( self, location_name: str, operation_result_id: str, - **kwargs - ) -> Union["_models.OperationResultsDescription", "_models.ErrorDetails"]: + **kwargs: Any + ) -> "_models.OperationResultsDescription": """Get the operation result for a long running operation. :param location_name: The location of the operation. @@ -53,16 +53,16 @@ async def get( :param operation_result_id: The ID of the operation result to get. :type operation_result_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResultsDescription or ErrorDetails, or the result of cls(response) - :rtype: ~azure.mgmt.healthcareapis.models.OperationResultsDescription or ~azure.mgmt.healthcareapis.models.ErrorDetails + :return: OperationResultsDescription, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.OperationResultsDescription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.OperationResultsDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultsDescription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -86,16 +86,12 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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) - if response.status_code == 200: - deserialized = self._deserialize('OperationResultsDescription', pipeline_response) - - if response.status_code == 404: - deserialized = self._deserialize('ErrorDetails', pipeline_response) + deserialized = self._deserialize('OperationResultsDescription', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) 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 f2fd73309074..72ce6cf41e2f 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 @@ -43,21 +43,21 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs - ) -> AsyncIterable["_models.OperationListResult"]: - """Lists all of the available Healthcare service REST API operations. + **kwargs: Any + ) -> AsyncIterable["_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 - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.healthcareapis.models.OperationListResult] + :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] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -80,7 +80,7 @@ def prepare_request(next_link=None): return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize('ListOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) 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 3a08dd779b9a..5236d1f836b3 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 @@ -47,7 +47,7 @@ def list_by_service( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnectionListResultDescription"]: """Lists all private endpoint connections for a service. @@ -65,7 +65,7 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnectionDescription": """Gets the specified private endpoint connection associated with the service. @@ -144,7 +144,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -188,14 +188,14 @@ async def _create_or_update_initial( resource_name: str, private_endpoint_connection_name: str, properties: "_models.PrivateEndpointConnection", - **kwargs + **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-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -244,7 +244,7 @@ async def begin_create_or_update( resource_name: str, private_endpoint_connection_name: str, properties: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnectionDescription"]: """Update the state of the specified private endpoint connection associated with the service. @@ -259,8 +259,8 @@ 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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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) @@ -320,14 +320,14 @@ async def _delete_initial( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **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-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -367,7 +367,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a private endpoint connection. @@ -380,8 +380,8 @@ 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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 None or the result of cls(response) 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 ebf1345a020c..ba07bc065640 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 @@ -44,7 +44,7 @@ async def list_by_service( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResourceListResultDescription": """Gets the private link resources that need to be created for a service. @@ -62,7 +62,7 @@ async def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -104,7 +104,7 @@ async def get( resource_group_name: str, resource_name: str, group_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResourceDescription": """Gets a private link resource that need to be created for a service. @@ -124,7 +124,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL 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 8d572d9027af..06ab811652ac 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 @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.ServicesDescription": """Get the metadata of a service instance. @@ -65,7 +65,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -107,14 +107,14 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, service_description: "_models.ServicesDescription", - **kwargs + **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-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -165,7 +165,7 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, service_description: "_models.ServicesDescription", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ServicesDescription"]: """Create or update the metadata of a service instance. @@ -177,8 +177,8 @@ 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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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) @@ -236,14 +236,14 @@ async def _update_initial( resource_group_name: str, resource_name: str, service_patch_description: "_models.ServicesPatchDescription", - **kwargs + **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-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -290,7 +290,7 @@ async def begin_update( resource_group_name: str, resource_name: str, service_patch_description: "_models.ServicesPatchDescription", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ServicesDescription"]: """Update the metadata of a service instance. @@ -302,8 +302,8 @@ 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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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) @@ -360,14 +360,14 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **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-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -405,7 +405,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Delete a service instance. @@ -415,8 +415,8 @@ 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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 None or the result of cls(response) @@ -467,7 +467,7 @@ def get_long_running_output(pipeline_response): def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ServicesDescriptionListResult"]: """Get all the service instances in a subscription. @@ -481,7 +481,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -535,7 +535,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ServicesDescriptionListResult"]: """Get all the service instances in a resource group. @@ -551,7 +551,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -606,7 +606,7 @@ async def get_next(next_link=None): async def check_name_availability( self, check_name_availability_inputs: "_models.CheckNameAvailabilityParameters", - **kwargs + **kwargs: Any ) -> "_models.ServicesNameAvailabilityInfo": """Check if a service instance name is available. @@ -623,7 +623,7 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 new file mode 100644 index 000000000000..a1e1b1a5d1d4 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/aio/operations/_workspaces_operations.py @@ -0,0 +1,611 @@ +# 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 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspacesOperations: + """WorkspacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_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. + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + async def get( + self, + 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. + :type resource_group_name: str + :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: Workspace, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + 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, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace: "_models.Workspace", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param workspace: The parameters for creating or updating a healthcare workspace. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace=workspace, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_patch_resource: "_models.WorkspacePatchResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.Workspace"]: + """Patch workspace details. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param workspace_patch_resource: The parameters for updating a specified workspace. + :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. + :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) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.healthcareapis.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_patch_resource=workspace_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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( + self, + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a specified workspace. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 a6c01b942eb9..29d388266366 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 @@ -8,11 +8,34 @@ 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 Operation + 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 OperationListResult from ._models_py3 import OperationResultsDescription from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection @@ -23,12 +46,16 @@ 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 @@ -37,13 +64,41 @@ 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 Operation # 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 OperationListResult # type: ignore from ._models import OperationResultsDescription # type: ignore from ._models import PrivateEndpoint # type: ignore from ._models import PrivateEndpointConnection # type: ignore @@ -54,12 +109,16 @@ 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 @@ -68,9 +127,17 @@ 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 ._healthcare_apis_management_client_enums import ( + ActionType, CreatedByType, + FhirServiceKind, + IotIdentityResolutionType, Kind, ManagedServiceIdentityType, OperationResultStatus, @@ -83,11 +150,34 @@ __all__ = [ 'CheckNameAvailabilityParameters', + 'DicomService', + 'DicomServiceAuthenticationConfiguration', + 'DicomServiceCollection', + 'DicomServicePatchResource', + 'Error', 'ErrorDetails', 'ErrorDetailsInternal', - 'Operation', + 'FhirService', + 'FhirServiceAccessPolicyEntry', + 'FhirServiceAcrConfiguration', + 'FhirServiceAuthenticationConfiguration', + 'FhirServiceCollection', + 'FhirServiceCorsConfiguration', + 'FhirServiceExportConfiguration', + 'FhirServicePatchResource', + 'IotConnector', + 'IotConnectorCollection', + 'IotConnectorPatchResource', + 'IotDestinationProperties', + 'IotEventHubIngestionEndpointConfiguration', + 'IotFhirDestination', + 'IotFhirDestinationCollection', + 'IotFhirDestinationProperties', + 'IotMappingProperties', + 'ListOperations', + 'LocationBasedResource', + 'OperationDetail', 'OperationDisplay', - 'OperationListResult', 'OperationResultsDescription', 'PrivateEndpoint', 'PrivateEndpointConnection', @@ -98,12 +188,16 @@ 'PrivateLinkResourceListResultDescription', 'PrivateLinkServiceConnectionState', 'Resource', + 'ResourceCore', + 'ResourceTags', 'ServiceAccessPolicyEntry', 'ServiceAcrConfigurationInfo', 'ServiceAuthenticationConfigurationInfo', 'ServiceCorsConfigurationInfo', 'ServiceCosmosDbConfigurationInfo', 'ServiceExportConfigurationInfo', + 'ServiceManagedIdentity', + 'ServiceManagedIdentityIdentity', 'ServicesDescription', 'ServicesDescriptionListResult', 'ServicesNameAvailabilityInfo', @@ -112,7 +206,15 @@ 'ServicesResource', 'ServicesResourceIdentity', 'SystemData', + 'TaggedResource', + 'Workspace', + 'WorkspaceList', + 'WorkspacePatchResource', + 'WorkspaceProperties', + 'ActionType', 'CreatedByType', + 'FhirServiceKind', + 'IotIdentityResolutionType', 'Kind', 'ManagedServiceIdentityType', 'OperationResultStatus', 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 0aacac2c32dd..571eb62aadad 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 @@ -26,6 +26,12 @@ def __getattr__(cls, name): raise AttributeError(name) +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)): """The type of identity that created the resource. """ @@ -35,6 +41,20 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" +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)): + """The type of IoT identity resolution to use with the destination. + """ + + CREATE = "Create" + LOOKUP = "Lookup" + class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The kind of the service. """ @@ -90,6 +110,10 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" DEPROVISIONED = "Deprovisioned" + MOVING = "Moving" + SUSPENDED = "Suspended" + WARNED = "Warned" + SYSTEM_MAINTENANCE = "SystemMaintenance" class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Control permission for data plane traffic coming from public networks while private endpoint is 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 index 27922b1edca2..9664b3639c39 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/models/_models.py @@ -40,92 +40,1056 @@ def __init__( 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: Object containing error details. - :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + :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 = { - 'error': {'key': 'error', 'type': 'ErrorDetailsInternal'}, + '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(ErrorDetails, self).__init__(**kwargs) - self.error = kwargs.get('error', None) + 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 ErrorDetailsInternal(msrest.serialization.Model): - """Error details. +class IotFhirDestination(LocationBasedResource): + """IoT Connector FHIR destination definition. 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 + 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 = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, + '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 = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + '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(ErrorDetailsInternal, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None + 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 Operation(msrest.serialization.Model): +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: Operation name: {provider}/{resource}/{read | write | action | delete}. + :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 - :param display: The information displayed about the operation. - :type display: ~azure.mgmt.healthcareapis.models.OperationDisplay + :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'}, - 'origin': {'key': 'origin', '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(Operation, self).__init__(**kwargs) + super(OperationDetail, self).__init__(**kwargs) self.name = None - self.origin = None + self.is_data_action = None self.display = kwargs.get('display', None) + self.origin = None + self.action_type = None class OperationDisplay(msrest.serialization.Model): @@ -168,36 +1132,6 @@ def __init__( self.description = None -class OperationListResult(msrest.serialization.Model): - """A list of service operations. It contains a list of operations and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param next_link: The link used to get the next page of service description objects. - :type next_link: str - :ivar value: A list of service operations supported by the Microsoft.HealthcareApis resource - provider. - :vartype value: list[~azure.mgmt.healthcareapis.models.Operation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = None - - class OperationResultsDescription(msrest.serialization.Model): """The properties indicating the operation result of an operation on a service. @@ -213,7 +1147,7 @@ class OperationResultsDescription(msrest.serialization.Model): :ivar start_time: The time that the operation was started. :vartype start_time: str :param properties: Additional properties of the operation result. - :type properties: object + :type properties: any """ _validation = { @@ -379,7 +1313,7 @@ class PrivateEndpointConnectionDescription(PrivateEndpointConnection): Possible values include: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionProvisioningState - :ivar system_data: System metadata for this resource. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -495,7 +1429,7 @@ class PrivateLinkResourceDescription(PrivateLinkResource): :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: System metadata for this resource. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -731,6 +1665,26 @@ def __init__( 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. @@ -945,7 +1899,7 @@ class ServicesProperties(msrest.serialization.Model): :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned". + "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] @@ -1077,3 +2031,116 @@ def __init__( 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 3c80dbdd29bf..f573719be079 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 @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -48,84 +48,1145 @@ def __init__( self.type = type -class ErrorDetails(msrest.serialization.Model): +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, + *, + etag: Optional[str] = None, + **kwargs + ): + super(ResourceCore, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.etag = etag + + +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, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + **kwargs + ): + super(LocationBasedResource, self).__init__(etag=etag, **kwargs) + self.location = location + + +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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ResourceTags, self).__init__(**kwargs) + self.tags = tags + + +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, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TaggedResource, self).__init__(tags=tags, etag=etag, location=location, **kwargs) + self.id = None + self.name = None + self.type = None + self.etag = etag + self.location = location + self.tags = tags + + +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, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + authentication_configuration: Optional["DicomServiceAuthenticationConfiguration"] = None, + **kwargs + ): + super(DicomService, self).__init__(etag=etag, location=location, tags=tags, **kwargs) + self.system_data = None + self.provisioning_state = provisioning_state + self.authentication_configuration = authentication_configuration + 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, + *, + next_link: Optional[str] = None, + value: Optional[List["DicomService"]] = None, + **kwargs + ): + super(DicomServiceCollection, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(DicomServicePatchResource, self).__init__(tags=tags, **kwargs) + + +class Error(msrest.serialization.Model): """Error details. - :param error: Object containing error details. - :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + :param error: Error details. + :type error: ~azure.mgmt.healthcareapis.models.ErrorDetailsInternal + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetailsInternal'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetailsInternal"] = None, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.error = error + + +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, + *, + error: Optional["ErrorDetailsInternal"] = None, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.error = error + + +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, + *, + identity: Optional["ServiceManagedIdentityIdentity"] = None, + **kwargs + ): + super(ServiceManagedIdentity, self).__init__(**kwargs) + self.identity = identity + + +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, + *, + identity: Optional["ServiceManagedIdentityIdentity"] = None, + etag: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + kind: Optional[Union[str, "FhirServiceKind"]] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + access_policies: Optional[List["FhirServiceAccessPolicyEntry"]] = None, + acr_configuration: Optional["FhirServiceAcrConfiguration"] = None, + authentication_configuration: Optional["FhirServiceAuthenticationConfiguration"] = None, + cors_configuration: Optional["FhirServiceCorsConfiguration"] = None, + export_configuration: Optional["FhirServiceExportConfiguration"] = None, + **kwargs + ): + super(FhirService, self).__init__(etag=etag, location=location, tags=tags, identity=identity, **kwargs) + self.identity = identity + self.kind = kind + self.system_data = None + self.provisioning_state = provisioning_state + self.access_policies = access_policies + self.acr_configuration = acr_configuration + self.authentication_configuration = authentication_configuration + self.cors_configuration = cors_configuration + self.export_configuration = export_configuration + self.id = None + self.name = None + self.type = None + self.etag = etag + self.location = location + self.tags = tags + self.kind = kind + self.system_data = None + self.provisioning_state = provisioning_state + self.access_policies = access_policies + self.acr_configuration = acr_configuration + self.authentication_configuration = authentication_configuration + self.cors_configuration = cors_configuration + self.export_configuration = export_configuration + + +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, + *, + object_id: str, + **kwargs + ): + super(FhirServiceAccessPolicyEntry, self).__init__(**kwargs) + self.object_id = 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, + *, + login_servers: Optional[List[str]] = None, + **kwargs + ): + super(FhirServiceAcrConfiguration, self).__init__(**kwargs) + self.login_servers = login_servers + + +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, + *, + authority: Optional[str] = None, + audience: Optional[str] = None, + smart_proxy_enabled: Optional[bool] = None, + **kwargs + ): + super(FhirServiceAuthenticationConfiguration, self).__init__(**kwargs) + self.authority = authority + self.audience = audience + self.smart_proxy_enabled = smart_proxy_enabled + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["FhirService"]] = None, + **kwargs + ): + super(FhirServiceCollection, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +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, + *, + origins: Optional[List[str]] = None, + headers: Optional[List[str]] = None, + methods: Optional[List[str]] = None, + max_age: Optional[int] = None, + allow_credentials: Optional[bool] = None, + **kwargs + ): + super(FhirServiceCorsConfiguration, self).__init__(**kwargs) + self.origins = origins + self.headers = headers + self.methods = methods + self.max_age = max_age + self.allow_credentials = allow_credentials + + +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, + *, + storage_account_name: Optional[str] = None, + **kwargs + ): + super(FhirServiceExportConfiguration, self).__init__(**kwargs) + self.storage_account_name = storage_account_name + + +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, + *, + identity: Optional["ServiceManagedIdentityIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(FhirServicePatchResource, self).__init__(tags=tags, identity=identity, **kwargs) + self.identity = identity + self.tags = tags + + +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, + *, + identity: Optional["ServiceManagedIdentityIdentity"] = None, + etag: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + ingestion_endpoint_configuration: Optional["IotEventHubIngestionEndpointConfiguration"] = None, + device_mapping: Optional["IotMappingProperties"] = None, + **kwargs + ): + super(IotConnector, self).__init__(etag=etag, location=location, tags=tags, identity=identity, **kwargs) + self.identity = identity + self.system_data = None + self.provisioning_state = provisioning_state + self.ingestion_endpoint_configuration = ingestion_endpoint_configuration + self.device_mapping = device_mapping + self.id = None + self.name = None + self.type = None + self.etag = etag + self.location = location + self.tags = tags + self.system_data = None + self.provisioning_state = provisioning_state + self.ingestion_endpoint_configuration = ingestion_endpoint_configuration + self.device_mapping = device_mapping + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["IotConnector"]] = None, + **kwargs + ): + super(IotConnectorCollection, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +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, + *, + identity: Optional["ServiceManagedIdentityIdentity"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(IotConnectorPatchResource, self).__init__(tags=tags, identity=identity, **kwargs) + self.identity = identity + self.tags = tags + + +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, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + **kwargs + ): + super(IotDestinationProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + + +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, + *, + event_hub_name: Optional[str] = None, + consumer_group: Optional[str] = None, + fully_qualified_event_hub_namespace: Optional[str] = None, + **kwargs + ): + super(IotEventHubIngestionEndpointConfiguration, self).__init__(**kwargs) + self.event_hub_name = event_hub_name + self.consumer_group = consumer_group + self.fully_qualified_event_hub_namespace = fully_qualified_event_hub_namespace + + +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, + *, + resource_identity_resolution_type: Union[str, "IotIdentityResolutionType"], + fhir_service_resource_id: str, + fhir_mapping: "IotMappingProperties", + etag: Optional[str] = None, + location: Optional[str] = None, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + **kwargs + ): + super(IotFhirDestination, self).__init__(etag=etag, location=location, **kwargs) + self.system_data = None + self.provisioning_state = provisioning_state + self.resource_identity_resolution_type = resource_identity_resolution_type + self.fhir_service_resource_id = fhir_service_resource_id + self.fhir_mapping = 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 = { - 'error': {'key': 'error', 'type': 'ErrorDetailsInternal'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[IotFhirDestination]'}, } def __init__( self, *, - error: Optional["ErrorDetailsInternal"] = None, + next_link: Optional[str] = None, + value: Optional[List["IotFhirDestination"]] = None, **kwargs ): - super(ErrorDetails, self).__init__(**kwargs) - self.error = error + super(IotFhirDestinationCollection, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class ErrorDetailsInternal(msrest.serialization.Model): - """Error details. +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, + *, + resource_identity_resolution_type: Union[str, "IotIdentityResolutionType"], + fhir_service_resource_id: str, + fhir_mapping: "IotMappingProperties", + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + **kwargs + ): + 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 + self.fhir_mapping = 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, + *, + content: Optional[Any] = None, + **kwargs + ): + super(IotMappingProperties, self).__init__(**kwargs) + self.content = content + + +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 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 + :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 = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, + *, + next_link: Optional[str] = None, **kwargs ): - super(ErrorDetailsInternal, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None + super(ListOperations, self).__init__(**kwargs) + self.value = None + self.next_link = next_link -class Operation(msrest.serialization.Model): +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: Operation name: {provider}/{resource}/{read | write | action | delete}. + :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 - :param display: The information displayed about the operation. - :type display: ~azure.mgmt.healthcareapis.models.OperationDisplay + :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'}, - 'origin': {'key': 'origin', '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__( @@ -134,10 +1195,12 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): - super(Operation, self).__init__(**kwargs) + super(OperationDetail, self).__init__(**kwargs) self.name = None - self.origin = None + self.is_data_action = None self.display = display + self.origin = None + self.action_type = None class OperationDisplay(msrest.serialization.Model): @@ -180,38 +1243,6 @@ def __init__( self.description = None -class OperationListResult(msrest.serialization.Model): - """A list of service operations. It contains a list of operations and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param next_link: The link used to get the next page of service description objects. - :type next_link: str - :ivar value: A list of service operations supported by the Microsoft.HealthcareApis resource - provider. - :vartype value: list[~azure.mgmt.healthcareapis.models.Operation] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.next_link = next_link - self.value = None - - class OperationResultsDescription(msrest.serialization.Model): """The properties indicating the operation result of an operation on a service. @@ -227,7 +1258,7 @@ class OperationResultsDescription(msrest.serialization.Model): :ivar start_time: The time that the operation was started. :vartype start_time: str :param properties: Additional properties of the operation result. - :type properties: object + :type properties: any """ _validation = { @@ -248,7 +1279,7 @@ class OperationResultsDescription(msrest.serialization.Model): def __init__( self, *, - properties: Optional[object] = None, + properties: Optional[Any] = None, **kwargs ): super(OperationResultsDescription, self).__init__(**kwargs) @@ -398,7 +1429,7 @@ class PrivateEndpointConnectionDescription(PrivateEndpointConnection): Possible values include: "Succeeded", "Creating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.healthcareapis.models.PrivateEndpointConnectionProvisioningState - :ivar system_data: System metadata for this resource. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -521,7 +1552,7 @@ class PrivateLinkResourceDescription(PrivateLinkResource): :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: System metadata for this resource. + :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.healthcareapis.models.SystemData """ @@ -784,6 +1815,28 @@ def __init__( self.storage_account_name = storage_account_name +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, + *, + type: Optional[Union[str, "ManagedServiceIdentityType"]] = None, + **kwargs + ): + super(ServiceManagedIdentityIdentity, self).__init__(**kwargs) + self.type = type + + class ServicesResource(msrest.serialization.Model): """The common properties of a service. @@ -1019,7 +2072,7 @@ class ServicesProperties(msrest.serialization.Model): :ivar provisioning_state: The provisioning state. Possible values include: "Deleting", "Succeeded", "Creating", "Accepted", "Verifying", "Updating", "Failed", "Canceled", - "Deprovisioned". + "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] @@ -1169,3 +2222,128 @@ def __init__( self.last_modified_by = last_modified_by self.last_modified_by_type = last_modified_by_type self.last_modified_at = last_modified_at + + +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, + *, + etag: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["WorkspaceProperties"] = None, + **kwargs + ): + super(Workspace, self).__init__(etag=etag, location=location, tags=tags, **kwargs) + self.properties = properties + 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, + *, + next_link: Optional[str] = None, + value: Optional[List["Workspace"]] = None, + **kwargs + ): + super(WorkspaceList, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + 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", + "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, + *, + provisioning_state: Optional[Union[str, "ProvisioningState"]] = None, + **kwargs + ): + super(WorkspaceProperties, self).__init__(**kwargs) + self.provisioning_state = provisioning_state diff --git a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/__init__.py b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/__init__.py index a7371eb34ba7..8fc42e6f4ecb 100644 --- a/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/__init__.py +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/__init__.py @@ -7,15 +7,27 @@ # -------------------------------------------------------------------------- from ._services_operations import ServicesOperations -from ._operations import Operations -from ._operation_results_operations import OperationResultsOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._workspaces_operations import WorkspacesOperations +from ._dicom_services_operations import DicomServicesOperations +from ._iot_connectors_operations import IotConnectorsOperations +from ._fhir_destinations_operations import FhirDestinationsOperations +from ._iot_connector_fhir_destination_operations import IotConnectorFhirDestinationOperations +from ._fhir_services_operations import FhirServicesOperations +from ._operations import Operations +from ._operation_results_operations import OperationResultsOperations __all__ = [ 'ServicesOperations', - 'Operations', - 'OperationResultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'WorkspacesOperations', + 'DicomServicesOperations', + 'IotConnectorsOperations', + 'FhirDestinationsOperations', + 'IotConnectorFhirDestinationOperations', + 'FhirServicesOperations', + 'Operations', + 'OperationResultsOperations', ] 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 new file mode 100644 index 000000000000..e105deecd45b --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_dicom_services_operations.py @@ -0,0 +1,585 @@ +# 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 typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class DicomServicesOperations(object): + """DicomServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :type resource_group_name: str + :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.paging.ItemPaged[~azure.mgmt.healthcareapis.models.DicomServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomServiceCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DicomServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + dicom_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DicomService, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.DicomService + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DicomService', pipeline_response) + + if cls: + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('DicomService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DicomService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DicomService', pipeline_response) + + if cls: + 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 + + 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"] + """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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :param dicomservice: The parameters for creating or updating a Dicom Service resource. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + dicom_service_name=dicom_service_name, + dicomservice=dicomservice, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('DicomService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DicomService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + 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"] + """Patch DICOM Service details. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param dicomservice_patch_resource: The parameters for updating a Dicom Service. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.DicomService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DicomService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + dicomservice_patch_resource=dicomservice_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/dicomservices/{dicomServiceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + dicom_service_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a DICOM Service. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param dicom_service_name: The name of DICOM Service resource. + :type dicom_service_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + dicom_service_name=dicom_service_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 new file mode 100644 index 000000000000..881183343b67 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_destinations_operations.py @@ -0,0 +1,126 @@ +# 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 typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class FhirDestinationsOperations(object): + """FhirDestinationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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"] + """Lists all FHIR destinations for the given IoT Connector. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestinationCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotFhirDestinationCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_iot_connector.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}/fhirdestinations'} # type: ignore 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 new file mode 100644 index 000000000000..6a2a9287a30e --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_fhir_services_operations.py @@ -0,0 +1,585 @@ +# 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 typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class FhirServicesOperations(object): + """FhirServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :type resource_group_name: str + :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.paging.ItemPaged[~azure.mgmt.healthcareapis.models.FhirServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirServiceCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('FhirServiceCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + fhir_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FhirService, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.FhirService + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('FhirService', pipeline_response) + + if cls: + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('FhirService', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('FhirService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('FhirService', pipeline_response) + + if cls: + 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 + + 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"] + """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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :param fhirservice: The parameters for creating or updating a Fhir Service resource. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + fhir_service_name=fhir_service_name, + fhirservice=fhirservice, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('FhirService', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('FhirService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + 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"] + """Patch FHIR Service details. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param fhirservice_patch_resource: The parameters for updating a Fhir Service. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.FhirService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.FhirService"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + fhirservice_patch_resource=fhirservice_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/fhirservices/{fhirServiceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + fhir_service_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a FHIR Service. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param fhir_service_name: The name of FHIR Service resource. + :type fhir_service_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + fhir_service_name=fhir_service_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 new file mode 100644 index 000000000000..a31325669583 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connector_fhir_destination_operations.py @@ -0,0 +1,389 @@ +# 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 typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class IotConnectorFhirDestinationOperations(object): + """IotConnectorFhirDestinationOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param fhir_destination_name: The name of IoT Connector FHIR destination resource. + :type fhir_destination_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotFhirDestination, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.IotFhirDestination + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if cls: + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotFhirDestination', pipeline_response) + + if cls: + 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 + + 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"] + """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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param fhir_destination_name: The name of IoT Connector FHIR destination resource. + :type fhir_destination_name: str + :param iot_fhir_destination: The parameters for creating or updating an IoT Connector FHIR + destination resource. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotFhirDestination] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotFhirDestination"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + iot_fhir_destination=iot_fhir_destination, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 + 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 = 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) + + 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 + + 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] + """Deletes an IoT Connector FHIR destination. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param fhir_destination_name: The name of IoT Connector FHIR destination resource. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + fhir_destination_name=fhir_destination_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 new file mode 100644 index 000000000000..a2fec3d2b7e3 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_iot_connectors_operations.py @@ -0,0 +1,585 @@ +# 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 typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class IotConnectorsOperations(object): + """IotConnectorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :type resource_group_name: str + :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.paging.ItemPaged[~azure.mgmt.healthcareapis.models.IotConnectorCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnectorCollection"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('IotConnectorCollection', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + iot_connector_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :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: IotConnector, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.IotConnector + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotConnector', pipeline_response) + + if cls: + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if cls: + 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 + + 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"] + """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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param iot_connector: The parameters for creating or updating an IoT Connectors resource. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + iot_connector_name=iot_connector_name, + iot_connector=iot_connector, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotConnector', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + 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"] + """Patch an IoT Connector. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param iot_connector_patch_resource: The parameters for updating an IoT Connector. + :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. + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.IotConnector] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotConnector"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + iot_connector_patch_resource=iot_connector_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}/iotconnectors/{iotConnectorName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + iot_connector_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an IoT Connector. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param iot_connector_name: The name of IoT Connector resource. + :type iot_connector_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + iot_connector_name=iot_connector_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 4205cc55042b..05f3a0723176 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 @@ -17,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def get( operation_result_id, # type: str **kwargs # type: Any ): - # type: (...) -> Union["_models.OperationResultsDescription", "_models.ErrorDetails"] + # type: (...) -> "_models.OperationResultsDescription" """Get the operation result for a long running operation. :param location_name: The location of the operation. @@ -58,16 +58,16 @@ def get( :param operation_result_id: The ID of the operation result to get. :type operation_result_id: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: OperationResultsDescription or ErrorDetails, or the result of cls(response) - :rtype: ~azure.mgmt.healthcareapis.models.OperationResultsDescription or ~azure.mgmt.healthcareapis.models.ErrorDetails + :return: OperationResultsDescription, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.OperationResultsDescription :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.OperationResultsDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResultsDescription"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -91,16 +91,12 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 404]: + 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) - if response.status_code == 200: - deserialized = self._deserialize('OperationResultsDescription', pipeline_response) - - if response.status_code == 404: - deserialized = self._deserialize('ErrorDetails', pipeline_response) + deserialized = self._deserialize('OperationResultsDescription', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) 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 1f68eb1936db..8f1a61bfb031 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 @@ -49,20 +49,20 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["_models.OperationListResult"] - """Lists all of the available Healthcare service REST API operations. + # type: (...) -> 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 - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.OperationListResult] + :return: An iterator like instance of either ListOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.ListOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -85,7 +85,7 @@ def prepare_request(next_link=None): return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize('ListOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) 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 e294f4dc3b03..1735caa3fb7a 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 @@ -70,7 +70,7 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -150,7 +150,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -202,7 +202,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -267,8 +267,8 @@ 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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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) @@ -336,7 +336,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -390,8 +390,8 @@ 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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 None or the result of cls(response) 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 24c760337e9d..3904668b9a53 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 @@ -67,7 +67,7 @@ def list_by_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -130,7 +130,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL 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 ccf9f1793c7c..3a523501ffc0 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 @@ -70,7 +70,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -120,7 +120,7 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -184,8 +184,8 @@ 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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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) @@ -251,7 +251,7 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -311,8 +311,8 @@ 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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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) @@ -377,7 +377,7 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" # Construct URL @@ -426,8 +426,8 @@ 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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 None or the result of cls(response) @@ -493,7 +493,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -564,7 +564,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" accept = "application/json" def prepare_request(next_link=None): @@ -637,7 +637,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-11" + api_version = "2021-06-01-preview" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 new file mode 100644 index 000000000000..b49c90ed7091 --- /dev/null +++ b/sdk/healthcareapis/azure-mgmt-healthcareapis/azure/mgmt/healthcareapis/operations/_workspaces_operations.py @@ -0,0 +1,624 @@ +# 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 typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class WorkspacesOperations(object): + """WorkspacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.healthcareapis.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> 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 + :return: An iterator like instance of either WorkspaceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.healthcareapis.models.WorkspaceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :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.paging.ItemPaged[~azure.mgmt.healthcareapis.models.WorkspaceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + 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 + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Workspace" + """Gets the properties of the specified workspace. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :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: Workspace, or the result of cls(response) + :rtype: ~azure.mgmt.healthcareapis.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + 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"] + """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. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param workspace: The parameters for creating or updating a healthcare workspace. + :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. + :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 Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace=workspace, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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" + 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') + + # 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') + + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + 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"] + """Patch workspace details. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :param workspace_name: The name of workspace resource. + :type workspace_name: str + :param workspace_patch_resource: The parameters for updating a specified workspace. + :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. + :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 Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.healthcareapis.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_patch_resource=workspace_patch_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 + 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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HealthcareApis/workspaces/{workspaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a specified workspace. + + :param resource_group_name: The name of the resource group that contains the service instance. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + 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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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