From 3e3a397c0a17b900b2759a4bfc1203b2ceb25d5e Mon Sep 17 00:00:00 2001 From: Rakshith Bhyravabhotla Date: Wed, 25 Aug 2021 16:13:23 -0700 Subject: [PATCH 01/10] Get rid of LogsBatchQueryResult (#20418) * Get rid of LogsBatchQueryResult * Update sdk/monitor/azure-monitor-query/README.md * oops * comments --- sdk/monitor/azure-monitor-query/CHANGELOG.md | 4 +- sdk/monitor/azure-monitor-query/README.md | 6 +- .../azure/monitor/query/__init__.py | 2 - .../azure/monitor/query/_helpers.py | 5 +- .../azure/monitor/query/_logs_query_client.py | 15 ++--- .../azure/monitor/query/_models.py | 66 ++++--------------- .../query/aio/_logs_query_client_async.py | 15 ++--- .../samples/sample_batch_query.py | 2 +- .../tests/async/test_logs_client_async.py | 12 +++- .../tests/test_logs_client.py | 13 +++- .../tests/test_logs_response.py | 2 - 11 files changed, 51 insertions(+), 91 deletions(-) diff --git a/sdk/monitor/azure-monitor-query/CHANGELOG.md b/sdk/monitor/azure-monitor-query/CHANGELOG.md index 5805d4278e0b..cae3e02459f1 100644 --- a/sdk/monitor/azure-monitor-query/CHANGELOG.md +++ b/sdk/monitor/azure-monitor-query/CHANGELOG.md @@ -15,7 +15,7 @@ - Rename `batch_query` to `query_batch`. - Rename `LogsBatchQueryRequest` to `LogsBatchQuery`. - `include_render` is now renamed to `include_visualization` in the query API. -- `LogsQueryResult` and `LogsBatchQueryResult` now return `visualization` instead of `render`. +- `LogsQueryResult` now returns `visualization` instead of `render`. - `start_time`, `duration` and `end_time` are now replaced with a single param called `timespan` - `resourceregion` is renamed to `resource_region` in the MetricResult type. - `top` is renamed to `max_results` in the metric's `query` API. @@ -30,11 +30,11 @@ - `AggregationType` is renamed to `MetricAggregationType`. - Removed `LogsBatchResultError` type. - `LogsQueryResultTable` is named to `LogsTable` -- `LogsQueryResultColumn` is renamed to `LogsTableColumn` - `LogsTableColumn` is now removed. Column labels are strings instead. - `start_time` in `list_metric_namespaces` API is now a datetime. - The order of params in `LogsBatchQuery` is changed. Also, `headers` is no longer accepted. - `timespan` is now a required keyword-only argument in logs APIs. +- batch api now returns a list of `LogsQueryResult` objects. ### Bugs Fixed diff --git a/sdk/monitor/azure-monitor-query/README.md b/sdk/monitor/azure-monitor-query/README.md index 8d3d209f4c24..16ed4a04e214 100644 --- a/sdk/monitor/azure-monitor-query/README.md +++ b/sdk/monitor/azure-monitor-query/README.md @@ -215,14 +215,12 @@ for rsp in response: #### Handling the response for Logs Query -The `query` API returns the `LogsQueryResult` while the `batch_query` API returns the `LogsBatchQueryResult`. +The `query` API returns the `LogsQueryResult` while the `batch_query` API returns list of `LogsQueryResult`. Here is a heirarchy of the response: ``` -LogsQueryResult / LogsBatchQueryResult -|---id (this exists in `LogsBatchQueryResult` object only) -|---status (this exists in `LogsBatchQueryResult` object only) +LogsQueryResult |---statistics |---visualization |---error diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py index d201fbff31bb..9043ee10d44c 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/__init__.py @@ -9,7 +9,6 @@ from ._models import ( MetricAggregationType, - LogsBatchQueryResult, LogsQueryResult, LogsTable, MetricsResult, @@ -30,7 +29,6 @@ __all__ = [ "MetricAggregationType", "LogsQueryClient", - "LogsBatchQueryResult", "LogsQueryResult", "LogsTable", "LogsBatchQuery", diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py index cda750cd845e..8b3194f3dc14 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_helpers.py @@ -45,10 +45,9 @@ def process_error(exception): raise_error = HttpResponseError raise raise_error(message=exception.message, response=exception.response) -def order_results(request_order, responses): - mapping = {item.id: item for item in responses} +def order_results(request_order, mapping, obj): ordered = [mapping[id] for id in request_order] - return ordered + return [obj._from_generated(rsp) for rsp in ordered] # pylint: disable=protected-access def construct_iso8601(timespan=None): if not timespan: diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py index eaac63c874bc..d2d04abb7d77 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_logs_query_client.py @@ -13,7 +13,7 @@ from ._generated.models import BatchRequest, QueryBody as LogsQueryBody from ._helpers import get_authentication_policy, process_error, construct_iso8601, order_results -from ._models import LogsQueryResult, LogsBatchQuery, LogsBatchQueryResult +from ._models import LogsBatchQuery, LogsQueryResult if TYPE_CHECKING: from azure.core.credentials import TokenCredential @@ -128,7 +128,7 @@ def query(self, workspace_id, query, **kwargs): @distributed_trace def query_batch(self, queries, **kwargs): - # type: (Union[Sequence[Dict], Sequence[LogsBatchQuery]], Any) -> List[LogsBatchQueryResult] + # type: (Union[Sequence[Dict], Sequence[LogsBatchQuery]], Any) -> List[LogsQueryResult] """Execute a list of analytics queries. Each request can be either a LogQueryRequest object or an equivalent serialized model. @@ -136,8 +136,8 @@ def query_batch(self, queries, **kwargs): :param queries: The list of queries that should be processed :type queries: list[dict] or list[~azure.monitor.query.LogsBatchQuery] - :return: List of LogsBatchQueryResult, or the result of cls(response) - :rtype: list[~azure.monitor.query.LogsBatchQueryResult] + :return: List of LogsQueryResult, or the result of cls(response) + :rtype: list[~azure.monitor.query.LogsQueryResult] :raises: ~azure.core.exceptions.HttpResponseError .. admonition:: Example: @@ -160,11 +160,8 @@ def query_batch(self, queries, **kwargs): request_order = [req['id'] for req in queries] batch = BatchRequest(requests=queries) generated = self._query_op.batch(batch, **kwargs) - return order_results( - request_order, - [ - LogsBatchQueryResult._from_generated(rsp) for rsp in generated.responses # pylint: disable=protected-access - ]) + mapping = {item.id: item for item in generated.responses} + return order_results(request_order, mapping, LogsQueryResult) def close(self): # type: () -> None diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py index 18cfa1245435..84e0a05f4cd1 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/_models.py @@ -12,6 +12,7 @@ from ._helpers import construct_iso8601, process_row from ._generated.models import ( BatchQueryRequest as InternalLogQueryRequest, + BatchQueryResponse ) @@ -47,46 +48,6 @@ def _from_generated(cls, generated): ) -class LogsQueryResult(object): - """Contains the tables, columns & rows resulting from a query. - - :ivar tables: The list of tables, columns and rows. - :vartype tables: list[~azure.monitor.query.LogsTable] - :ivar statistics: This will include a statistics property in the response that describes various - performance statistics such as query execution time and resource usage. - :vartype statistics: object - :ivar visualization: This will include a visualization property in the response that specifies the type of - visualization selected by the query and any properties for that visualization. - :vartype visualization: object - :ivar error: Any error info. - :vartype error: ~azure.core.exceptions.HttpResponseError - """ - def __init__(self, **kwargs): - # type: (Any) -> None - self.tables = kwargs.get("tables", None) - self.statistics = kwargs.get("statistics", None) - self.visualization = kwargs.get("visualization", None) - self.error = kwargs.get("error", None) - - @classmethod - def _from_generated(cls, generated): - if not generated: - return cls() - tables = None - if generated.tables is not None: - tables = [ - LogsTable._from_generated( # pylint: disable=protected-access - table - ) for table in generated.tables - ] - return cls( - tables=tables, - statistics=generated.statistics, - visualization=generated.render, - error=generated.error - ) - - class MetricsResult(object): """The response to a metrics query. @@ -193,13 +154,9 @@ def _to_generated(self): workspace=self.workspace ) -class LogsBatchQueryResult(object): - """The LogsBatchQueryResult. +class LogsQueryResult(object): + """The LogsQueryResult. - :ivar id: the request id of the request that was sent. - :vartype id: str - :ivar status: status code of the response. - :vartype status: int :ivar tables: The list of tables, columns and rows. :vartype tables: list[~azure.monitor.query.LogsTable] :ivar statistics: This will include a statistics property in the response that describes various @@ -215,8 +172,6 @@ def __init__( self, **kwargs ): - self.id = kwargs.get('id', None) - self.status = kwargs.get('status', None) self.tables = kwargs.get('tables', None) self.error = kwargs.get('error', None) self.statistics = kwargs.get('statistics', None) @@ -224,22 +179,23 @@ def __init__( @classmethod def _from_generated(cls, generated): + if not generated: return cls() tables = None - if generated.body.tables is not None: + if isinstance(generated, BatchQueryResponse): + generated = generated.body + if generated.tables is not None: tables = [ LogsTable._from_generated( # pylint: disable=protected-access table - ) for table in generated.body.tables + ) for table in generated.tables ] return cls( - id=generated.id, - status=generated.status, tables=tables, - statistics=generated.body.statistics, - visualization=generated.body.render, - error=generated.body.error + statistics=generated.statistics, + visualization=generated.render, + error=generated.error ) diff --git a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py index 5039f62402f6..19994423c947 100644 --- a/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py +++ b/sdk/monitor/azure-monitor-query/azure/monitor/query/aio/_logs_query_client_async.py @@ -14,7 +14,7 @@ from .._generated.models import BatchRequest, QueryBody as LogsQueryBody from .._helpers import process_error, construct_iso8601, order_results -from .._models import LogsQueryResult, LogsBatchQuery, LogsBatchQueryResult +from .._models import LogsQueryResult, LogsBatchQuery from ._helpers_asyc import get_authentication_policy if TYPE_CHECKING: @@ -115,7 +115,7 @@ async def query_batch( self, queries: Union[Sequence[Dict], Sequence[LogsBatchQuery]], **kwargs: Any - ) -> List[LogsBatchQueryResult]: + ) -> List[LogsQueryResult]: """Execute a list of analytics queries. Each request can be either a LogQueryRequest object or an equivalent serialized model. @@ -123,8 +123,8 @@ async def query_batch( :param queries: The list of queries that should be processed :type queries: list[dict] or list[~azure.monitor.query.LogsBatchQuery] - :return: list of LogsBatchQueryResult objects, or the result of cls(response) - :rtype: list[~azure.monitor.query.LogsBatchQueryResult] + :return: list of LogsQueryResult objects, or the result of cls(response) + :rtype: list[~azure.monitor.query.LogsQueryResult] :raises: ~azure.core.exceptions.HttpResponseError """ try: @@ -138,11 +138,8 @@ async def query_batch( request_order = [req['id'] for req in queries] batch = BatchRequest(requests=queries) generated = await self._query_op.batch(batch, **kwargs) - return order_results( - request_order, - [ - LogsBatchQueryResult._from_generated(rsp) for rsp in generated.responses # pylint: disable=protected-access - ]) + mapping = {item.id: item for item in generated.responses} + return order_results(request_order, mapping, LogsQueryResult) async def __aenter__(self) -> "LogsQueryClient": await self._client.__aenter__() diff --git a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py index 3705d94cf494..c0838643dce4 100644 --- a/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py +++ b/sdk/monitor/azure-monitor-query/samples/sample_batch_query.py @@ -37,7 +37,7 @@ for response in responses: try: table = response.tables[0] - df = pd.DataFrame(table.rows, columns=[col.name for col in table.columns]) + df = pd.DataFrame(table.rows, columns=table.columns) print(df) print("\n\n-------------------------\n\n") except TypeError: diff --git a/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py b/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py index fb49883cff6d..bf7ade3b9ad2 100644 --- a/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py +++ b/sdk/monitor/azure-monitor-query/tests/async/test_logs_client_async.py @@ -69,7 +69,7 @@ async def test_logs_query_batch_raises_on_no_timespan(): @pytest.mark.live_test_only @pytest.mark.asyncio -async def test_logs_query_batch(): +async def test_logs_query_batch_default(): client = LogsQueryClient(_credential()) requests = [ @@ -85,7 +85,7 @@ async def test_logs_query_batch(): workspace_id= os.environ['LOG_WORKSPACE_ID'] ), LogsBatchQuery( - query= "AppRequests | take 2", + query= "Wrong query | take 2", workspace_id= os.environ['LOG_WORKSPACE_ID'], timespan=None ), @@ -93,6 +93,14 @@ async def test_logs_query_batch(): response = await client.query_batch(requests) assert len(response) == 3 + r0 = response[0] + assert r0.tables[0].columns == ['count_'] + r1 = response[1] + assert r1.tables[0].columns[0] == 'TimeGenerated' + assert r1.tables[0].columns[1] == '_ResourceId' + assert r1.tables[0].columns[2] == 'avgRequestDuration' + r2 = response[2] + assert r2.error is not None @pytest.mark.skip('https://github.com/Azure/azure-sdk-for-python/issues/19382') @pytest.mark.live_test_only diff --git a/sdk/monitor/azure-monitor-query/tests/test_logs_client.py b/sdk/monitor/azure-monitor-query/tests/test_logs_client.py index dba61f5471d1..248f44796cbe 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_logs_client.py +++ b/sdk/monitor/azure-monitor-query/tests/test_logs_client.py @@ -76,7 +76,7 @@ def test_logs_server_timeout(): assert 'Gateway timeout' in e.value.message @pytest.mark.live_test_only -def test_logs_query_batch(): +def test_logs_query_batch_default(): client = LogsQueryClient(_credential()) requests = [ @@ -92,7 +92,7 @@ def test_logs_query_batch(): workspace_id= os.environ['LOG_WORKSPACE_ID'] ), LogsBatchQuery( - query= "AppRequests | take 2", + query= "Wrong query | take 2", workspace_id= os.environ['LOG_WORKSPACE_ID'], timespan=None ), @@ -100,6 +100,15 @@ def test_logs_query_batch(): response = client.query_batch(requests) assert len(response) == 3 + + r0 = response[0] + assert r0.tables[0].columns == ['count_'] + r1 = response[1] + assert r1.tables[0].columns[0] == 'TimeGenerated' + assert r1.tables[0].columns[1] == '_ResourceId' + assert r1.tables[0].columns[2] == 'avgRequestDuration' + r2 = response[2] + assert r2.error is not None @pytest.mark.live_test_only def test_logs_single_query_with_statistics(): diff --git a/sdk/monitor/azure-monitor-query/tests/test_logs_response.py b/sdk/monitor/azure-monitor-query/tests/test_logs_response.py index 3c69e01caa69..f3632faef97f 100644 --- a/sdk/monitor/azure-monitor-query/tests/test_logs_response.py +++ b/sdk/monitor/azure-monitor-query/tests/test_logs_response.py @@ -27,5 +27,3 @@ def test_query_response_types(): assert isinstance(result.tables[0].rows[0][1], six.string_types) # _ResourceId generated is a string assert isinstance(result.tables[0].rows[0][2], bool) # Success generated is a bool assert isinstance(result.tables[0].rows[0][3], int) # ItemCount generated is a int - assert isinstance(result.tables[0].rows[0][4], float) # DurationMs generated is a real - From d4f57039ff96a3fa72274f03694c30096a8eae10 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Thu, 26 Aug 2021 15:59:03 +0800 Subject: [PATCH 02/10] [AutoRelease] t2-iothub-2021-08-25-25696 (#20409) * CodeGen from PR 15722 in Azure/azure-rest-api-specs Removing readonly for isVerified property as it is no more readonly property (#15722) * version,CHANGELOG * test Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines --- sdk/iothub/azure-mgmt-iothub/CHANGELOG.md | 11 + sdk/iothub/azure-mgmt-iothub/_meta.json | 11 +- .../azure/mgmt/iothub/_iot_hub_client.py | 27 +- .../azure/mgmt/iothub/_version.py | 2 +- .../azure/mgmt/iothub/aio/_iot_hub_client.py | 27 +- .../azure/mgmt/iothub/models.py | 2 +- .../azure/mgmt/iothub/v2016_02_03/_version.py | 2 +- .../_iot_hub_resource_operations.py | 50 +- .../_iot_hub_resource_operations.py | 8 +- .../azure/mgmt/iothub/v2017_01_19/_version.py | 2 +- .../_iot_hub_resource_operations.py | 50 +- .../_iot_hub_resource_operations.py | 8 +- .../azure/mgmt/iothub/v2017_07_01/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../_iot_hub_resource_operations.py | 50 +- .../v2017_07_01/aio/operations/_operations.py | 2 +- .../_iot_hub_resource_operations.py | 8 +- .../azure/mgmt/iothub/v2018_01_22/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../_iot_hub_resource_operations.py | 58 +- .../v2018_01_22/aio/operations/_operations.py | 2 +- .../_iot_hub_resource_operations.py | 12 +- .../azure/mgmt/iothub/v2018_04_01/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../_iot_hub_resource_operations.py | 64 +- .../v2018_04_01/aio/operations/_operations.py | 2 +- .../_resource_provider_common_operations.py | 2 +- .../mgmt/iothub/v2018_04_01/models/_models.py | 12 +- .../iothub/v2018_04_01/models/_models_py3.py | 20 +- .../_iot_hub_resource_operations.py | 12 +- .../azure/mgmt/iothub/v2019_03_22/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../aio/operations/_iot_hub_operations.py | 8 +- .../_iot_hub_resource_operations.py | 64 +- .../v2019_03_22/aio/operations/_operations.py | 2 +- .../_resource_provider_common_operations.py | 2 +- .../mgmt/iothub/v2019_03_22/models/_models.py | 12 +- .../iothub/v2019_03_22/models/_models_py3.py | 20 +- .../operations/_iot_hub_operations.py | 4 +- .../_iot_hub_resource_operations.py | 12 +- .../iothub/v2019_07_01_preview/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../aio/operations/_iot_hub_operations.py | 8 +- .../_iot_hub_resource_operations.py | 64 +- .../aio/operations/_operations.py | 2 +- .../_resource_provider_common_operations.py | 2 +- .../v2019_07_01_preview/models/_models.py | 12 +- .../v2019_07_01_preview/models/_models_py3.py | 20 +- .../operations/_iot_hub_operations.py | 4 +- .../_iot_hub_resource_operations.py | 12 +- .../azure/mgmt/iothub/v2019_11_04/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../aio/operations/_iot_hub_operations.py | 8 +- .../_iot_hub_resource_operations.py | 64 +- .../v2019_11_04/aio/operations/_operations.py | 2 +- .../_resource_provider_common_operations.py | 2 +- .../mgmt/iothub/v2019_11_04/models/_models.py | 12 +- .../iothub/v2019_11_04/models/_models_py3.py | 20 +- .../operations/_iot_hub_operations.py | 4 +- .../_iot_hub_resource_operations.py | 12 +- .../azure/mgmt/iothub/v2020_03_01/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../aio/operations/_iot_hub_operations.py | 8 +- .../_iot_hub_resource_operations.py | 64 +- .../v2020_03_01/aio/operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 20 +- .../_private_link_resources_operations.py | 4 +- .../_resource_provider_common_operations.py | 2 +- .../mgmt/iothub/v2020_03_01/models/_models.py | 12 +- .../iothub/v2020_03_01/models/_models_py3.py | 20 +- .../operations/_iot_hub_operations.py | 4 +- .../_iot_hub_resource_operations.py | 12 +- ...private_endpoint_connections_operations.py | 8 +- .../iothub/v2021_03_03_preview/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../aio/operations/_iot_hub_operations.py | 8 +- .../_iot_hub_resource_operations.py | 64 +- .../aio/operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 20 +- .../_private_link_resources_operations.py | 4 +- .../_resource_provider_common_operations.py | 2 +- .../v2021_03_03_preview/models/_models.py | 12 +- .../v2021_03_03_preview/models/_models_py3.py | 20 +- .../operations/_iot_hub_operations.py | 4 +- .../_iot_hub_resource_operations.py | 12 +- ...private_endpoint_connections_operations.py | 8 +- .../azure/mgmt/iothub/v2021_03_31/_version.py | 2 +- .../operations/_certificates_operations.py | 12 +- .../aio/operations/_iot_hub_operations.py | 8 +- .../_iot_hub_resource_operations.py | 64 +- .../v2021_03_31/aio/operations/_operations.py | 2 +- ...private_endpoint_connections_operations.py | 20 +- .../_private_link_resources_operations.py | 4 +- .../_resource_provider_common_operations.py | 2 +- .../mgmt/iothub/v2021_03_31/models/_models.py | 14 +- .../iothub/v2021_03_31/models/_models_py3.py | 24 +- .../operations/_iot_hub_operations.py | 4 +- .../_iot_hub_resource_operations.py | 12 +- ...private_endpoint_connections_operations.py | 8 +- .../azure/mgmt/iothub/v2021_07_01/__init__.py | 19 + .../mgmt/iothub/v2021_07_01/_configuration.py | 71 + .../iothub/v2021_07_01/_iot_hub_client.py | 119 + .../mgmt/iothub/v2021_07_01/_metadata.json | 109 + .../azure/mgmt/iothub/v2021_07_01/_version.py | 9 + .../mgmt/iothub/v2021_07_01/aio/__init__.py | 10 + .../iothub/v2021_07_01/aio/_configuration.py | 67 + .../iothub/v2021_07_01/aio/_iot_hub_client.py | 112 + .../v2021_07_01/aio/operations/__init__.py | 25 + .../operations/_certificates_operations.py | 464 +++ .../aio/operations/_iot_hub_operations.py | 167 + .../_iot_hub_resource_operations.py | 1857 +++++++++ .../v2021_07_01/aio/operations/_operations.py | 105 + ...private_endpoint_connections_operations.py | 436 +++ .../_private_link_resources_operations.py | 167 + .../_resource_provider_common_operations.py | 94 + .../iothub/v2021_07_01/models/__init__.py | 301 ++ .../models/_iot_hub_client_enums.py | 231 ++ .../mgmt/iothub/v2021_07_01/models/_models.py | 3026 +++++++++++++++ .../iothub/v2021_07_01/models/_models_py3.py | 3317 +++++++++++++++++ .../iothub/v2021_07_01/operations/__init__.py | 25 + .../operations/_certificates_operations.py | 474 +++ .../operations/_iot_hub_operations.py | 173 + .../_iot_hub_resource_operations.py | 1887 ++++++++++ .../v2021_07_01/operations/_operations.py | 110 + ...private_endpoint_connections_operations.py | 446 +++ .../_private_link_resources_operations.py | 173 + .../_resource_provider_common_operations.py | 99 + .../azure/mgmt/iothub/v2021_07_01/py.typed | 1 + .../test_mgmt_iothub.test_iothub.yaml | 163 +- ...gmt_iothub.test_iothub_consumer_group.yaml | 51 - 130 files changed, 14915 insertions(+), 809 deletions(-) create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py create mode 100644 sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed delete mode 100644 sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml diff --git a/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md b/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md index d5d6f7aaab0c..6761cee75e91 100644 --- a/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md +++ b/sdk/iothub/azure-mgmt-iothub/CHANGELOG.md @@ -1,5 +1,16 @@ # Release History +## 2.1.0 (2021-08-25) + +**Features** + + - Model IotHubProperties has a new parameter disable_local_auth + - Model IotHubProperties has a new parameter disable_device_sas + - Model IotHubProperties has a new parameter restrict_outbound_network_access + - Model IotHubProperties has a new parameter allowed_fqdn_list + - Model IotHubProperties has a new parameter disable_module_sas + - Model CertificateBodyDescription has a new parameter is_verified + ## 2.0.0 (2021-05-14) **Features** diff --git a/sdk/iothub/azure-mgmt-iothub/_meta.json b/sdk/iothub/azure-mgmt-iothub/_meta.json index 2426a3f90ba0..1e15d4ff063d 100644 --- a/sdk/iothub/azure-mgmt-iothub/_meta.json +++ b/sdk/iothub/azure-mgmt-iothub/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.3.0", - "use": "@autorest/python@5.6.6", - "commit": "495e6fd12856cf3d909125b1119c83a3a9f18a8a", + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "1f327d204d0c1835d7ee675d93b423028341a6b7", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/iothub/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.6 --version=3.3.0", + "autorest_command": "autorest specification/iothub/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/iothub/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py index 5b416c4da857..7bc8275a0cc3 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_iot_hub_client.py @@ -56,7 +56,7 @@ class IotHubClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-03-31' + DEFAULT_API_VERSION = '2021-07-01' _PROFILE_TAG = "azure.mgmt.iothub.IotHubClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -102,6 +102,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-03-01: :mod:`v2020_03_01.models` * 2021-03-03-preview: :mod:`v2021_03_03_preview.models` * 2021-03-31: :mod:`v2021_03_31.models` + * 2021-07-01: :mod:`v2021_07_01.models` """ if api_version == '2016-02-03': from .v2016_02_03 import models @@ -136,6 +137,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-03-31': from .v2021_03_31 import models return models + elif api_version == '2021-07-01': + from .v2021_07_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -151,6 +155,7 @@ def certificates(self): * 2020-03-01: :class:`CertificatesOperations` * 2021-03-03-preview: :class:`CertificatesOperations` * 2021-03-31: :class:`CertificatesOperations` + * 2021-07-01: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2017-07-01': @@ -171,6 +176,8 @@ def certificates(self): from .v2021_03_03_preview.operations import CertificatesOperations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import CertificatesOperations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -185,6 +192,7 @@ def iot_hub(self): * 2020-03-01: :class:`IotHubOperations` * 2021-03-03-preview: :class:`IotHubOperations` * 2021-03-31: :class:`IotHubOperations` + * 2021-07-01: :class:`IotHubOperations` """ api_version = self._get_api_version('iot_hub') if api_version == '2019-03-22': @@ -199,6 +207,8 @@ def iot_hub(self): from .v2021_03_03_preview.operations import IotHubOperations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import IotHubOperations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import IotHubOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -218,6 +228,7 @@ def iot_hub_resource(self): * 2020-03-01: :class:`IotHubResourceOperations` * 2021-03-03-preview: :class:`IotHubResourceOperations` * 2021-03-31: :class:`IotHubResourceOperations` + * 2021-07-01: :class:`IotHubResourceOperations` """ api_version = self._get_api_version('iot_hub_resource') if api_version == '2016-02-03': @@ -242,6 +253,8 @@ def iot_hub_resource(self): from .v2021_03_03_preview.operations import IotHubResourceOperations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import IotHubResourceOperations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import IotHubResourceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub_resource'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -259,6 +272,7 @@ def operations(self): * 2020-03-01: :class:`Operations` * 2021-03-03-preview: :class:`Operations` * 2021-03-31: :class:`Operations` + * 2021-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-07-01': @@ -279,6 +293,8 @@ def operations(self): from .v2021_03_03_preview.operations import Operations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import Operations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -290,6 +306,7 @@ def private_endpoint_connections(self): * 2020-03-01: :class:`PrivateEndpointConnectionsOperations` * 2021-03-03-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-03-31: :class:`PrivateEndpointConnectionsOperations` + * 2021-07-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-03-01': @@ -298,6 +315,8 @@ def private_endpoint_connections(self): from .v2021_03_03_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -309,6 +328,7 @@ def private_link_resources(self): * 2020-03-01: :class:`PrivateLinkResourcesOperations` * 2021-03-03-preview: :class:`PrivateLinkResourcesOperations` * 2021-03-31: :class:`PrivateLinkResourcesOperations` + * 2021-07-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-03-01': @@ -317,6 +337,8 @@ def private_link_resources(self): from .v2021_03_03_preview.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -332,6 +354,7 @@ def resource_provider_common(self): * 2020-03-01: :class:`ResourceProviderCommonOperations` * 2021-03-03-preview: :class:`ResourceProviderCommonOperations` * 2021-03-31: :class:`ResourceProviderCommonOperations` + * 2021-07-01: :class:`ResourceProviderCommonOperations` """ api_version = self._get_api_version('resource_provider_common') if api_version == '2018-04-01': @@ -348,6 +371,8 @@ def resource_provider_common(self): from .v2021_03_03_preview.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2021-03-31': from .v2021_03_31.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2021-07-01': + from .v2021_07_01.operations import ResourceProviderCommonOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_provider_common'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py index 08328758a18d..92ad0119e2e9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/aio/_iot_hub_client.py @@ -54,7 +54,7 @@ class IotHubClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-03-31' + DEFAULT_API_VERSION = '2021-07-01' _PROFILE_TAG = "azure.mgmt.iothub.IotHubClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -100,6 +100,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2020-03-01: :mod:`v2020_03_01.models` * 2021-03-03-preview: :mod:`v2021_03_03_preview.models` * 2021-03-31: :mod:`v2021_03_31.models` + * 2021-07-01: :mod:`v2021_07_01.models` """ if api_version == '2016-02-03': from ..v2016_02_03 import models @@ -134,6 +135,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-03-31': from ..v2021_03_31 import models return models + elif api_version == '2021-07-01': + from ..v2021_07_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -149,6 +153,7 @@ def certificates(self): * 2020-03-01: :class:`CertificatesOperations` * 2021-03-03-preview: :class:`CertificatesOperations` * 2021-03-31: :class:`CertificatesOperations` + * 2021-07-01: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') if api_version == '2017-07-01': @@ -169,6 +174,8 @@ def certificates(self): from ..v2021_03_03_preview.aio.operations import CertificatesOperations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -183,6 +190,7 @@ def iot_hub(self): * 2020-03-01: :class:`IotHubOperations` * 2021-03-03-preview: :class:`IotHubOperations` * 2021-03-31: :class:`IotHubOperations` + * 2021-07-01: :class:`IotHubOperations` """ api_version = self._get_api_version('iot_hub') if api_version == '2019-03-22': @@ -197,6 +205,8 @@ def iot_hub(self): from ..v2021_03_03_preview.aio.operations import IotHubOperations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import IotHubOperations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import IotHubOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -216,6 +226,7 @@ def iot_hub_resource(self): * 2020-03-01: :class:`IotHubResourceOperations` * 2021-03-03-preview: :class:`IotHubResourceOperations` * 2021-03-31: :class:`IotHubResourceOperations` + * 2021-07-01: :class:`IotHubResourceOperations` """ api_version = self._get_api_version('iot_hub_resource') if api_version == '2016-02-03': @@ -240,6 +251,8 @@ def iot_hub_resource(self): from ..v2021_03_03_preview.aio.operations import IotHubResourceOperations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import IotHubResourceOperations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import IotHubResourceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'iot_hub_resource'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -257,6 +270,7 @@ def operations(self): * 2020-03-01: :class:`Operations` * 2021-03-03-preview: :class:`Operations` * 2021-03-31: :class:`Operations` + * 2021-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-07-01': @@ -277,6 +291,8 @@ def operations(self): from ..v2021_03_03_preview.aio.operations import Operations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import Operations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -288,6 +304,7 @@ def private_endpoint_connections(self): * 2020-03-01: :class:`PrivateEndpointConnectionsOperations` * 2021-03-03-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-03-31: :class:`PrivateEndpointConnectionsOperations` + * 2021-07-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2020-03-01': @@ -296,6 +313,8 @@ def private_endpoint_connections(self): from ..v2021_03_03_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -307,6 +326,7 @@ def private_link_resources(self): * 2020-03-01: :class:`PrivateLinkResourcesOperations` * 2021-03-03-preview: :class:`PrivateLinkResourcesOperations` * 2021-03-31: :class:`PrivateLinkResourcesOperations` + * 2021-07-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2020-03-01': @@ -315,6 +335,8 @@ def private_link_resources(self): from ..v2021_03_03_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -330,6 +352,7 @@ def resource_provider_common(self): * 2020-03-01: :class:`ResourceProviderCommonOperations` * 2021-03-03-preview: :class:`ResourceProviderCommonOperations` * 2021-03-31: :class:`ResourceProviderCommonOperations` + * 2021-07-01: :class:`ResourceProviderCommonOperations` """ api_version = self._get_api_version('resource_provider_common') if api_version == '2018-04-01': @@ -346,6 +369,8 @@ def resource_provider_common(self): from ..v2021_03_03_preview.aio.operations import ResourceProviderCommonOperations as OperationClass elif api_version == '2021-03-31': from ..v2021_03_31.aio.operations import ResourceProviderCommonOperations as OperationClass + elif api_version == '2021-07-01': + from ..v2021_07_01.aio.operations import ResourceProviderCommonOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_provider_common'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py index 741ec6871f50..059efe06ada8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2021_03_31.models import * +from .v2021_07_01.models import * diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py index 384ab94f1da4..7e51870c2283 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -109,7 +109,7 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -167,7 +167,7 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -185,8 +185,8 @@ async def begin_create_or_update( :type iot_hub_description: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :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 IotHubDescription or the result of cls(response) @@ -243,7 +243,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -299,7 +299,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -311,8 +311,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 IotHubDescription or the result of cls(response) @@ -366,7 +366,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -436,7 +436,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -510,7 +510,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -571,7 +571,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -649,7 +649,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -732,7 +732,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -801,7 +801,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -870,7 +870,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -934,7 +934,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1013,7 +1013,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1078,7 +1078,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1154,7 +1154,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1217,7 +1217,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1296,7 +1296,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1362,7 +1362,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1433,7 +1433,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py index d9fd44c0541b..3d1bb9d52598 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2016_02_03/operations/_iot_hub_resource_operations.py @@ -192,8 +192,8 @@ def begin_create_or_update( :type iot_hub_description: ~azure.mgmt.iothub.v2016_02_03.models.IotHubDescription :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 IotHubDescription or the result of cls(response) @@ -320,8 +320,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py index 0995929a66c0..2a33be26b012 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -109,7 +109,7 @@ async def _create_or_update_initial( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -167,7 +167,7 @@ async def begin_create_or_update( resource_group_name: str, resource_name: str, iot_hub_description: "_models.IotHubDescription", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -185,8 +185,8 @@ async def begin_create_or_update( :type iot_hub_description: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :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 IotHubDescription or the result of cls(response) @@ -243,7 +243,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -299,7 +299,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -311,8 +311,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 IotHubDescription or the result of cls(response) @@ -366,7 +366,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -436,7 +436,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -510,7 +510,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -571,7 +571,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -649,7 +649,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -732,7 +732,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -801,7 +801,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -870,7 +870,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -934,7 +934,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1013,7 +1013,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1078,7 +1078,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1154,7 +1154,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1217,7 +1217,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1296,7 +1296,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1362,7 +1362,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1433,7 +1433,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py index d2e9ea4df1e5..147bfad382cd 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_01_19/operations/_iot_hub_resource_operations.py @@ -192,8 +192,8 @@ def begin_create_or_update( :type iot_hub_description: ~azure.mgmt.iothub.v2017_01_19.models.IotHubDescription :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 IotHubDescription or the result of cls(response) @@ -320,8 +320,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py index 7496b1975f37..d6525ec37b30 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py index 25662122bb60..dccd4e4bacc5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -251,7 +251,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -307,7 +307,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -319,8 +319,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 IotHubDescription or the result of cls(response) @@ -374,7 +374,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -444,7 +444,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -518,7 +518,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -579,7 +579,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -657,7 +657,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -740,7 +740,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -809,7 +809,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -878,7 +878,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -942,7 +942,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1021,7 +1021,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1086,7 +1086,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1162,7 +1162,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1225,7 +1225,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1304,7 +1304,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1370,7 +1370,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1441,7 +1441,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py index 515a81d13e04..e18c07af9281 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py index 643d440b9067..ad374e0f45fb 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2017_07_01/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py index deeaa6708f2d..99a1ed3a7e8c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py index 203567972d98..57193c221bf7 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2018_01_22.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -935,7 +935,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1004,7 +1004,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1068,7 +1068,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1147,7 +1147,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1212,7 +1212,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1288,7 +1288,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1351,7 +1351,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1430,7 +1430,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1496,7 +1496,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1567,7 +1567,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py index aaa7b933a784..5ced46710767 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py index 3f4fffc7ec75..173495d79397 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_01_22/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2018_01_22.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py index f7bada776fde..6f2338e5a2b9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py index 66b41de9ecc3..6d146901419b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2018_04_01.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -935,7 +935,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1004,7 +1004,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1068,7 +1068,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1147,7 +1147,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1212,7 +1212,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1289,7 +1289,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1365,7 +1365,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1429,7 +1429,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1498,7 +1498,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1566,7 +1566,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1645,7 +1645,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1711,7 +1711,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1782,7 +1782,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py index 1a0d52047cad..e64469ea5166 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py index e0089dac35b7..66379c6dbde4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py index 5178b3abdbcc..15b86cdf4710 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models.py @@ -1938,13 +1938,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -1961,14 +1961,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired_properties: Twin desired properties. - :type desired_properties: str + :type desired_properties: any :param reported_properties: Twin desired properties. - :type reported_properties: str + :type reported_properties: any """ _attribute_map = { - 'desired_properties': {'key': 'desiredProperties', 'type': 'str'}, - 'reported_properties': {'key': 'reportedProperties', 'type': 'str'}, + 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, + 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py index 4142210dac5e..bb46abdae2ea 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/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 @@ -2097,20 +2097,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2018_04_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2123,21 +2123,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired_properties: Twin desired properties. - :type desired_properties: str + :type desired_properties: any :param reported_properties: Twin desired properties. - :type reported_properties: str + :type reported_properties: any """ _attribute_map = { - 'desired_properties': {'key': 'desiredProperties', 'type': 'str'}, - 'reported_properties': {'key': 'reportedProperties', 'type': 'str'}, + 'desired_properties': {'key': 'desiredProperties', 'type': 'object'}, + 'reported_properties': {'key': 'reportedProperties', 'type': 'object'}, } def __init__( self, *, - desired_properties: Optional[str] = None, - reported_properties: Optional[str] = None, + desired_properties: Optional[Any] = None, + reported_properties: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py index cf2e2c7a5757..c017f84076e1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2018_04_01/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2018_04_01.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py index cb3ee9059642..67eca47974e4 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py index f01e44a77654..c2cb8ac10b48 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_operations.py @@ -47,7 +47,7 @@ async def _manual_failover_initial( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -98,7 +98,7 @@ async def begin_manual_failover( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Manually initiate a failover for the IoT Hub to its secondary region. @@ -115,8 +115,8 @@ async def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2019_03_22.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py index 6721dfe911b5..efb90a4b000c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2019_03_22.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -935,7 +935,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1004,7 +1004,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1068,7 +1068,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1147,7 +1147,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1212,7 +1212,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1289,7 +1289,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1365,7 +1365,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1429,7 +1429,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1498,7 +1498,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1566,7 +1566,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1645,7 +1645,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1711,7 +1711,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1782,7 +1782,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py index 767d94699063..aa1890635d53 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py index 6e0eaaa66f08..c880e562b35a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py index b8c0e90a3bc3..0359132db5a2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models.py @@ -1982,13 +1982,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2005,14 +2005,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py index f9c35a23e451..202cfa479536 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/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 @@ -2143,20 +2143,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2019_03_22.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2169,21 +2169,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( self, *, - desired: Optional[str] = None, - reported: Optional[str] = None, + desired: Optional[Any] = None, + reported: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py index 28329370db17..518aec6fce65 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_operations.py @@ -121,8 +121,8 @@ def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2019_03_22.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py index a6dce212eef9..754a6e33e4b1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_03_22/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2019_03_22.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py index fbbb35d4a06f..ec1a719dae39 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py index b63469b630c0..00b17cbe6034 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_operations.py @@ -47,7 +47,7 @@ async def _manual_failover_initial( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -98,7 +98,7 @@ async def begin_manual_failover( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Manual Failover Fail over. @@ -112,8 +112,8 @@ async def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py index 692350d82ee1..4e2aa39c4e7d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2019_07_01_preview.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -935,7 +935,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1004,7 +1004,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1068,7 +1068,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1147,7 +1147,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1212,7 +1212,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1289,7 +1289,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1365,7 +1365,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1429,7 +1429,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1498,7 +1498,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1566,7 +1566,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1645,7 +1645,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1711,7 +1711,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1782,7 +1782,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py index 72444286966c..743295d26784 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py index efc6e9c852c3..f85aaa1dec40 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py index 2c9b6d3bacf3..f55305672417 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models.py @@ -2048,13 +2048,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2071,14 +2071,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py index 1f5dda93152b..9a354236e9c8 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/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 @@ -2217,20 +2217,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2019_07_01_preview.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2243,21 +2243,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( self, *, - desired: Optional[str] = None, - reported: Optional[str] = None, + desired: Optional[Any] = None, + reported: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py index 0019b5e7c9de..667b2645228a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_operations.py @@ -118,8 +118,8 @@ def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2019_07_01_preview.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py index a30b829b5a0f..e556b24941aa 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_07_01_preview/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2019_07_01_preview.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py index d73a25442cf3..8a941f871504 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py index 85a3fb0f95e4..aab3a24ea223 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_operations.py @@ -47,7 +47,7 @@ async def _manual_failover_initial( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -98,7 +98,7 @@ async def begin_manual_failover( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Manually initiate a failover for the IoT Hub to its secondary region. @@ -115,8 +115,8 @@ async def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2019_11_04.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py index 0bac613fabcf..a60aa6c1a20a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2019_11_04.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -935,7 +935,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1004,7 +1004,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1068,7 +1068,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1147,7 +1147,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1212,7 +1212,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1289,7 +1289,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1365,7 +1365,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1429,7 +1429,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1498,7 +1498,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1566,7 +1566,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1645,7 +1645,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1711,7 +1711,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1782,7 +1782,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py index f9b29316cb08..606437d237f0 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py index 971d90f6376d..225317d7ee58 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py index 10fcf5965e1d..af609c11b7ff 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models.py @@ -2023,13 +2023,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2046,14 +2046,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py index 17df9b4cea40..9dee07a997a6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/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 @@ -2189,20 +2189,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2019_11_04.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2215,21 +2215,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( self, *, - desired: Optional[str] = None, - reported: Optional[str] = None, + desired: Optional[Any] = None, + reported: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py index ff32b7e36f4d..b140ad5eba5a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_operations.py @@ -121,8 +121,8 @@ def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2019_11_04.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py index cdd0a11789c1..f5556c8f14d2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2019_11_04.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py index 955e866bfcb8..4dbb41d6941c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateBodyDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py index 6ccccbceeacb..bf818219456b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_operations.py @@ -47,7 +47,7 @@ async def _manual_failover_initial( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -98,7 +98,7 @@ async def begin_manual_failover( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Manually initiate a failover for the IoT Hub to its secondary region. @@ -115,8 +115,8 @@ async def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2020_03_01.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py index 795b7eadc29b..6eba81156669 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2020_03_01.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -935,7 +935,7 @@ async def create_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1004,7 +1004,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1068,7 +1068,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1147,7 +1147,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1212,7 +1212,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1289,7 +1289,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1365,7 +1365,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1429,7 +1429,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1498,7 +1498,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1566,7 +1566,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1645,7 +1645,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1711,7 +1711,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1782,7 +1782,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py index 84bdf1d834f6..3803c9762b4d 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py index 12bdfa137783..ebc1580cad7a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_endpoint_connections_operations.py @@ -46,7 +46,7 @@ async def list( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> List["_models.PrivateEndpointConnection"]: """List private endpoint connections. @@ -108,7 +108,7 @@ async def get( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Get private endpoint connection. @@ -174,7 +174,7 @@ async def _update_initial( resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { @@ -234,7 +234,7 @@ async def begin_update( resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Update private endpoint connection. @@ -250,8 +250,8 @@ async def begin_update( :type private_endpoint_connection: ~azure.mgmt.iothub.v2020_03_01.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 PrivateEndpointConnection or the result of cls(response) @@ -311,7 +311,7 @@ async def _delete_initial( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { @@ -366,7 +366,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Delete 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 PrivateEndpointConnection or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py index c59c99ccec7a..7749488f0d1b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_private_link_resources_operations.py @@ -44,7 +44,7 @@ async def list( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResources": """List private link resources. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, group_id: str, - **kwargs + **kwargs: Any ) -> "_models.GroupIdInformation": """Get the specified private link resource. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py index c8d34f0a0c44..748bdf90123e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py index 7211387af228..5d9f13920872 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models.py @@ -2346,13 +2346,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2369,14 +2369,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py index 9d3043420cce..0d47050e4f9a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/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 @@ -2552,20 +2552,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2020_03_01.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2578,21 +2578,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( self, *, - desired: Optional[str] = None, - reported: Optional[str] = None, + desired: Optional[Any] = None, + reported: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py index 98c9e41d9e39..5074a8f939da 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_operations.py @@ -121,8 +121,8 @@ def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2020_03_01.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py index 1a45f7c7a039..c1ed507d469c 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2020_03_01.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py index abf05f575b4b..73f726bdbb94 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2020_03_01/operations/_private_endpoint_connections_operations.py @@ -258,8 +258,8 @@ def begin_update( :type private_endpoint_connection: ~azure.mgmt.iothub.v2020_03_01.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 PrivateEndpointConnection or the result of cls(response) @@ -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 PrivateEndpointConnection or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py index e017ea2b7397..b396fb3535ea 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py index 2804a1d024b4..6de4792dabf1 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_operations.py @@ -47,7 +47,7 @@ async def _manual_failover_initial( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -98,7 +98,7 @@ async def begin_manual_failover( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Manually initiate a failover for the IoT Hub to its secondary region. @@ -115,8 +115,8 @@ async def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2021_03_03_preview.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py index 07be5cbce6f3..416a5dddfb21 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -190,8 +190,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -250,7 +250,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -303,7 +303,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -317,8 +317,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_03_preview.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -375,7 +375,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -431,7 +431,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -443,8 +443,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 IotHubDescription or the result of cls(response) @@ -498,7 +498,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -568,7 +568,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -642,7 +642,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -703,7 +703,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -781,7 +781,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -864,7 +864,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -934,7 +934,7 @@ async def create_event_hub_consumer_group( event_hub_endpoint_name: str, name: str, consumer_group_body: "_models.EventHubConsumerGroupBodyDescription", - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1010,7 +1010,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1074,7 +1074,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1153,7 +1153,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1218,7 +1218,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1295,7 +1295,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1371,7 +1371,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1435,7 +1435,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1504,7 +1504,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1572,7 +1572,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1651,7 +1651,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1717,7 +1717,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1788,7 +1788,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py index ddbda76dfe15..397b3f45c3af 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py index cd26826afcc3..848003d6c0d5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_endpoint_connections_operations.py @@ -46,7 +46,7 @@ async def list( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> List["_models.PrivateEndpointConnection"]: """List private endpoint connections. @@ -108,7 +108,7 @@ async def get( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Get private endpoint connection. @@ -174,7 +174,7 @@ async def _update_initial( resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { @@ -234,7 +234,7 @@ async def begin_update( resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Update private endpoint connection. @@ -250,8 +250,8 @@ async def begin_update( :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_03_preview.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 PrivateEndpointConnection or the result of cls(response) @@ -311,7 +311,7 @@ async def _delete_initial( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { @@ -366,7 +366,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Delete 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 PrivateEndpointConnection or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py index abad86d7ff4a..a138a40dea52 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_private_link_resources_operations.py @@ -44,7 +44,7 @@ async def list( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResources": """List private link resources. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, group_id: str, - **kwargs + **kwargs: Any ) -> "_models.GroupIdInformation": """Get the specified private link resource. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py index 91ddb2fc0c3f..8f18daa04c36 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py index aa366765aa72..59d5b0732b8f 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models.py @@ -2684,13 +2684,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2707,14 +2707,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py index a48155474741..3208fb57c4b9 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/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 @@ -2929,20 +2929,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2021_03_03_preview.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2955,21 +2955,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( self, *, - desired: Optional[str] = None, - reported: Optional[str] = None, + desired: Optional[Any] = None, + reported: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py index ba2885a44b52..25a6ba351247 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_operations.py @@ -121,8 +121,8 @@ def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2021_03_03_preview.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py index 1ed38763255a..3f26f763b334 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_iot_hub_resource_operations.py @@ -197,8 +197,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -326,8 +326,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_03_preview.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -454,8 +454,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py index 37e894ac4915..1dc5cda2d50b 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_03_preview/operations/_private_endpoint_connections_operations.py @@ -258,8 +258,8 @@ def begin_update( :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_03_preview.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 PrivateEndpointConnection or the result of cls(response) @@ -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 PrivateEndpointConnection or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py index 48944bf3938a..83f24ab50946 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py index 2ab30b20626f..6be8dc807724 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_certificates_operations.py @@ -44,7 +44,7 @@ async def list_by_iot_hub( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateListDescription": """Get the certificate list. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, certificate_name: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Get the certificate. @@ -173,7 +173,7 @@ async def create_or_update( certificate_name: str, certificate_description: "_models.CertificateDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Upload the certificate to the IoT hub. @@ -255,7 +255,7 @@ async def delete( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> None: """Delete an X509 certificate. @@ -321,7 +321,7 @@ async def generate_verification_code( resource_name: str, certificate_name: str, if_match: str, - **kwargs + **kwargs: Any ) -> "_models.CertificateWithNonceDescription": """Generate verification code for proof of possession flow. @@ -392,7 +392,7 @@ async def verify( certificate_name: str, if_match: str, certificate_verification_body: "_models.CertificateVerificationDescription", - **kwargs + **kwargs: Any ) -> "_models.CertificateDescription": """Verify certificate's private key possession. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py index ae761208f89d..6b6e8e4e6609 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_operations.py @@ -47,7 +47,7 @@ async def _manual_failover_initial( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { @@ -98,7 +98,7 @@ async def begin_manual_failover( iot_hub_name: str, resource_group_name: str, failover_input: "_models.FailoverInput", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Manually initiate a failover for the IoT Hub to its secondary region. @@ -115,8 +115,8 @@ async def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2021_03_31.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py index ea79ff1a8b9f..ce53fec51266 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_iot_hub_resource_operations.py @@ -47,7 +47,7 @@ async def get( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": """Get the non-security related metadata of an IoT hub. @@ -110,7 +110,7 @@ async def _create_or_update_initial( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -171,7 +171,7 @@ async def begin_create_or_update( resource_name: str, iot_hub_description: "_models.IotHubDescription", if_match: Optional[str] = None, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Create or update the metadata of an IoT hub. @@ -192,8 +192,8 @@ async def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -252,7 +252,7 @@ async def _update_initial( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> "_models.IotHubDescription": cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] error_map = { @@ -305,7 +305,7 @@ async def begin_update( resource_group_name: str, resource_name: str, iot_hub_tags: "_models.TagsResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.IotHubDescription"]: """Update an existing IoT Hubs tags. @@ -319,8 +319,8 @@ async def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_31.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -377,7 +377,7 @@ async def _delete_initial( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] error_map = { @@ -433,7 +433,7 @@ async def begin_delete( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: """Delete an IoT hub. @@ -445,8 +445,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 IotHubDescription or the result of cls(response) @@ -500,7 +500,7 @@ def get_long_running_output(pipeline_response): def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a subscription. @@ -570,7 +570,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: """Get all the IoT hubs in a resource group. @@ -644,7 +644,7 @@ async def get_stats( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.RegistryStatistics": """Get the statistics from an IoT hub. @@ -705,7 +705,7 @@ def get_valid_skus( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: """Get the list of valid SKUs for an IoT hub. @@ -783,7 +783,7 @@ def list_event_hub_consumer_groups( resource_group_name: str, resource_name: str, event_hub_endpoint_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. @@ -866,7 +866,7 @@ async def get_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. @@ -936,7 +936,7 @@ async def create_event_hub_consumer_group( event_hub_endpoint_name: str, name: str, consumer_group_body: "_models.EventHubConsumerGroupBodyDescription", - **kwargs + **kwargs: Any ) -> "_models.EventHubConsumerGroupInfo": """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @@ -1012,7 +1012,7 @@ async def delete_event_hub_consumer_group( resource_name: str, event_hub_endpoint_name: str, name: str, - **kwargs + **kwargs: Any ) -> None: """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. @@ -1076,7 +1076,7 @@ def list_jobs( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.JobResponseListResult"]: """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1155,7 +1155,7 @@ async def get_job( resource_group_name: str, resource_name: str, job_id: str, - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @@ -1220,7 +1220,7 @@ def get_quota_metrics( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: """Get the quota metrics for an IoT hub. @@ -1297,7 +1297,7 @@ def get_endpoint_health( self, resource_group_name: str, iot_hub_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: """Get the health for routing endpoints. @@ -1373,7 +1373,7 @@ async def get_next(next_link=None): async def check_name_availability( self, operation_inputs: "_models.OperationInputs", - **kwargs + **kwargs: Any ) -> "_models.IotHubNameAvailabilityInfo": """Check if an IoT hub name is available. @@ -1437,7 +1437,7 @@ async def test_all_routes( iot_hub_name: str, resource_group_name: str, input: "_models.TestAllRoutesInput", - **kwargs + **kwargs: Any ) -> "_models.TestAllRoutesResult": """Test all routes. @@ -1506,7 +1506,7 @@ async def test_route( iot_hub_name: str, resource_group_name: str, input: "_models.TestRouteInput", - **kwargs + **kwargs: Any ) -> "_models.TestRouteResult": """Test the new route. @@ -1574,7 +1574,7 @@ def list_keys( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1653,7 +1653,7 @@ async def get_keys_for_key_name( resource_group_name: str, resource_name: str, key_name: str, - **kwargs + **kwargs: Any ) -> "_models.SharedAccessSignatureAuthorizationRule": """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @@ -1719,7 +1719,7 @@ async def export_devices( resource_group_name: str, resource_name: str, export_devices_parameters: "_models.ExportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @@ -1790,7 +1790,7 @@ async def import_devices( resource_group_name: str, resource_name: str, import_devices_parameters: "_models.ImportDevicesRequest", - **kwargs + **kwargs: Any ) -> "_models.JobResponse": """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py index 2535b954f078..baeb94261ee2 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available IoT Hub REST API operations. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py index 132ab4e3daf2..2b3111df0d15 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_endpoint_connections_operations.py @@ -46,7 +46,7 @@ async def list( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> List["_models.PrivateEndpointConnection"]: """List private endpoint connections. @@ -108,7 +108,7 @@ async def get( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": """Get private endpoint connection. @@ -174,7 +174,7 @@ async def _update_initial( resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { @@ -234,7 +234,7 @@ async def begin_update( resource_name: str, private_endpoint_connection_name: str, private_endpoint_connection: "_models.PrivateEndpointConnection", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Update private endpoint connection. @@ -250,8 +250,8 @@ async def begin_update( :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_31.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 PrivateEndpointConnection or the result of cls(response) @@ -311,7 +311,7 @@ async def _delete_initial( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { @@ -366,7 +366,7 @@ async def begin_delete( resource_group_name: str, resource_name: str, private_endpoint_connection_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Delete 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 PrivateEndpointConnection or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py index 9ae1ec6eab24..e29aa7bb7727 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_private_link_resources_operations.py @@ -44,7 +44,7 @@ async def list( self, resource_group_name: str, resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResources": """List private link resources. @@ -106,7 +106,7 @@ async def get( resource_group_name: str, resource_name: str, group_id: str, - **kwargs + **kwargs: Any ) -> "_models.GroupIdInformation": """Get the specified private link resource. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py index 529f55e9fcf8..67582636977a 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/aio/operations/_resource_provider_common_operations.py @@ -42,7 +42,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def get_subscription_quota( self, - **kwargs + **kwargs: Any ) -> "_models.UserSubscriptionQuotaListResult": """Get the number of iot hubs in the subscription. diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py index d91f42533c72..2c62b6b5bc47 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models.py @@ -565,7 +565,7 @@ class EventHubConsumerGroupInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The tags. - :type properties: dict[str, object] + :type properties: dict[str, any] :ivar id: The Event Hub-compatible consumer group identifier. :vartype id: str :ivar name: The Event Hub-compatible consumer group name. @@ -2625,13 +2625,13 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } @@ -2648,14 +2648,14 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py index 9b2483967fe3..f39ce7fab9f6 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/models/_models_py3.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/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 @@ -604,7 +604,7 @@ class EventHubConsumerGroupInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :param properties: The tags. - :type properties: dict[str, object] + :type properties: dict[str, any] :ivar id: The Event Hub-compatible consumer group identifier. :vartype id: str :ivar name: The Event Hub-compatible consumer group name. @@ -633,7 +633,7 @@ class EventHubConsumerGroupInfo(msrest.serialization.Model): def __init__( self, *, - properties: Optional[Dict[str, object]] = None, + properties: Optional[Dict[str, Any]] = None, **kwargs ): super(EventHubConsumerGroupInfo, self).__init__(**kwargs) @@ -2864,20 +2864,20 @@ class RoutingTwin(msrest.serialization.Model): """Twin reference input parameter. This is an optional parameter. :param tags: A set of tags. Twin Tags. - :type tags: str + :type tags: any :param properties: :type properties: ~azure.mgmt.iothub.v2021_03_31.models.RoutingTwinProperties """ _attribute_map = { - 'tags': {'key': 'tags', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': 'object'}, 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, } def __init__( self, *, - tags: Optional[str] = None, + tags: Optional[Any] = None, properties: Optional["RoutingTwinProperties"] = None, **kwargs ): @@ -2890,21 +2890,21 @@ class RoutingTwinProperties(msrest.serialization.Model): """RoutingTwinProperties. :param desired: Twin desired properties. - :type desired: str + :type desired: any :param reported: Twin desired properties. - :type reported: str + :type reported: any """ _attribute_map = { - 'desired': {'key': 'desired', 'type': 'str'}, - 'reported': {'key': 'reported', 'type': 'str'}, + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, } def __init__( self, *, - desired: Optional[str] = None, - reported: Optional[str] = None, + desired: Optional[Any] = None, + reported: Optional[Any] = None, **kwargs ): super(RoutingTwinProperties, self).__init__(**kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py index 3867a64cd8d3..42dc351fc990 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_operations.py @@ -121,8 +121,8 @@ def begin_manual_failover( :type failover_input: ~azure.mgmt.iothub.v2021_03_31.models.FailoverInput :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/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py index 442b6248f58f..5892b4dffa1e 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_iot_hub_resource_operations.py @@ -199,8 +199,8 @@ def begin_create_or_update( :type if_match: 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 IotHubDescription or the result of cls(response) @@ -328,8 +328,8 @@ def begin_update( :type iot_hub_tags: ~azure.mgmt.iothub.v2021_03_31.models.TagsResource :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 IotHubDescription or the result of cls(response) @@ -456,8 +456,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 IotHubDescription or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py index 2fb547fd021e..985f2660a5c5 100644 --- a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_03_31/operations/_private_endpoint_connections_operations.py @@ -258,8 +258,8 @@ def begin_update( :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_03_31.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 PrivateEndpointConnection or the result of cls(response) @@ -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 PrivateEndpointConnection or the result of cls(response) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py new file mode 100644 index 000000000000..8883d8041fab --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/__init__.py @@ -0,0 +1,19 @@ +# 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 ._iot_hub_client import IotHubClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['IotHubClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py new file mode 100644 index 000000000000..16d86d588306 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_configuration.py @@ -0,0 +1,71 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-07-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py new file mode 100644 index 000000000000..f8d1369a548c --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_iot_hub_client.py @@ -0,0 +1,119 @@ +# 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 + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from . import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2021_07_01.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2021_07_01.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2021_07_01.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2021_07_01.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2021_07_01.operations.IotHubOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.iothub.v2021_07_01.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2021_07_01.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + 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 + self._client.close() + + def __enter__(self): + # type: () -> IotHubClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json new file mode 100644 index 000000000000..35497d20c61e --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_metadata.json @@ -0,0 +1,109 @@ +{ + "chosen_version": "2021-07-01", + "total_api_version_list": ["2021-07-01"], + "client": { + "name": "IotHubClient", + "filename": "_iot_hub_client", + "description": "Use this API to manage the IoT hubs in your Azure subscription.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"IotHubClientConfiguration\"]}}, \"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\": [\"IotHubClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "iot_hub_resource": "IotHubResourceOperations", + "resource_provider_common": "ResourceProviderCommonOperations", + "certificates": "CertificatesOperations", + "iot_hub": "IotHubOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + } +} \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py new file mode 100644 index 000000000000..83f24ab50946 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "2.1.0" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py new file mode 100644 index 000000000000..a84cf700a930 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._iot_hub_client import IotHubClient +__all__ = ['IotHubClient'] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py new file mode 100644 index 000000000000..535240e2770a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class IotHubClientConfiguration(Configuration): + """Configuration for IotHubClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(IotHubClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-07-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-iothub/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py new file mode 100644 index 000000000000..a390aadace03 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/_iot_hub_client.py @@ -0,0 +1,112 @@ +# 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, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import IotHubClientConfiguration +from .operations import Operations +from .operations import IotHubResourceOperations +from .operations import ResourceProviderCommonOperations +from .operations import CertificatesOperations +from .operations import IotHubOperations +from .operations import PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .. import models + + +class IotHubClient(object): + """Use this API to manage the IoT hubs in your Azure subscription. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.iothub.v2021_07_01.aio.operations.Operations + :ivar iot_hub_resource: IotHubResourceOperations operations + :vartype iot_hub_resource: azure.mgmt.iothub.v2021_07_01.aio.operations.IotHubResourceOperations + :ivar resource_provider_common: ResourceProviderCommonOperations operations + :vartype resource_provider_common: azure.mgmt.iothub.v2021_07_01.aio.operations.ResourceProviderCommonOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.iothub.v2021_07_01.aio.operations.CertificatesOperations + :ivar iot_hub: IotHubOperations operations + :vartype iot_hub: azure.mgmt.iothub.v2021_07_01.aio.operations.IotHubOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.iothub.v2021_07_01.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.iothub.v2021_07_01.aio.operations.PrivateEndpointConnectionsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = IotHubClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub_resource = IotHubResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.resource_provider_common = ResourceProviderCommonOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.iot_hub = IotHubOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + 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() + + async def __aenter__(self) -> "IotHubClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py new file mode 100644 index 000000000000..3930a2f261c8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..65d17b636757 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_certificates_operations.py @@ -0,0 +1,464 @@ +# 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.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 CertificatesOperations: + """CertificatesOperations 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.iothub.v2021_07_01.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 list_by_iot_hub( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.CertificateListDescription": + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateDescription": + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + certificate_description: "_models.CertificateDescription", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.CertificateDescription": + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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(certificate_description, 'CertificateDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs: Any + ) -> None: + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-07-01" + accept = "application/json" + + # Construct URL + url = self.delete.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + async def generate_verification_code( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + **kwargs: Any + ) -> "_models.CertificateWithNonceDescription": + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(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('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + async def verify( + self, + resource_group_name: str, + resource_name: str, + certificate_name: str, + if_match: str, + certificate_verification_body: "_models.CertificateVerificationDescription", + **kwargs: Any + ) -> "_models.CertificateDescription": + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2021_07_01.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..a894031b3087 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py @@ -0,0 +1,167 @@ +# 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 IotHubOperations: + """IotHubOperations 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.iothub.v2021_07_01.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 _manual_failover_initial( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **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-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 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 cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + async def begin_manual_failover( + self, + iot_hub_name: str, + resource_group_name: str, + failover_input: "_models.FailoverInput", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Manually initiate a failover for the IoT Hub to its secondary region. + + Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + https://aka.ms/manualfailover. + + :param iot_hub_name: Name of the IoT hub to failover. + :type iot_hub_name: str + :param resource_group_name: Name of the resource group containing the IoT hub resource. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be the Azure paired region. Get the value + from the secondary location in the locations property. To learn more, see + https://aka.ms/manualfailover/region. + :type failover_input: ~azure.mgmt.iothub.v2021_07_01.models.FailoverInput + :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._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + 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 = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + 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_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..cb7cb62ba5cb --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1857 @@ +# 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 IotHubResourceOperations: + """IotHubResourceOperations 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.iothub.v2021_07_01.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, + resource_name: str, + **kwargs: Any + ) -> "_models.IotHubDescription": + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_description: "_models.IotHubDescription", + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + 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('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs: Any + ) -> "_models.IotHubDescription": + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + iot_hub_tags: "_models.TagsResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.IotHubDescription"]: + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2021_07_01.models.TagsResource + :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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + 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('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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.Devices/IotHubs/{resourceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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, 404]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncLROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]]: + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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, + resource_name=resource_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): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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('IotHubDescriptionListResult', 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.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.IotHubDescriptionListResult"]: + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :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 IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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'), + } + 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('IotHubDescriptionListResult', 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.Devices/IotHubs'} # type: ignore + + async def get_stats( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.RegistryStatistics": + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_stats.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.IotHubSkuDescriptionListResult"]: + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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.get_valid_skus.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('IotHubSkuDescriptionListResult', 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 + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EventHubConsumerGroupsListResult"]: + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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_event_hub_consumer_groups.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('EventHubConsumerGroupsListResult', 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_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + async def get_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs: Any + ) -> "_models.EventHubConsumerGroupInfo": + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def create_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + consumer_group_body: "_models.EventHubConsumerGroupBodyDescription", + **kwargs: Any + ) -> "_models.EventHubConsumerGroupInfo": + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :param consumer_group_body: The consumer group to add. + :type consumer_group_body: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupBodyDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(consumer_group_body, 'EventHubConsumerGroupBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + async def delete_event_hub_consumer_group( + self, + resource_group_name: str, + resource_name: str, + event_hub_endpoint_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-07-01" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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]: + 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 cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.JobResponseListResult"]: + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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_jobs.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('JobResponseListResult', 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_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + async def get_job( + self, + resource_group_name: str, + resource_name: str, + job_id: str, + **kwargs: Any + ) -> "_models.JobResponse": + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_job.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.IotHubQuotaMetricInfoListResult"]: + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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.get_quota_metrics.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('IotHubQuotaMetricInfoListResult', 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 + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name: str, + iot_hub_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointHealthDataListResult"]: + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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.get_endpoint_health.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'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('EndpointHealthDataListResult', 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 + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + async def check_name_availability( + self, + operation_inputs: "_models.OperationInputs", + **kwargs: Any + ) -> "_models.IotHubNameAvailabilityInfo": + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2021_07_01.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + async def test_all_routes( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestAllRoutesInput", + **kwargs: Any + ) -> "_models.TestAllRoutesResult": + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + async def test_route( + self, + iot_hub_name: str, + resource_group_name: str, + input: "_models.TestRouteInput", + **kwargs: Any + ) -> "_models.TestRouteResult": + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]: + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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_keys.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('SharedAccessSignatureAuthorizationRuleListResult', 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_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + async def get_keys_for_key_name( + self, + resource_group_name: str, + resource_name: str, + key_name: str, + **kwargs: Any + ) -> "_models.SharedAccessSignatureAuthorizationRule": + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(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('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + async def export_devices( + self, + resource_group_name: str, + resource_name: str, + export_devices_parameters: "_models.ExportDevicesRequest", + **kwargs: Any + ) -> "_models.JobResponse": + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + async def import_devices( + self, + resource_group_name: str, + resource_name: str, + import_devices_parameters: "_models.ImportDevicesRequest", + **kwargs: Any + ) -> "_models.JobResponse": + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py new file mode 100644 index 000000000000..df02361d4cf2 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# 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 Operations: + """Operations 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.iothub.v2021_07_01.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( + self, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists all of the available IoT Hub REST API operations. + + :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.iothub.v2021_07_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = 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('OperationListResult', 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.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..f97b00f7b2f3 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,436 @@ +# 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, List, 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 PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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.iothub.v2021_07_01.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 list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> List["_models.PrivateEndpointConnection"]: + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Update private endpoint connection. + + Update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + resource_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..51a0aec9cc56 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,167 @@ +# 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 +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.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 PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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.iothub.v2021_07_01.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 list( + self, + resource_group_name: str, + resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResources": + """List private link resources. + + List private link resources for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources'} # type: ignore + + async def get( + self, + resource_group_name: str, + resource_name: str, + group_id: str, + **kwargs: Any + ) -> "_models.GroupIdInformation": + """Get the specified private link resource. + + Get the specified private link resource for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..0b0852664095 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_resource_provider_common_operations.py @@ -0,0 +1,94 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 +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.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 ResourceProviderCommonOperations: + """ResourceProviderCommonOperations 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.iothub.v2021_07_01.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_subscription_quota( + self, + **kwargs: Any + ) -> "_models.UserSubscriptionQuotaListResult": + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.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') + + # 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('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py new file mode 100644 index 000000000000..1491e763a154 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/__init__.py @@ -0,0 +1,301 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ArmIdentity + from ._models_py3 import ArmUserIdentity + from ._models_py3 import CertificateBodyDescription + from ._models_py3 import CertificateDescription + from ._models_py3 import CertificateListDescription + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificatePropertiesWithNonce + from ._models_py3 import CertificateVerificationDescription + from ._models_py3 import CertificateWithNonceDescription + from ._models_py3 import CloudToDeviceProperties + from ._models_py3 import EndpointHealthData + from ._models_py3 import EndpointHealthDataListResult + from ._models_py3 import EnrichmentProperties + from ._models_py3 import ErrorDetails + from ._models_py3 import EventHubConsumerGroupBodyDescription + from ._models_py3 import EventHubConsumerGroupInfo + from ._models_py3 import EventHubConsumerGroupName + from ._models_py3 import EventHubConsumerGroupsListResult + from ._models_py3 import EventHubProperties + from ._models_py3 import ExportDevicesRequest + from ._models_py3 import FailoverInput + from ._models_py3 import FallbackRouteProperties + from ._models_py3 import FeedbackProperties + from ._models_py3 import GroupIdInformation + from ._models_py3 import GroupIdInformationProperties + from ._models_py3 import ImportDevicesRequest + from ._models_py3 import IotHubCapacity + from ._models_py3 import IotHubDescription + from ._models_py3 import IotHubDescriptionListResult + from ._models_py3 import IotHubLocationDescription + from ._models_py3 import IotHubNameAvailabilityInfo + from ._models_py3 import IotHubProperties + from ._models_py3 import IotHubQuotaMetricInfo + from ._models_py3 import IotHubQuotaMetricInfoListResult + from ._models_py3 import IotHubSkuDescription + from ._models_py3 import IotHubSkuDescriptionListResult + from ._models_py3 import IotHubSkuInfo + from ._models_py3 import IpFilterRule + from ._models_py3 import JobResponse + from ._models_py3 import JobResponseListResult + from ._models_py3 import ManagedIdentity + from ._models_py3 import MatchedRoute + from ._models_py3 import MessagingEndpointProperties + from ._models_py3 import Name + from ._models_py3 import NetworkRuleSetIpRule + from ._models_py3 import NetworkRuleSetProperties + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationInputs + from ._models_py3 import OperationListResult + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionProperties + from ._models_py3 import PrivateLinkResources + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import RegistryStatistics + from ._models_py3 import Resource + from ._models_py3 import RouteCompilationError + from ._models_py3 import RouteErrorPosition + from ._models_py3 import RouteErrorRange + from ._models_py3 import RouteProperties + from ._models_py3 import RoutingEndpoints + from ._models_py3 import RoutingEventHubProperties + from ._models_py3 import RoutingMessage + from ._models_py3 import RoutingProperties + from ._models_py3 import RoutingServiceBusQueueEndpointProperties + from ._models_py3 import RoutingServiceBusTopicEndpointProperties + from ._models_py3 import RoutingStorageContainerProperties + from ._models_py3 import RoutingTwin + from ._models_py3 import RoutingTwinProperties + from ._models_py3 import SharedAccessSignatureAuthorizationRule + from ._models_py3 import SharedAccessSignatureAuthorizationRuleListResult + from ._models_py3 import StorageEndpointProperties + from ._models_py3 import TagsResource + from ._models_py3 import TestAllRoutesInput + from ._models_py3 import TestAllRoutesResult + from ._models_py3 import TestRouteInput + from ._models_py3 import TestRouteResult + from ._models_py3 import TestRouteResultDetails + from ._models_py3 import UserSubscriptionQuota + from ._models_py3 import UserSubscriptionQuotaListResult +except (SyntaxError, ImportError): + from ._models import ArmIdentity # type: ignore + from ._models import ArmUserIdentity # type: ignore + from ._models import CertificateBodyDescription # type: ignore + from ._models import CertificateDescription # type: ignore + from ._models import CertificateListDescription # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificatePropertiesWithNonce # type: ignore + from ._models import CertificateVerificationDescription # type: ignore + from ._models import CertificateWithNonceDescription # type: ignore + from ._models import CloudToDeviceProperties # type: ignore + from ._models import EndpointHealthData # type: ignore + from ._models import EndpointHealthDataListResult # type: ignore + from ._models import EnrichmentProperties # type: ignore + from ._models import ErrorDetails # type: ignore + from ._models import EventHubConsumerGroupBodyDescription # type: ignore + from ._models import EventHubConsumerGroupInfo # type: ignore + from ._models import EventHubConsumerGroupName # type: ignore + from ._models import EventHubConsumerGroupsListResult # type: ignore + from ._models import EventHubProperties # type: ignore + from ._models import ExportDevicesRequest # type: ignore + from ._models import FailoverInput # type: ignore + from ._models import FallbackRouteProperties # type: ignore + from ._models import FeedbackProperties # type: ignore + from ._models import GroupIdInformation # type: ignore + from ._models import GroupIdInformationProperties # type: ignore + from ._models import ImportDevicesRequest # type: ignore + from ._models import IotHubCapacity # type: ignore + from ._models import IotHubDescription # type: ignore + from ._models import IotHubDescriptionListResult # type: ignore + from ._models import IotHubLocationDescription # type: ignore + from ._models import IotHubNameAvailabilityInfo # type: ignore + from ._models import IotHubProperties # type: ignore + from ._models import IotHubQuotaMetricInfo # type: ignore + from ._models import IotHubQuotaMetricInfoListResult # type: ignore + from ._models import IotHubSkuDescription # type: ignore + from ._models import IotHubSkuDescriptionListResult # type: ignore + from ._models import IotHubSkuInfo # type: ignore + from ._models import IpFilterRule # type: ignore + from ._models import JobResponse # type: ignore + from ._models import JobResponseListResult # type: ignore + from ._models import ManagedIdentity # type: ignore + from ._models import MatchedRoute # type: ignore + from ._models import MessagingEndpointProperties # type: ignore + from ._models import Name # type: ignore + from ._models import NetworkRuleSetIpRule # type: ignore + from ._models import NetworkRuleSetProperties # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationInputs # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionProperties # type: ignore + from ._models import PrivateLinkResources # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import RegistryStatistics # type: ignore + from ._models import Resource # type: ignore + from ._models import RouteCompilationError # type: ignore + from ._models import RouteErrorPosition # type: ignore + from ._models import RouteErrorRange # type: ignore + from ._models import RouteProperties # type: ignore + from ._models import RoutingEndpoints # type: ignore + from ._models import RoutingEventHubProperties # type: ignore + from ._models import RoutingMessage # type: ignore + from ._models import RoutingProperties # type: ignore + from ._models import RoutingServiceBusQueueEndpointProperties # type: ignore + from ._models import RoutingServiceBusTopicEndpointProperties # type: ignore + from ._models import RoutingStorageContainerProperties # type: ignore + from ._models import RoutingTwin # type: ignore + from ._models import RoutingTwinProperties # type: ignore + from ._models import SharedAccessSignatureAuthorizationRule # type: ignore + from ._models import SharedAccessSignatureAuthorizationRuleListResult # type: ignore + from ._models import StorageEndpointProperties # type: ignore + from ._models import TagsResource # type: ignore + from ._models import TestAllRoutesInput # type: ignore + from ._models import TestAllRoutesResult # type: ignore + from ._models import TestRouteInput # type: ignore + from ._models import TestRouteResult # type: ignore + from ._models import TestRouteResultDetails # type: ignore + from ._models import UserSubscriptionQuota # type: ignore + from ._models import UserSubscriptionQuotaListResult # type: ignore + +from ._iot_hub_client_enums import ( + AccessRights, + AuthenticationType, + Capabilities, + DefaultAction, + EndpointHealthStatus, + IotHubNameUnavailabilityReason, + IotHubReplicaRoleType, + IotHubScaleType, + IotHubSku, + IotHubSkuTier, + IpFilterActionType, + JobStatus, + JobType, + NetworkRuleIPAction, + PrivateLinkServiceConnectionStatus, + PublicNetworkAccess, + ResourceIdentityType, + RouteErrorSeverity, + RoutingSource, + RoutingStorageContainerPropertiesEncoding, + TestResultStatus, +) + +__all__ = [ + 'ArmIdentity', + 'ArmUserIdentity', + 'CertificateBodyDescription', + 'CertificateDescription', + 'CertificateListDescription', + 'CertificateProperties', + 'CertificatePropertiesWithNonce', + 'CertificateVerificationDescription', + 'CertificateWithNonceDescription', + 'CloudToDeviceProperties', + 'EndpointHealthData', + 'EndpointHealthDataListResult', + 'EnrichmentProperties', + 'ErrorDetails', + 'EventHubConsumerGroupBodyDescription', + 'EventHubConsumerGroupInfo', + 'EventHubConsumerGroupName', + 'EventHubConsumerGroupsListResult', + 'EventHubProperties', + 'ExportDevicesRequest', + 'FailoverInput', + 'FallbackRouteProperties', + 'FeedbackProperties', + 'GroupIdInformation', + 'GroupIdInformationProperties', + 'ImportDevicesRequest', + 'IotHubCapacity', + 'IotHubDescription', + 'IotHubDescriptionListResult', + 'IotHubLocationDescription', + 'IotHubNameAvailabilityInfo', + 'IotHubProperties', + 'IotHubQuotaMetricInfo', + 'IotHubQuotaMetricInfoListResult', + 'IotHubSkuDescription', + 'IotHubSkuDescriptionListResult', + 'IotHubSkuInfo', + 'IpFilterRule', + 'JobResponse', + 'JobResponseListResult', + 'ManagedIdentity', + 'MatchedRoute', + 'MessagingEndpointProperties', + 'Name', + 'NetworkRuleSetIpRule', + 'NetworkRuleSetProperties', + 'Operation', + 'OperationDisplay', + 'OperationInputs', + 'OperationListResult', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionProperties', + 'PrivateLinkResources', + 'PrivateLinkServiceConnectionState', + 'RegistryStatistics', + 'Resource', + 'RouteCompilationError', + 'RouteErrorPosition', + 'RouteErrorRange', + 'RouteProperties', + 'RoutingEndpoints', + 'RoutingEventHubProperties', + 'RoutingMessage', + 'RoutingProperties', + 'RoutingServiceBusQueueEndpointProperties', + 'RoutingServiceBusTopicEndpointProperties', + 'RoutingStorageContainerProperties', + 'RoutingTwin', + 'RoutingTwinProperties', + 'SharedAccessSignatureAuthorizationRule', + 'SharedAccessSignatureAuthorizationRuleListResult', + 'StorageEndpointProperties', + 'TagsResource', + 'TestAllRoutesInput', + 'TestAllRoutesResult', + 'TestRouteInput', + 'TestRouteResult', + 'TestRouteResultDetails', + 'UserSubscriptionQuota', + 'UserSubscriptionQuotaListResult', + 'AccessRights', + 'AuthenticationType', + 'Capabilities', + 'DefaultAction', + 'EndpointHealthStatus', + 'IotHubNameUnavailabilityReason', + 'IotHubReplicaRoleType', + 'IotHubScaleType', + 'IotHubSku', + 'IotHubSkuTier', + 'IpFilterActionType', + 'JobStatus', + 'JobType', + 'NetworkRuleIPAction', + 'PrivateLinkServiceConnectionStatus', + 'PublicNetworkAccess', + 'ResourceIdentityType', + 'RouteErrorSeverity', + 'RoutingSource', + 'RoutingStorageContainerPropertiesEncoding', + 'TestResultStatus', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py new file mode 100644 index 000000000000..77789fe60025 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_iot_hub_client_enums.py @@ -0,0 +1,231 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessRights(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permissions assigned to the shared access policy. + """ + + REGISTRY_READ = "RegistryRead" + REGISTRY_WRITE = "RegistryWrite" + SERVICE_CONNECT = "ServiceConnect" + DEVICE_CONNECT = "DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE = "RegistryRead, RegistryWrite" + REGISTRY_READ_SERVICE_CONNECT = "RegistryRead, ServiceConnect" + REGISTRY_READ_DEVICE_CONNECT = "RegistryRead, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT = "RegistryWrite, ServiceConnect" + REGISTRY_WRITE_DEVICE_CONNECT = "RegistryWrite, DeviceConnect" + SERVICE_CONNECT_DEVICE_CONNECT = "ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect" + REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT = "RegistryRead, RegistryWrite, DeviceConnect" + REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, ServiceConnect, DeviceConnect" + REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryWrite, ServiceConnect, DeviceConnect" + REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect" + +class AuthenticationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies authentication type being used for connecting to the storage account. + """ + + KEY_BASED = "keyBased" + IDENTITY_BASED = "identityBased" + +class Capabilities(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The capabilities and features enabled for the IoT hub. + """ + + NONE = "None" + DEVICE_MANAGEMENT = "DeviceManagement" + +class DefaultAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Default Action for Network Rule Set + """ + + DENY = "Deny" + ALLOW = "Allow" + +class EndpointHealthStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Health statuses have following meanings. The 'healthy' status shows that the endpoint is + accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting + messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an + unhealthy endpoint will be updated to healthy when IoT Hub has established an eventually + consistent state of health. The 'dead' status shows that the endpoint is not accepting + messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub metrics to + identify errors and monitor issues with endpoints. The 'unknown' status shows that the IoT Hub + has not established a connection with the endpoint. No messages have been delivered to or + rejected from this endpoint + """ + + UNKNOWN = "unknown" + HEALTHY = "healthy" + DEGRADED = "degraded" + UNHEALTHY = "unhealthy" + DEAD = "dead" + +class IotHubNameUnavailabilityReason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason for unavailability. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class IotHubReplicaRoleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The role of the region, can be either primary or secondary. The primary region is where the IoT + hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired + region and also the region where the IoT hub can failover to. + """ + + PRIMARY = "primary" + SECONDARY = "secondary" + +class IotHubScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the scaling enabled. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + NONE = "None" + +class IotHubSku(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the SKU. + """ + + F1 = "F1" + S1 = "S1" + S2 = "S2" + S3 = "S3" + B1 = "B1" + B2 = "B2" + B3 = "B3" + +class IotHubSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The billing tier for the IoT hub. + """ + + FREE = "Free" + STANDARD = "Standard" + BASIC = "Basic" + +class IpFilterActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The desired action for requests captured by this rule. + """ + + ACCEPT = "Accept" + REJECT = "Reject" + +class JobStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the job. + """ + + UNKNOWN = "unknown" + ENQUEUED = "enqueued" + RUNNING = "running" + COMPLETED = "completed" + FAILED = "failed" + CANCELLED = "cancelled" + +class JobType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the job. + """ + + UNKNOWN = "unknown" + EXPORT = "export" + IMPORT_ENUM = "import" + BACKUP = "backup" + READ_DEVICE_PROPERTIES = "readDeviceProperties" + WRITE_DEVICE_PROPERTIES = "writeDeviceProperties" + UPDATE_DEVICE_CONFIGURATION = "updateDeviceConfiguration" + REBOOT_DEVICE = "rebootDevice" + FACTORY_RESET_DEVICE = "factoryResetDevice" + FIRMWARE_UPDATE = "firmwareUpdate" + +class NetworkRuleIPAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """IP Filter Action + """ + + ALLOW = "Allow" + +class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of a private endpoint connection + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Whether requests from Public Network are allowed + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes + both an implicitly created identity and a set of user assigned identities. The type 'None' will + remove any identities from the service. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class RouteErrorSeverity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Severity of the route error + """ + + ERROR = "error" + WARNING = "warning" + +class RoutingSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The source that the routing rule is to be applied to, such as DeviceMessages. + """ + + INVALID = "Invalid" + DEVICE_MESSAGES = "DeviceMessages" + TWIN_CHANGE_EVENTS = "TwinChangeEvents" + DEVICE_LIFECYCLE_EVENTS = "DeviceLifecycleEvents" + DEVICE_JOB_LIFECYCLE_EVENTS = "DeviceJobLifecycleEvents" + DEVICE_CONNECTION_STATE_EVENTS = "DeviceConnectionStateEvents" + +class RoutingStorageContainerPropertiesEncoding(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Encoding that is used to serialize messages to blobs. Supported values are 'avro', + 'avrodeflate', and 'JSON'. Default value is 'avro'. + """ + + AVRO = "Avro" + AVRO_DEFLATE = "AvroDeflate" + JSON = "JSON" + +class TestResultStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Result of testing route + """ + + UNDEFINED = "undefined" + FALSE = "false" + TRUE = "true" diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models.py new file mode 100644 index 000000000000..4f074f1b0a30 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models.py @@ -0,0 +1,3026 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class ArmIdentity(msrest.serialization.Model): + """ArmIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the service. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.iothub.v2021_07_01.models.ResourceIdentityType + :param user_assigned_identities: Dictionary of :code:``. + :type user_assigned_identities: dict[str, + ~azure.mgmt.iothub.v2021_07_01.models.ArmUserIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ArmUserIdentity}'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ArmUserIdentity(msrest.serialization.Model): + """ArmUserIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmUserIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + :param is_verified: True indicates that the certificate will be created in verified state and + proof of possession will not be required. + :type is_verified: bool + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + self.is_verified = kwargs.get('is_verified', None) + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :param is_verified: Determines whether certificate has been verified. + :type is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = kwargs.get('is_verified', None) + self.created = None + self.updated = None + self.certificate = kwargs.get('certificate', None) + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = kwargs.get('certificate', None) + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2021_07_01.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + self.default_ttl_as_iso8601 = kwargs.get('default_ttl_as_iso8601', None) + self.feedback = kwargs.get('feedback', None) + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "degraded", + "unhealthy", "dead". + :type health_status: str or ~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthStatus + :param last_known_error: Last error obtained when a message failed to be delivered to iot hub. + :type last_known_error: str + :param last_known_error_time: Time at which the last known error occurred. + :type last_known_error_time: ~datetime.datetime + :param last_successful_send_attempt_time: Last time iot hub successfully sent a message to the + endpoint. + :type last_successful_send_attempt_time: ~datetime.datetime + :param last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. + :type last_send_attempt_time: ~datetime.datetime + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + 'last_known_error': {'key': 'lastKnownError', 'type': 'str'}, + 'last_known_error_time': {'key': 'lastKnownErrorTime', 'type': 'rfc-1123'}, + 'last_successful_send_attempt_time': {'key': 'lastSuccessfulSendAttemptTime', 'type': 'rfc-1123'}, + 'last_send_attempt_time': {'key': 'lastSendAttemptTime', 'type': 'rfc-1123'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = kwargs.get('endpoint_id', None) + self.health_status = kwargs.get('health_status', None) + self.last_known_error = kwargs.get('last_known_error', None) + self.last_known_error_time = kwargs.get('last_known_error_time', None) + self.last_successful_send_attempt_time = kwargs.get('last_successful_send_attempt_time', None) + self.last_send_attempt_time = kwargs.get('last_send_attempt_time', None) + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = kwargs['key'] + self.value = kwargs['value'] + self.endpoint_names = kwargs['endpoint_names'] + + +class ErrorDetails(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 http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupBodyDescription(msrest.serialization.Model): + """The EventHub consumer group. + + All required parameters must be populated in order to send to Azure. + + :param properties: Required. The EventHub consumer group name. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupName + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupBodyDescription, self).__init__(**kwargs) + self.properties = kwargs['properties'] + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, any] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{object}'}, + '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(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupName(msrest.serialization.Model): + """The EventHub consumer group name. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. EventHub consumer group name. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupName, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = kwargs.get('retention_time_in_days', None) + self.partition_count = kwargs.get('partition_count', None) + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + :param export_blob_name: The name of the blob that will be created in the provided output blob + container. This blob will contain the exported device registry information for the IoT Hub. + :type export_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for export devices. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be exported. + :type include_configurations: bool + :param configurations_blob_name: The name of the blob that will be created in the provided + output blob container. This blob will contain the exported configurations for the Iot Hub. + :type configurations_blob_name: str + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + 'export_blob_name': {'key': 'exportBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = kwargs['export_blob_container_uri'] + self.exclude_keys = kwargs['exclude_keys'] + self.export_blob_name = kwargs.get('export_blob_name', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.include_configurations = kwargs.get('include_configurations', None) + self.configurations_blob_name = kwargs.get('configurations_blob_name', None) + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = kwargs['failover_region'] + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on an IotHub. + + 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 properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = kwargs.get('group_id', None) + self.required_members = kwargs.get('required_members', None) + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + :param input_blob_name: The blob name to be used when importing from the provided input blob + container. + :type input_blob_name: str + :param output_blob_name: The blob name to use for storing the status of the import job. + :type output_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for import devices. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be imported. + :type include_configurations: bool + :param configurations_blob_name: The blob name to be used when importing configurations from + the provided input blob container. + :type configurations_blob_name: str + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + 'input_blob_name': {'key': 'inputBlobName', 'type': 'str'}, + 'output_blob_name': {'key': 'outputBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = kwargs['input_blob_container_uri'] + self.output_blob_container_uri = kwargs['output_blob_container_uri'] + self.input_blob_name = kwargs.get('input_blob_name', None) + self.output_blob_name = kwargs.get('output_blob_name', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.include_configurations = kwargs.get('include_configurations', None) + self.configurations_blob_name = kwargs.get('configurations_blob_name', None) + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + 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 location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo + :param identity: The managed identities for the IotHub. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ArmIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'identity': {'key': 'identity', 'type': 'ArmIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescription, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.properties = kwargs.get('properties', None) + self.sku = kwargs['sku'] + self.identity = kwargs.get('identity', None) + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: The name of the Azure region. + :type location: str + :param role: The role of the region, can be either primary or secondary. The primary region is + where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery + (DR) paired region and also the region where the IoT hub can failover to. Possible values + include: "primary", "secondary". + :type role: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.role = kwargs.get('role', None) + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = kwargs.get('message', None) + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] + :param disable_local_auth: If true, SAS tokens with Iot hub scoped SAS keys cannot be used for + authentication. + :type disable_local_auth: bool + :param disable_device_sas: If true, all device(including Edge devices but excluding modules) + scoped SAS keys cannot be used for authentication. + :type disable_device_sas: bool + :param disable_module_sas: If true, all module scoped SAS keys cannot be used for + authentication. + :type disable_module_sas: bool + :param restrict_outbound_network_access: If true, egress from IotHub will be restricted to only + the allowed FQDNs that are configured via allowedFqdnList. + :type restrict_outbound_network_access: bool + :param allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from + Iot Hub. + :type allowed_fqdn_list: list[str] + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.iothub.v2021_07_01.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2021_07_01.models.IpFilterRule] + :param network_rule_sets: Network Rule Set Properties of IotHub. + :type network_rule_sets: ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetProperties + :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set + to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + :type min_tls_version: str + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2021_07_01.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2021_07_01.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_07_01.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_07_01.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2021_07_01.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2021_07_01.models.Capabilities + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + 'disable_device_sas': {'key': 'disableDeviceSAS', 'type': 'bool'}, + 'disable_module_sas': {'key': 'disableModuleSAS', 'type': 'bool'}, + 'restrict_outbound_network_access': {'key': 'restrictOutboundNetworkAccess', 'type': 'bool'}, + 'allowed_fqdn_list': {'key': 'allowedFqdnList', 'type': '[str]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'network_rule_sets': {'key': 'networkRuleSets', 'type': 'NetworkRuleSetProperties'}, + 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'features': {'key': 'features', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = kwargs.get('authorization_policies', None) + self.disable_local_auth = kwargs.get('disable_local_auth', None) + self.disable_device_sas = kwargs.get('disable_device_sas', None) + self.disable_module_sas = kwargs.get('disable_module_sas', None) + self.restrict_outbound_network_access = kwargs.get('restrict_outbound_network_access', None) + self.allowed_fqdn_list = kwargs.get('allowed_fqdn_list', None) + self.public_network_access = kwargs.get('public_network_access', None) + self.ip_filter_rules = kwargs.get('ip_filter_rules', None) + self.network_rule_sets = kwargs.get('network_rule_sets', None) + self.min_tls_version = kwargs.get('min_tls_version', None) + self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = kwargs.get('event_hub_endpoints', None) + self.routing = kwargs.get('routing', None) + self.storage_endpoints = kwargs.get('storage_endpoints', None) + self.messaging_endpoints = kwargs.get('messaging_endpoints', None) + self.enable_file_upload_notifications = kwargs.get('enable_file_upload_notifications', None) + self.cloud_to_device = kwargs.get('cloud_to_device', None) + self.comments = kwargs.get('comments', None) + self.features = kwargs.get('features', None) + self.locations = None + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + 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 resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2021_07_01.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = kwargs['sku'] + self.capacity = kwargs['capacity'] + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + 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. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = None + self.capacity = kwargs.get('capacity', None) + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2021_07_01.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs['action'] + self.ip_mask = kwargs['ip_mask'] + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2021_07_01.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2021_07_01.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ManagedIdentity(msrest.serialization.Model): + """The properties of the Managed identity. + + :param user_assigned_identity: The user assigned identity. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identity = kwargs.get('user_assigned_identity', None) + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = kwargs.get('lock_duration_as_iso8601', None) + self.ttl_as_iso8601 = kwargs.get('ttl_as_iso8601', None) + self.max_delivery_count = kwargs.get('max_delivery_count', None) + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class NetworkRuleSetIpRule(msrest.serialization.Model): + """IP Rule to be applied as part of Network Rule Set. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. Name of the IP filter rule. + :type filter_name: str + :param action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleIPAction + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetIpRule, self).__init__(**kwargs) + self.filter_name = kwargs['filter_name'] + self.action = kwargs.get('action', "Allow") + self.ip_mask = kwargs['ip_mask'] + + +class NetworkRuleSetProperties(msrest.serialization.Model): + """Network Rule Set Properties of IotHub. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Default Action for Network Rule Set. Possible values include: "Deny", + "Allow". Default value: "Deny". + :type default_action: str or ~azure.mgmt.iothub.v2021_07_01.models.DefaultAction + :param apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also + applied to BuiltIn EventHub EndPoint of IotHub. + :type apply_to_built_in_event_hub_endpoint: bool + :param ip_rules: Required. List of IP Rules. + :type ip_rules: list[~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetIpRule] + """ + + _validation = { + 'apply_to_built_in_event_hub_endpoint': {'required': True}, + 'ip_rules': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'apply_to_built_in_event_hub_endpoint': {'key': 'applyToBuiltInEventHubEndpoint', 'type': 'bool'}, + 'ip_rules': {'key': 'ipRules', 'type': '[NetworkRuleSetIpRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSetProperties, self).__init__(**kwargs) + self.default_action = kwargs.get('default_action', "Deny") + self.apply_to_built_in_event_hub_endpoint = kwargs['apply_to_built_in_event_hub_endpoint'] + self.ip_rules = kwargs['ip_rules'] + + +class Operation(msrest.serialization.Model): + """IoT Hub 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}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2021_07_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = kwargs.get('display', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub 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. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2021_07_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of an IotHub. + + 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 properties: Required. The properties of a private endpoint connection. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs['properties'] + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for an IotHub. + + :param value: The list of available private link resources for an IotHub. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs['status'] + self.description = kwargs['description'] + self.actions_required = kwargs.get('actions_required', None) + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.severity = kwargs.get('severity', None) + self.location = kwargs.get('location', None) + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = kwargs.get('line', None) + self.column = kwargs.get('column', None) + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = kwargs.get('start', None) + self.end = kwargs.get('end', None) + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = kwargs['name'] + self.source = kwargs['source'] + self.condition = kwargs.get('condition', None) + self.endpoint_names = kwargs['endpoint_names'] + self.is_enabled = kwargs['is_enabled'] + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2021_07_01.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2021_07_01.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = kwargs.get('service_bus_queues', None) + self.service_bus_topics = kwargs.get('service_bus_topics', None) + self.event_hubs = kwargs.get('event_hubs', None) + self.storage_containers = kwargs.get('storage_containers', None) + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the event hub endpoint. + :type id: str + :param connection_string: The connection string of the event hub endpoint. + :type connection_string: str + :param endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. + :type endpoint_uri: str + :param entity_path: Event hub name on the event hub namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the event hub endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing event hub endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = kwargs.get('body', None) + self.app_properties = kwargs.get('app_properties', None) + self.system_properties = kwargs.get('system_properties', None) + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2021_07_01.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2021_07_01.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2021_07_01.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + :type enrichments: list[~azure.mgmt.iothub.v2021_07_01.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = kwargs.get('endpoints', None) + self.routes = kwargs.get('routes', None) + self.fallback_route = kwargs.get('fallback_route', None) + self.enrichments = kwargs.get('enrichments', None) + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus queue endpoint. + :type id: str + :param connection_string: The connection string of the service bus queue endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus queue endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus queue endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing service bus queue endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus topic endpoint. + :type id: str + :param connection_string: The connection string of the service bus topic endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus topic endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus topic. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus topic endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing service bus topic endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.entity_path = kwargs.get('entity_path', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the storage container endpoint. + :type id: str + :param connection_string: The connection string of the storage account. + :type connection_string: str + :param endpoint_uri: The url of the storage endpoint. It must include the protocol https://. + :type endpoint_uri: str + :param authentication_type: Method used to authenticate against the storage endpoint. Possible + values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing storage endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2021_07_01.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.connection_string = kwargs.get('connection_string', None) + self.endpoint_uri = kwargs.get('endpoint_uri', None) + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + self.name = kwargs['name'] + self.subscription_id = kwargs.get('subscription_id', None) + self.resource_group = kwargs.get('resource_group', None) + self.container_name = kwargs['container_name'] + self.file_name_format = kwargs.get('file_name_format', None) + self.batch_frequency_in_seconds = kwargs.get('batch_frequency_in_seconds', None) + self.max_chunk_size_in_bytes = kwargs.get('max_chunk_size_in_bytes', None) + self.encoding = kwargs.get('encoding', None) + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: any + :param properties: + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: any + :param reported: Twin desired properties. + :type reported: any + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = kwargs.get('desired', None) + self.reported = kwargs.get('reported', None) + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2021_07_01.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.primary_key = kwargs.get('primary_key', None) + self.secondary_key = kwargs.get('secondary_key', None) + self.rights = kwargs['rights'] + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for file upload. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = kwargs.get('sas_ttl_as_iso8601', None) + self.connection_string = kwargs['connection_string'] + self.container_name = kwargs['container_name'] + self.authentication_type = kwargs.get('authentication_type', None) + self.identity = kwargs.get('identity', None) + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :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(TagsResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DeviceConnectionStateEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = kwargs.get('routing_source', None) + self.message = kwargs.get('message', None) + self.twin = kwargs.get('twin', None) + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2021_07_01.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = kwargs.get('routes', None) + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.route = kwargs['route'] + self.twin = kwargs.get('twin', None) + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2021_07_01.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = kwargs.get('result', None) + self.details = kwargs.get('details', None) + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: list[~azure.mgmt.iothub.v2021_07_01.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = kwargs.get('compilation_errors', None) + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2021_07_01.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) + self.unit = kwargs.get('unit', None) + self.current_value = kwargs.get('current_value', None) + self.limit = kwargs.get('limit', None) + self.name = kwargs.get('name', None) + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py new file mode 100644 index 000000000000..cf884965f372 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/models/_models_py3.py @@ -0,0 +1,3317 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._iot_hub_client_enums import * + + +class ArmIdentity(msrest.serialization.Model): + """ArmIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :param type: The type of identity used for the resource. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the service. Possible values + include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.iothub.v2021_07_01.models.ResourceIdentityType + :param user_assigned_identities: Dictionary of :code:``. + :type user_assigned_identities: dict[str, + ~azure.mgmt.iothub.v2021_07_01.models.ArmUserIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ArmUserIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ArmUserIdentity"]] = None, + **kwargs + ): + super(ArmIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ArmUserIdentity(msrest.serialization.Model): + """ArmUserIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: + :vartype principal_id: str + :ivar client_id: + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ArmUserIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class CertificateBodyDescription(msrest.serialization.Model): + """The JSON-serialized X509 Certificate. + + :param certificate: base-64 representation of the X509 leaf certificate .cer file or just .pem + file content. + :type certificate: str + :param is_verified: True indicates that the certificate will be created in verified state and + proof of possession will not be required. + :type is_verified: bool + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + is_verified: Optional[bool] = None, + **kwargs + ): + super(CertificateBodyDescription, self).__init__(**kwargs) + self.certificate = certificate + self.is_verified = is_verified + + +class CertificateDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificateProperties + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + super(CertificateDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CertificateListDescription(msrest.serialization.Model): + """The JSON-serialized array of Certificate objects. + + :param value: The array of Certificate objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateDescription]'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateDescription"]] = None, + **kwargs + ): + super(CertificateListDescription, self).__init__(**kwargs) + self.value = value + + +class CertificateProperties(msrest.serialization.Model): + """The description of an X509 CA Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :param is_verified: Determines whether certificate has been verified. + :type is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :param certificate: The certificate content. + :type certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + is_verified: Optional[bool] = None, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateProperties, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = is_verified + self.created = None + self.updated = None + self.certificate = certificate + + +class CertificatePropertiesWithNonce(msrest.serialization.Model): + """The description of an X509 CA Certificate including the challenge nonce issued for the Proof-Of-Possession flow. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar subject: The certificate's subject name. + :vartype subject: str + :ivar expiry: The certificate's expiration date and time. + :vartype expiry: ~datetime.datetime + :ivar thumbprint: The certificate's thumbprint. + :vartype thumbprint: str + :ivar is_verified: Determines whether certificate has been verified. + :vartype is_verified: bool + :ivar created: The certificate's create date and time. + :vartype created: ~datetime.datetime + :ivar updated: The certificate's last update date and time. + :vartype updated: ~datetime.datetime + :ivar verification_code: The certificate's verification code that will be used for proof of + possession. + :vartype verification_code: str + :ivar certificate: The certificate content. + :vartype certificate: str + """ + + _validation = { + 'subject': {'readonly': True}, + 'expiry': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'verification_code': {'readonly': True}, + 'certificate': {'readonly': True}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'expiry': {'key': 'expiry', 'type': 'rfc-1123'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'rfc-1123'}, + 'updated': {'key': 'updated', 'type': 'rfc-1123'}, + 'verification_code': {'key': 'verificationCode', 'type': 'str'}, + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePropertiesWithNonce, self).__init__(**kwargs) + self.subject = None + self.expiry = None + self.thumbprint = None + self.is_verified = None + self.created = None + self.updated = None + self.verification_code = None + self.certificate = None + + +class CertificateVerificationDescription(msrest.serialization.Model): + """The JSON-serialized leaf certificate. + + :param certificate: base-64 representation of X509 certificate .cer file or just .pem file + content. + :type certificate: str + """ + + _attribute_map = { + 'certificate': {'key': 'certificate', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate: Optional[str] = None, + **kwargs + ): + super(CertificateVerificationDescription, self).__init__(**kwargs) + self.certificate = certificate + + +class CertificateWithNonceDescription(msrest.serialization.Model): + """The X509 Certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The description of an X509 CA Certificate including the challenge nonce + issued for the Proof-Of-Possession flow. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.CertificatePropertiesWithNonce + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The name of the certificate. + :vartype name: str + :ivar etag: The entity tag. + :vartype etag: str + :ivar type: The resource type. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'etag': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'CertificatePropertiesWithNonce'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["CertificatePropertiesWithNonce"] = None, + **kwargs + ): + super(CertificateWithNonceDescription, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.etag = None + self.type = None + + +class CloudToDeviceProperties(msrest.serialization.Model): + """The IoT hub cloud-to-device messaging properties. + + :param max_delivery_count: The max delivery count for cloud-to-device messages in the device + queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + :param default_ttl_as_iso8601: The default time to live for cloud-to-device messages in the + device queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type default_ttl_as_iso8601: ~datetime.timedelta + :param feedback: The properties of the feedback queue for cloud-to-device messages. + :type feedback: ~azure.mgmt.iothub.v2021_07_01.models.FeedbackProperties + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + 'default_ttl_as_iso8601': {'key': 'defaultTtlAsIso8601', 'type': 'duration'}, + 'feedback': {'key': 'feedback', 'type': 'FeedbackProperties'}, + } + + def __init__( + self, + *, + max_delivery_count: Optional[int] = None, + default_ttl_as_iso8601: Optional[datetime.timedelta] = None, + feedback: Optional["FeedbackProperties"] = None, + **kwargs + ): + super(CloudToDeviceProperties, self).__init__(**kwargs) + self.max_delivery_count = max_delivery_count + self.default_ttl_as_iso8601 = default_ttl_as_iso8601 + self.feedback = feedback + + +class EndpointHealthData(msrest.serialization.Model): + """The health data for an endpoint. + + :param endpoint_id: Id of the endpoint. + :type endpoint_id: str + :param health_status: Health statuses have following meanings. The 'healthy' status shows that + the endpoint is accepting messages as expected. The 'unhealthy' status shows that the endpoint + is not accepting messages as expected and IoT Hub is retrying to send data to this endpoint. + The status of an unhealthy endpoint will be updated to healthy when IoT Hub has established an + eventually consistent state of health. The 'dead' status shows that the endpoint is not + accepting messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub + metrics to identify errors and monitor issues with endpoints. The 'unknown' status shows that + the IoT Hub has not established a connection with the endpoint. No messages have been delivered + to or rejected from this endpoint. Possible values include: "unknown", "healthy", "degraded", + "unhealthy", "dead". + :type health_status: str or ~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthStatus + :param last_known_error: Last error obtained when a message failed to be delivered to iot hub. + :type last_known_error: str + :param last_known_error_time: Time at which the last known error occurred. + :type last_known_error_time: ~datetime.datetime + :param last_successful_send_attempt_time: Last time iot hub successfully sent a message to the + endpoint. + :type last_successful_send_attempt_time: ~datetime.datetime + :param last_send_attempt_time: Last time iot hub tried to send a message to the endpoint. + :type last_send_attempt_time: ~datetime.datetime + """ + + _attribute_map = { + 'endpoint_id': {'key': 'endpointId', 'type': 'str'}, + 'health_status': {'key': 'healthStatus', 'type': 'str'}, + 'last_known_error': {'key': 'lastKnownError', 'type': 'str'}, + 'last_known_error_time': {'key': 'lastKnownErrorTime', 'type': 'rfc-1123'}, + 'last_successful_send_attempt_time': {'key': 'lastSuccessfulSendAttemptTime', 'type': 'rfc-1123'}, + 'last_send_attempt_time': {'key': 'lastSendAttemptTime', 'type': 'rfc-1123'}, + } + + def __init__( + self, + *, + endpoint_id: Optional[str] = None, + health_status: Optional[Union[str, "EndpointHealthStatus"]] = None, + last_known_error: Optional[str] = None, + last_known_error_time: Optional[datetime.datetime] = None, + last_successful_send_attempt_time: Optional[datetime.datetime] = None, + last_send_attempt_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(EndpointHealthData, self).__init__(**kwargs) + self.endpoint_id = endpoint_id + self.health_status = health_status + self.last_known_error = last_known_error + self.last_known_error_time = last_known_error_time + self.last_successful_send_attempt_time = last_successful_send_attempt_time + self.last_send_attempt_time = last_send_attempt_time + + +class EndpointHealthDataListResult(msrest.serialization.Model): + """The JSON-serialized array of EndpointHealthData objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: JSON-serialized array of Endpoint health data. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthData] + :ivar next_link: Link to more results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EndpointHealthData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EndpointHealthData"]] = None, + **kwargs + ): + super(EndpointHealthDataListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EnrichmentProperties(msrest.serialization.Model): + """The properties of an enrichment that your IoT hub applies to messages delivered to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param key: Required. The key or name for the enrichment property. + :type key: str + :param value: Required. The value for the enrichment property. + :type value: str + :param endpoint_names: Required. The list of endpoints for which the enrichment is applied to + the message. + :type endpoint_names: list[str] + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + 'endpoint_names': {'required': True, 'min_items': 1}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + key: str, + value: str, + endpoint_names: List[str], + **kwargs + ): + super(EnrichmentProperties, self).__init__(**kwargs) + self.key = key + self.value = value + self.endpoint_names = endpoint_names + + +class ErrorDetails(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 http_status_code: The HTTP status code. + :vartype http_status_code: str + :ivar message: The error message. + :vartype message: str + :ivar details: The error details. + :vartype details: str + """ + + _validation = { + 'code': {'readonly': True}, + 'http_status_code': {'readonly': True}, + 'message': {'readonly': True}, + 'details': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'http_status_code': {'key': 'httpStatusCode', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetails, self).__init__(**kwargs) + self.code = None + self.http_status_code = None + self.message = None + self.details = None + + +class EventHubConsumerGroupBodyDescription(msrest.serialization.Model): + """The EventHub consumer group. + + All required parameters must be populated in order to send to Azure. + + :param properties: Required. The EventHub consumer group name. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupName + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'EventHubConsumerGroupName'}, + } + + def __init__( + self, + *, + properties: "EventHubConsumerGroupName", + **kwargs + ): + super(EventHubConsumerGroupBodyDescription, self).__init__(**kwargs) + self.properties = properties + + +class EventHubConsumerGroupInfo(msrest.serialization.Model): + """The properties of the EventHubConsumerGroupInfo object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param properties: The tags. + :type properties: dict[str, any] + :ivar id: The Event Hub-compatible consumer group identifier. + :vartype id: str + :ivar name: The Event Hub-compatible consumer group name. + :vartype name: str + :ivar type: the resource type. + :vartype type: str + :ivar etag: The etag. + :vartype etag: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, Any]] = None, + **kwargs + ): + super(EventHubConsumerGroupInfo, self).__init__(**kwargs) + self.properties = properties + self.id = None + self.name = None + self.type = None + self.etag = None + + +class EventHubConsumerGroupName(msrest.serialization.Model): + """The EventHub consumer group name. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. EventHub consumer group name. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(EventHubConsumerGroupName, self).__init__(**kwargs) + self.name = name + + +class EventHubConsumerGroupsListResult(msrest.serialization.Model): + """The JSON-serialized array of Event Hub-compatible consumer group names with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of consumer groups objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[EventHubConsumerGroupInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["EventHubConsumerGroupInfo"]] = None, + **kwargs + ): + super(EventHubConsumerGroupsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class EventHubProperties(msrest.serialization.Model): + """The properties of the provisioned Event Hub-compatible endpoint used by the IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param retention_time_in_days: The retention time for device-to-cloud messages in days. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type retention_time_in_days: long + :param partition_count: The number of partitions for receiving device-to-cloud messages in the + Event Hub-compatible endpoint. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#device-to-cloud-messages. + :type partition_count: int + :ivar partition_ids: The partition ids in the Event Hub-compatible endpoint. + :vartype partition_ids: list[str] + :ivar path: The Event Hub-compatible name. + :vartype path: str + :ivar endpoint: The Event Hub-compatible endpoint. + :vartype endpoint: str + """ + + _validation = { + 'partition_ids': {'readonly': True}, + 'path': {'readonly': True}, + 'endpoint': {'readonly': True}, + } + + _attribute_map = { + 'retention_time_in_days': {'key': 'retentionTimeInDays', 'type': 'long'}, + 'partition_count': {'key': 'partitionCount', 'type': 'int'}, + 'partition_ids': {'key': 'partitionIds', 'type': '[str]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'endpoint': {'key': 'endpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + retention_time_in_days: Optional[int] = None, + partition_count: Optional[int] = None, + **kwargs + ): + super(EventHubProperties, self).__init__(**kwargs) + self.retention_time_in_days = retention_time_in_days + self.partition_count = partition_count + self.partition_ids = None + self.path = None + self.endpoint = None + + +class ExportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an export of all devices in the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param export_blob_container_uri: Required. The export blob container URI. + :type export_blob_container_uri: str + :param exclude_keys: Required. The value indicating whether keys should be excluded during + export. + :type exclude_keys: bool + :param export_blob_name: The name of the blob that will be created in the provided output blob + container. This blob will contain the exported device registry information for the IoT Hub. + :type export_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for export devices. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be exported. + :type include_configurations: bool + :param configurations_blob_name: The name of the blob that will be created in the provided + output blob container. This blob will contain the exported configurations for the Iot Hub. + :type configurations_blob_name: str + """ + + _validation = { + 'export_blob_container_uri': {'required': True}, + 'exclude_keys': {'required': True}, + } + + _attribute_map = { + 'export_blob_container_uri': {'key': 'exportBlobContainerUri', 'type': 'str'}, + 'exclude_keys': {'key': 'excludeKeys', 'type': 'bool'}, + 'export_blob_name': {'key': 'exportBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + *, + export_blob_container_uri: str, + exclude_keys: bool, + export_blob_name: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + include_configurations: Optional[bool] = None, + configurations_blob_name: Optional[str] = None, + **kwargs + ): + super(ExportDevicesRequest, self).__init__(**kwargs) + self.export_blob_container_uri = export_blob_container_uri + self.exclude_keys = exclude_keys + self.export_blob_name = export_blob_name + self.authentication_type = authentication_type + self.identity = identity + self.include_configurations = include_configurations + self.configurations_blob_name = configurations_blob_name + + +class FailoverInput(msrest.serialization.Model): + """Use to provide failover region when requesting manual Failover for a hub. + + All required parameters must be populated in order to send to Azure. + + :param failover_region: Required. Region the hub will be failed over to. + :type failover_region: str + """ + + _validation = { + 'failover_region': {'required': True}, + } + + _attribute_map = { + 'failover_region': {'key': 'failoverRegion', 'type': 'str'}, + } + + def __init__( + self, + *, + failover_region: str, + **kwargs + ): + super(FailoverInput, self).__init__(**kwargs) + self.failover_region = failover_region + + +class FallbackRouteProperties(msrest.serialization.Model): + """The properties of the fallback route. IoT Hub uses these properties when it routes messages to the fallback endpoint. + + All required parameters must be populated in order to send to Azure. + + :param name: The name of the route. The name can only include alphanumeric characters, periods, + underscores, hyphens, has a maximum length of 64 characters, and must be unique. + :type name: str + :param source: Required. The source to which the routing rule is to be applied to. For example, + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource + :param condition: The condition which is evaluated in order to apply the fallback route. If the + condition is not provided it will evaluate to true by default. For grammar, See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which the messages that satisfy the + condition are routed to. Currently only 1 endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether the fallback route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + name: Optional[str] = None, + condition: Optional[str] = None, + **kwargs + ): + super(FallbackRouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class FeedbackProperties(msrest.serialization.Model): + """The properties of the feedback queue for cloud-to-device messages. + + :param lock_duration_as_iso8601: The lock duration for the feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message on the + feedback queue. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging#cloud-to-device-messages. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(FeedbackProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class GroupIdInformation(msrest.serialization.Model): + """The group information for creating a private endpoint on an IotHub. + + 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 properties: Required. The properties for a group information object. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformationProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'GroupIdInformationProperties'}, + } + + def __init__( + self, + *, + properties: "GroupIdInformationProperties", + **kwargs + ): + super(GroupIdInformation, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class GroupIdInformationProperties(msrest.serialization.Model): + """The properties for a group information object. + + :param group_id: The group id. + :type group_id: str + :param required_members: The required members for a specific group id. + :type required_members: list[str] + :param required_zone_names: The required DNS zones for a specific group id. + :type required_zone_names: list[str] + """ + + _attribute_map = { + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(GroupIdInformationProperties, self).__init__(**kwargs) + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names + + +class ImportDevicesRequest(msrest.serialization.Model): + """Use to provide parameters when requesting an import of all devices in the hub. + + All required parameters must be populated in order to send to Azure. + + :param input_blob_container_uri: Required. The input blob container URI. + :type input_blob_container_uri: str + :param output_blob_container_uri: Required. The output blob container URI. + :type output_blob_container_uri: str + :param input_blob_name: The blob name to be used when importing from the provided input blob + container. + :type input_blob_name: str + :param output_blob_name: The blob name to use for storing the status of the import job. + :type output_blob_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for import devices. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param include_configurations: The value indicating whether configurations should be imported. + :type include_configurations: bool + :param configurations_blob_name: The blob name to be used when importing configurations from + the provided input blob container. + :type configurations_blob_name: str + """ + + _validation = { + 'input_blob_container_uri': {'required': True}, + 'output_blob_container_uri': {'required': True}, + } + + _attribute_map = { + 'input_blob_container_uri': {'key': 'inputBlobContainerUri', 'type': 'str'}, + 'output_blob_container_uri': {'key': 'outputBlobContainerUri', 'type': 'str'}, + 'input_blob_name': {'key': 'inputBlobName', 'type': 'str'}, + 'output_blob_name': {'key': 'outputBlobName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'include_configurations': {'key': 'includeConfigurations', 'type': 'bool'}, + 'configurations_blob_name': {'key': 'configurationsBlobName', 'type': 'str'}, + } + + def __init__( + self, + *, + input_blob_container_uri: str, + output_blob_container_uri: str, + input_blob_name: Optional[str] = None, + output_blob_name: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + include_configurations: Optional[bool] = None, + configurations_blob_name: Optional[str] = None, + **kwargs + ): + super(ImportDevicesRequest, self).__init__(**kwargs) + self.input_blob_container_uri = input_blob_container_uri + self.output_blob_container_uri = output_blob_container_uri + self.input_blob_name = input_blob_name + self.output_blob_name = output_blob_name + self.authentication_type = authentication_type + self.identity = identity + self.include_configurations = include_configurations + self.configurations_blob_name = configurations_blob_name + + +class IotHubCapacity(msrest.serialization.Model): + """IoT Hub capacity information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum number of units. + :vartype minimum: long + :ivar maximum: The maximum number of units. + :vartype maximum: long + :ivar default: The default number of units. + :vartype default: long + :ivar scale_type: The type of the scaling enabled. Possible values include: "Automatic", + "Manual", "None". + :vartype scale_type: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubScaleType + """ + + _validation = { + 'minimum': {'readonly': True, 'maximum': 1, 'minimum': 1}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default': {'key': 'default', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class Resource(msrest.serialization.Model): + """The common properties of an Azure resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource identifier. + :vartype id: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :param location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class IotHubDescription(Resource): + """The description of the IoT hub. + + 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 location: Required. The resource location. + :type location: str + :param tags: A set of tags. The resource tags. + :type tags: dict[str, str] + :param etag: The Etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal ETag convention. + :type etag: str + :param properties: IotHub properties. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.IotHubProperties + :param sku: Required. IotHub SKU info. + :type sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo + :param identity: The managed identities for the IotHub. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ArmIdentity + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$'}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IotHubProperties'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'identity': {'key': 'identity', 'type': 'ArmIdentity'}, + } + + def __init__( + self, + *, + location: str, + sku: "IotHubSkuInfo", + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + properties: Optional["IotHubProperties"] = None, + identity: Optional["ArmIdentity"] = None, + **kwargs + ): + super(IotHubDescription, self).__init__(location=location, tags=tags, **kwargs) + self.etag = etag + self.properties = properties + self.sku = sku + self.identity = identity + + +class IotHubDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubDescription objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubDescription"]] = None, + **kwargs + ): + super(IotHubDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubLocationDescription(msrest.serialization.Model): + """Public representation of one of the locations where a resource is provisioned. + + :param location: The name of the Azure region. + :type location: str + :param role: The role of the region, can be either primary or secondary. The primary region is + where the IoT hub is currently provisioned. The secondary region is the Azure disaster recovery + (DR) paired region and also the region where the IoT hub can failover to. Possible values + include: "primary", "secondary". + :type role: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubReplicaRoleType + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'role': {'key': 'role', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + role: Optional[Union[str, "IotHubReplicaRoleType"]] = None, + **kwargs + ): + super(IotHubLocationDescription, self).__init__(**kwargs) + self.location = location + self.role = role + + +class IotHubNameAvailabilityInfo(msrest.serialization.Model): + """The properties indicating whether a given IoT hub name is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: The value which indicates whether the provided name is available. + :vartype name_available: bool + :ivar reason: The reason for unavailability. Possible values include: "Invalid", + "AlreadyExists". + :vartype reason: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubNameUnavailabilityReason + :param message: The detailed reason message. + :type message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + **kwargs + ): + super(IotHubNameAvailabilityInfo, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = message + + +class IotHubProperties(msrest.serialization.Model): + """The properties of an IoT hub. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param authorization_policies: The shared access policies you can use to secure a connection to + the IoT hub. + :type authorization_policies: + list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] + :param disable_local_auth: If true, SAS tokens with Iot hub scoped SAS keys cannot be used for + authentication. + :type disable_local_auth: bool + :param disable_device_sas: If true, all device(including Edge devices but excluding modules) + scoped SAS keys cannot be used for authentication. + :type disable_device_sas: bool + :param disable_module_sas: If true, all module scoped SAS keys cannot be used for + authentication. + :type disable_module_sas: bool + :param restrict_outbound_network_access: If true, egress from IotHub will be restricted to only + the allowed FQDNs that are configured via allowedFqdnList. + :type restrict_outbound_network_access: bool + :param allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from + Iot Hub. + :type allowed_fqdn_list: list[str] + :param public_network_access: Whether requests from Public Network are allowed. Possible values + include: "Enabled", "Disabled". + :type public_network_access: str or ~azure.mgmt.iothub.v2021_07_01.models.PublicNetworkAccess + :param ip_filter_rules: The IP filter rules. + :type ip_filter_rules: list[~azure.mgmt.iothub.v2021_07_01.models.IpFilterRule] + :param network_rule_sets: Network Rule Set Properties of IotHub. + :type network_rule_sets: ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetProperties + :param min_tls_version: Specifies the minimum TLS version to support for this hub. Can be set + to "1.2" to have clients that use a TLS version below 1.2 to be rejected. + :type min_tls_version: str + :param private_endpoint_connections: Private endpoint connections created on this IotHub. + :type private_endpoint_connections: + list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :ivar state: The hub state. + :vartype state: str + :ivar host_name: The name of the host. + :vartype host_name: str + :param event_hub_endpoints: The Event Hub-compatible endpoint properties. The only possible + keys to this dictionary is events. This key has to be present in the dictionary while making + create or update calls for the IoT hub. + :type event_hub_endpoints: dict[str, ~azure.mgmt.iothub.v2021_07_01.models.EventHubProperties] + :param routing: The routing related properties of the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + :type routing: ~azure.mgmt.iothub.v2021_07_01.models.RoutingProperties + :param storage_endpoints: The list of Azure Storage endpoints where you can upload files. + Currently you can configure only one Azure Storage account and that MUST have its key as + $default. Specifying more than one storage account causes an error to be thrown. Not specifying + a value for this property when the enableFileUploadNotifications property is set to True, + causes an error to be thrown. + :type storage_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_07_01.models.StorageEndpointProperties] + :param messaging_endpoints: The messaging endpoint properties for the file upload notification + queue. + :type messaging_endpoints: dict[str, + ~azure.mgmt.iothub.v2021_07_01.models.MessagingEndpointProperties] + :param enable_file_upload_notifications: If True, file upload notifications are enabled. + :type enable_file_upload_notifications: bool + :param cloud_to_device: The IoT hub cloud-to-device messaging properties. + :type cloud_to_device: ~azure.mgmt.iothub.v2021_07_01.models.CloudToDeviceProperties + :param comments: IoT hub comments. + :type comments: str + :param features: The capabilities and features enabled for the IoT hub. Possible values + include: "None", "DeviceManagement". + :type features: str or ~azure.mgmt.iothub.v2021_07_01.models.Capabilities + :ivar locations: Primary and secondary location for iot hub. + :vartype locations: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubLocationDescription] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'state': {'readonly': True}, + 'host_name': {'readonly': True}, + 'locations': {'readonly': True}, + } + + _attribute_map = { + 'authorization_policies': {'key': 'authorizationPolicies', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'disable_local_auth': {'key': 'disableLocalAuth', 'type': 'bool'}, + 'disable_device_sas': {'key': 'disableDeviceSAS', 'type': 'bool'}, + 'disable_module_sas': {'key': 'disableModuleSAS', 'type': 'bool'}, + 'restrict_outbound_network_access': {'key': 'restrictOutboundNetworkAccess', 'type': 'bool'}, + 'allowed_fqdn_list': {'key': 'allowedFqdnList', 'type': '[str]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'ip_filter_rules': {'key': 'ipFilterRules', 'type': '[IpFilterRule]'}, + 'network_rule_sets': {'key': 'networkRuleSets', 'type': 'NetworkRuleSetProperties'}, + 'min_tls_version': {'key': 'minTlsVersion', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'state': {'key': 'state', 'type': 'str'}, + 'host_name': {'key': 'hostName', 'type': 'str'}, + 'event_hub_endpoints': {'key': 'eventHubEndpoints', 'type': '{EventHubProperties}'}, + 'routing': {'key': 'routing', 'type': 'RoutingProperties'}, + 'storage_endpoints': {'key': 'storageEndpoints', 'type': '{StorageEndpointProperties}'}, + 'messaging_endpoints': {'key': 'messagingEndpoints', 'type': '{MessagingEndpointProperties}'}, + 'enable_file_upload_notifications': {'key': 'enableFileUploadNotifications', 'type': 'bool'}, + 'cloud_to_device': {'key': 'cloudToDevice', 'type': 'CloudToDeviceProperties'}, + 'comments': {'key': 'comments', 'type': 'str'}, + 'features': {'key': 'features', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[IotHubLocationDescription]'}, + } + + def __init__( + self, + *, + authorization_policies: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + disable_local_auth: Optional[bool] = None, + disable_device_sas: Optional[bool] = None, + disable_module_sas: Optional[bool] = None, + restrict_outbound_network_access: Optional[bool] = None, + allowed_fqdn_list: Optional[List[str]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + ip_filter_rules: Optional[List["IpFilterRule"]] = None, + network_rule_sets: Optional["NetworkRuleSetProperties"] = None, + min_tls_version: Optional[str] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + event_hub_endpoints: Optional[Dict[str, "EventHubProperties"]] = None, + routing: Optional["RoutingProperties"] = None, + storage_endpoints: Optional[Dict[str, "StorageEndpointProperties"]] = None, + messaging_endpoints: Optional[Dict[str, "MessagingEndpointProperties"]] = None, + enable_file_upload_notifications: Optional[bool] = None, + cloud_to_device: Optional["CloudToDeviceProperties"] = None, + comments: Optional[str] = None, + features: Optional[Union[str, "Capabilities"]] = None, + **kwargs + ): + super(IotHubProperties, self).__init__(**kwargs) + self.authorization_policies = authorization_policies + self.disable_local_auth = disable_local_auth + self.disable_device_sas = disable_device_sas + self.disable_module_sas = disable_module_sas + self.restrict_outbound_network_access = restrict_outbound_network_access + self.allowed_fqdn_list = allowed_fqdn_list + self.public_network_access = public_network_access + self.ip_filter_rules = ip_filter_rules + self.network_rule_sets = network_rule_sets + self.min_tls_version = min_tls_version + self.private_endpoint_connections = private_endpoint_connections + self.provisioning_state = None + self.state = None + self.host_name = None + self.event_hub_endpoints = event_hub_endpoints + self.routing = routing + self.storage_endpoints = storage_endpoints + self.messaging_endpoints = messaging_endpoints + self.enable_file_upload_notifications = enable_file_upload_notifications + self.cloud_to_device = cloud_to_device + self.comments = comments + self.features = features + self.locations = None + + +class IotHubQuotaMetricInfo(msrest.serialization.Model): + """Quota metrics properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of the quota metric. + :vartype name: str + :ivar current_value: The current value for the quota metric. + :vartype current_value: long + :ivar max_value: The maximum value of the quota metric. + :vartype max_value: long + """ + + _validation = { + 'name': {'readonly': True}, + 'current_value': {'readonly': True}, + 'max_value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'long'}, + 'max_value': {'key': 'maxValue', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubQuotaMetricInfo, self).__init__(**kwargs) + self.name = None + self.current_value = None + self.max_value = None + + +class IotHubQuotaMetricInfoListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubQuotaMetricInfo objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of quota metrics objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubQuotaMetricInfo] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubQuotaMetricInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubQuotaMetricInfo"]] = None, + **kwargs + ): + super(IotHubQuotaMetricInfoListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuDescription(msrest.serialization.Model): + """SKU properties. + + 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 resource_type: The type of the resource. + :vartype resource_type: str + :param sku: Required. The type of the resource. + :type sku: ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuInfo + :param capacity: Required. IotHub capacity. + :type capacity: ~azure.mgmt.iothub.v2021_07_01.models.IotHubCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'required': True}, + 'capacity': {'required': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'IotHubSkuInfo'}, + 'capacity': {'key': 'capacity', 'type': 'IotHubCapacity'}, + } + + def __init__( + self, + *, + sku: "IotHubSkuInfo", + capacity: "IotHubCapacity", + **kwargs + ): + super(IotHubSkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.sku = sku + self.capacity = capacity + + +class IotHubSkuDescriptionListResult(msrest.serialization.Model): + """The JSON-serialized array of IotHubSkuDescription objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of IotHubSkuDescription. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuDescription] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[IotHubSkuDescription]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["IotHubSkuDescription"]] = None, + **kwargs + ): + super(IotHubSkuDescriptionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class IotHubSkuInfo(msrest.serialization.Model): + """Information about the SKU of the IoT hub. + + 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. + + :param name: Required. The name of the SKU. Possible values include: "F1", "S1", "S2", "S3", + "B1", "B2", "B3". + :type name: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubSku + :ivar tier: The billing tier for the IoT hub. Possible values include: "Free", "Standard", + "Basic". + :vartype tier: str or ~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuTier + :param capacity: The number of provisioned IoT Hub units. See: + https://docs.microsoft.com/azure/azure-subscription-service-limits#iot-hub-limits. + :type capacity: long + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Union[str, "IotHubSku"], + capacity: Optional[int] = None, + **kwargs + ): + super(IotHubSkuInfo, self).__init__(**kwargs) + self.name = name + self.tier = None + self.capacity = capacity + + +class IpFilterRule(msrest.serialization.Model): + """The IP filter rules for the IoT hub. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. The name of the IP filter rule. + :type filter_name: str + :param action: Required. The desired action for requests captured by this rule. Possible values + include: "Accept", "Reject". + :type action: str or ~azure.mgmt.iothub.v2021_07_01.models.IpFilterActionType + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'action': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + action: Union[str, "IpFilterActionType"], + ip_mask: str, + **kwargs + ): + super(IpFilterRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class JobResponse(msrest.serialization.Model): + """The properties of the Job Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar job_id: The job identifier. + :vartype job_id: str + :ivar start_time_utc: The start time of the job. + :vartype start_time_utc: ~datetime.datetime + :ivar end_time_utc: The time the job stopped processing. + :vartype end_time_utc: ~datetime.datetime + :ivar type: The type of the job. Possible values include: "unknown", "export", "import", + "backup", "readDeviceProperties", "writeDeviceProperties", "updateDeviceConfiguration", + "rebootDevice", "factoryResetDevice", "firmwareUpdate". + :vartype type: str or ~azure.mgmt.iothub.v2021_07_01.models.JobType + :ivar status: The status of the job. Possible values include: "unknown", "enqueued", "running", + "completed", "failed", "cancelled". + :vartype status: str or ~azure.mgmt.iothub.v2021_07_01.models.JobStatus + :ivar failure_reason: If status == failed, this string containing the reason for the failure. + :vartype failure_reason: str + :ivar status_message: The status message for the job. + :vartype status_message: str + :ivar parent_job_id: The job identifier of the parent job, if any. + :vartype parent_job_id: str + """ + + _validation = { + 'job_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'end_time_utc': {'readonly': True}, + 'type': {'readonly': True}, + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'status_message': {'readonly': True}, + 'parent_job_id': {'readonly': True}, + } + + _attribute_map = { + 'job_id': {'key': 'jobId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'rfc-1123'}, + 'end_time_utc': {'key': 'endTimeUtc', 'type': 'rfc-1123'}, + 'type': {'key': 'type', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'parent_job_id': {'key': 'parentJobId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(JobResponse, self).__init__(**kwargs) + self.job_id = None + self.start_time_utc = None + self.end_time_utc = None + self.type = None + self.status = None + self.failure_reason = None + self.status_message = None + self.parent_job_id = None + + +class JobResponseListResult(msrest.serialization.Model): + """The JSON-serialized array of JobResponse objects with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The array of JobResponse objects. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.JobResponse] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JobResponse]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["JobResponse"]] = None, + **kwargs + ): + super(JobResponseListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedIdentity(msrest.serialization.Model): + """The properties of the Managed identity. + + :param user_assigned_identity: The user assigned identity. + :type user_assigned_identity: str + """ + + _attribute_map = { + 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, + } + + def __init__( + self, + *, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identity = user_assigned_identity + + +class MatchedRoute(msrest.serialization.Model): + """Routes that matched. + + :param properties: Properties of routes that matched. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RouteProperties'}, + } + + def __init__( + self, + *, + properties: Optional["RouteProperties"] = None, + **kwargs + ): + super(MatchedRoute, self).__init__(**kwargs) + self.properties = properties + + +class MessagingEndpointProperties(msrest.serialization.Model): + """The properties of the messaging endpoints used by this IoT hub. + + :param lock_duration_as_iso8601: The lock duration. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type lock_duration_as_iso8601: ~datetime.timedelta + :param ttl_as_iso8601: The period of time for which a message is available to consume before it + is expired by the IoT hub. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type ttl_as_iso8601: ~datetime.timedelta + :param max_delivery_count: The number of times the IoT hub attempts to deliver a message. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload. + :type max_delivery_count: int + """ + + _validation = { + 'max_delivery_count': {'maximum': 100, 'minimum': 1}, + } + + _attribute_map = { + 'lock_duration_as_iso8601': {'key': 'lockDurationAsIso8601', 'type': 'duration'}, + 'ttl_as_iso8601': {'key': 'ttlAsIso8601', 'type': 'duration'}, + 'max_delivery_count': {'key': 'maxDeliveryCount', 'type': 'int'}, + } + + def __init__( + self, + *, + lock_duration_as_iso8601: Optional[datetime.timedelta] = None, + ttl_as_iso8601: Optional[datetime.timedelta] = None, + max_delivery_count: Optional[int] = None, + **kwargs + ): + super(MessagingEndpointProperties, self).__init__(**kwargs) + self.lock_duration_as_iso8601 = lock_duration_as_iso8601 + self.ttl_as_iso8601 = ttl_as_iso8601 + self.max_delivery_count = max_delivery_count + + +class Name(msrest.serialization.Model): + """Name of Iot Hub type. + + :param value: IotHub type. + :type value: str + :param localized_value: Localized value of name. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(Name, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class NetworkRuleSetIpRule(msrest.serialization.Model): + """IP Rule to be applied as part of Network Rule Set. + + All required parameters must be populated in order to send to Azure. + + :param filter_name: Required. Name of the IP filter rule. + :type filter_name: str + :param action: IP Filter Action. Possible values include: "Allow". Default value: "Allow". + :type action: str or ~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleIPAction + :param ip_mask: Required. A string that contains the IP address range in CIDR notation for the + rule. + :type ip_mask: str + """ + + _validation = { + 'filter_name': {'required': True}, + 'ip_mask': {'required': True}, + } + + _attribute_map = { + 'filter_name': {'key': 'filterName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + 'ip_mask': {'key': 'ipMask', 'type': 'str'}, + } + + def __init__( + self, + *, + filter_name: str, + ip_mask: str, + action: Optional[Union[str, "NetworkRuleIPAction"]] = "Allow", + **kwargs + ): + super(NetworkRuleSetIpRule, self).__init__(**kwargs) + self.filter_name = filter_name + self.action = action + self.ip_mask = ip_mask + + +class NetworkRuleSetProperties(msrest.serialization.Model): + """Network Rule Set Properties of IotHub. + + All required parameters must be populated in order to send to Azure. + + :param default_action: Default Action for Network Rule Set. Possible values include: "Deny", + "Allow". Default value: "Deny". + :type default_action: str or ~azure.mgmt.iothub.v2021_07_01.models.DefaultAction + :param apply_to_built_in_event_hub_endpoint: Required. If True, then Network Rule Set is also + applied to BuiltIn EventHub EndPoint of IotHub. + :type apply_to_built_in_event_hub_endpoint: bool + :param ip_rules: Required. List of IP Rules. + :type ip_rules: list[~azure.mgmt.iothub.v2021_07_01.models.NetworkRuleSetIpRule] + """ + + _validation = { + 'apply_to_built_in_event_hub_endpoint': {'required': True}, + 'ip_rules': {'required': True}, + } + + _attribute_map = { + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'apply_to_built_in_event_hub_endpoint': {'key': 'applyToBuiltInEventHubEndpoint', 'type': 'bool'}, + 'ip_rules': {'key': 'ipRules', 'type': '[NetworkRuleSetIpRule]'}, + } + + def __init__( + self, + *, + apply_to_built_in_event_hub_endpoint: bool, + ip_rules: List["NetworkRuleSetIpRule"], + default_action: Optional[Union[str, "DefaultAction"]] = "Deny", + **kwargs + ): + super(NetworkRuleSetProperties, self).__init__(**kwargs) + self.default_action = default_action + self.apply_to_built_in_event_hub_endpoint = apply_to_built_in_event_hub_endpoint + self.ip_rules = ip_rules + + +class Operation(msrest.serialization.Model): + """IoT Hub 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}. + :vartype name: str + :param display: The object that represents the operation. + :type display: ~azure.mgmt.iothub.v2021_07_01.models.OperationDisplay + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + } + + def __init__( + self, + *, + display: Optional["OperationDisplay"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = None + self.display = display + + +class OperationDisplay(msrest.serialization.Model): + """The object that represents the operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider: Service provider: Microsoft Devices. + :vartype provider: str + :ivar resource: Resource Type: IotHubs. + :vartype resource: str + :ivar operation: Name of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str + """ + + _validation = { + 'provider': {'readonly': True}, + 'resource': {'readonly': True}, + 'operation': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = None + self.resource = None + self.operation = None + self.description = None + + +class OperationInputs(msrest.serialization.Model): + """Input values. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the IoT hub to check. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(OperationInputs, self).__init__(**kwargs) + self.name = name + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list IoT Hub 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. + + :ivar value: List of IoT Hub operations supported by the Microsoft.Devices resource provider. + :vartype value: list[~azure.mgmt.iothub.v2021_07_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class PrivateEndpoint(msrest.serialization.Model): + """The private endpoint property of a private endpoint connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource identifier. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(msrest.serialization.Model): + """The private endpoint connection of an IotHub. + + 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 properties: Required. The properties of a private endpoint connection. + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnectionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + } + + def __init__( + self, + *, + properties: "PrivateEndpointConnectionProperties", + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """The properties of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param private_endpoint: The private endpoint property of a private endpoint connection. + :type private_endpoint: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpoint + :param private_link_service_connection_state: Required. The current state of a private endpoint + connection. + :type private_link_service_connection_state: + ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionState + """ + + _validation = { + 'private_link_service_connection_state': {'required': True}, + } + + _attribute_map = { + 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + } + + def __init__( + self, + *, + private_link_service_connection_state: "PrivateLinkServiceConnectionState", + private_endpoint: Optional["PrivateEndpoint"] = None, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + + +class PrivateLinkResources(msrest.serialization.Model): + """The available private link resources for an IotHub. + + :param value: The list of available private link resources for an IotHub. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GroupIdInformation]'}, + } + + def __init__( + self, + *, + value: Optional[List["GroupIdInformation"]] = None, + **kwargs + ): + super(PrivateLinkResources, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """The current state of a private endpoint connection. + + All required parameters must be populated in order to send to Azure. + + :param status: Required. The status of a private endpoint connection. Possible values include: + "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkServiceConnectionStatus + :param description: Required. The description for the current state of a private endpoint + connection. + :type description: str + :param actions_required: Actions required for a private endpoint connection. + :type actions_required: str + """ + + _validation = { + 'status': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Union[str, "PrivateLinkServiceConnectionStatus"], + description: str, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class RegistryStatistics(msrest.serialization.Model): + """Identity registry statistics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar total_device_count: The total count of devices in the identity registry. + :vartype total_device_count: long + :ivar enabled_device_count: The count of enabled devices in the identity registry. + :vartype enabled_device_count: long + :ivar disabled_device_count: The count of disabled devices in the identity registry. + :vartype disabled_device_count: long + """ + + _validation = { + 'total_device_count': {'readonly': True}, + 'enabled_device_count': {'readonly': True}, + 'disabled_device_count': {'readonly': True}, + } + + _attribute_map = { + 'total_device_count': {'key': 'totalDeviceCount', 'type': 'long'}, + 'enabled_device_count': {'key': 'enabledDeviceCount', 'type': 'long'}, + 'disabled_device_count': {'key': 'disabledDeviceCount', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistryStatistics, self).__init__(**kwargs) + self.total_device_count = None + self.enabled_device_count = None + self.disabled_device_count = None + + +class RouteCompilationError(msrest.serialization.Model): + """Compilation error when evaluating route. + + :param message: Route error message. + :type message: str + :param severity: Severity of the route error. Possible values include: "error", "warning". + :type severity: str or ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorSeverity + :param location: Location where the route error happened. + :type location: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorRange + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'RouteErrorRange'}, + } + + def __init__( + self, + *, + message: Optional[str] = None, + severity: Optional[Union[str, "RouteErrorSeverity"]] = None, + location: Optional["RouteErrorRange"] = None, + **kwargs + ): + super(RouteCompilationError, self).__init__(**kwargs) + self.message = message + self.severity = severity + self.location = location + + +class RouteErrorPosition(msrest.serialization.Model): + """Position where the route error happened. + + :param line: Line where the route error happened. + :type line: int + :param column: Column where the route error happened. + :type column: int + """ + + _attribute_map = { + 'line': {'key': 'line', 'type': 'int'}, + 'column': {'key': 'column', 'type': 'int'}, + } + + def __init__( + self, + *, + line: Optional[int] = None, + column: Optional[int] = None, + **kwargs + ): + super(RouteErrorPosition, self).__init__(**kwargs) + self.line = line + self.column = column + + +class RouteErrorRange(msrest.serialization.Model): + """Range of route errors. + + :param start: Start where the route error happened. + :type start: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition + :param end: End where the route error happened. + :type end: ~azure.mgmt.iothub.v2021_07_01.models.RouteErrorPosition + """ + + _attribute_map = { + 'start': {'key': 'start', 'type': 'RouteErrorPosition'}, + 'end': {'key': 'end', 'type': 'RouteErrorPosition'}, + } + + def __init__( + self, + *, + start: Optional["RouteErrorPosition"] = None, + end: Optional["RouteErrorPosition"] = None, + **kwargs + ): + super(RouteErrorRange, self).__init__(**kwargs) + self.start = start + self.end = end + + +class RouteProperties(msrest.serialization.Model): + """The properties of a routing rule that your IoT hub uses to route messages to endpoints. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the route. The name can only include alphanumeric + characters, periods, underscores, hyphens, has a maximum length of 64 characters, and must be + unique. + :type name: str + :param source: Required. The source that the routing rule is to be applied to, such as + DeviceMessages. Possible values include: "Invalid", "DeviceMessages", "TwinChangeEvents", + "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", "DeviceConnectionStateEvents". + :type source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource + :param condition: The condition that is evaluated to apply the routing rule. If no condition is + provided, it evaluates to true by default. For grammar, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language. + :type condition: str + :param endpoint_names: Required. The list of endpoints to which messages that satisfy the + condition are routed. Currently only one endpoint is allowed. + :type endpoint_names: list[str] + :param is_enabled: Required. Used to specify whether a route is enabled. + :type is_enabled: bool + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'source': {'required': True}, + 'endpoint_names': {'required': True, 'max_items': 1, 'min_items': 1}, + 'is_enabled': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'condition': {'key': 'condition', 'type': 'str'}, + 'endpoint_names': {'key': 'endpointNames', 'type': '[str]'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + source: Union[str, "RoutingSource"], + endpoint_names: List[str], + is_enabled: bool, + condition: Optional[str] = None, + **kwargs + ): + super(RouteProperties, self).__init__(**kwargs) + self.name = name + self.source = source + self.condition = condition + self.endpoint_names = endpoint_names + self.is_enabled = is_enabled + + +class RoutingEndpoints(msrest.serialization.Model): + """The properties related to the custom endpoints to which your IoT hub routes messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types for free hubs. + + :param service_bus_queues: The list of Service Bus queue endpoints that IoT hub routes the + messages to, based on the routing rules. + :type service_bus_queues: + list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusQueueEndpointProperties] + :param service_bus_topics: The list of Service Bus topic endpoints that the IoT hub routes the + messages to, based on the routing rules. + :type service_bus_topics: + list[~azure.mgmt.iothub.v2021_07_01.models.RoutingServiceBusTopicEndpointProperties] + :param event_hubs: The list of Event Hubs endpoints that IoT hub routes messages to, based on + the routing rules. This list does not include the built-in Event Hubs endpoint. + :type event_hubs: list[~azure.mgmt.iothub.v2021_07_01.models.RoutingEventHubProperties] + :param storage_containers: The list of storage container endpoints that IoT hub routes messages + to, based on the routing rules. + :type storage_containers: + list[~azure.mgmt.iothub.v2021_07_01.models.RoutingStorageContainerProperties] + """ + + _attribute_map = { + 'service_bus_queues': {'key': 'serviceBusQueues', 'type': '[RoutingServiceBusQueueEndpointProperties]'}, + 'service_bus_topics': {'key': 'serviceBusTopics', 'type': '[RoutingServiceBusTopicEndpointProperties]'}, + 'event_hubs': {'key': 'eventHubs', 'type': '[RoutingEventHubProperties]'}, + 'storage_containers': {'key': 'storageContainers', 'type': '[RoutingStorageContainerProperties]'}, + } + + def __init__( + self, + *, + service_bus_queues: Optional[List["RoutingServiceBusQueueEndpointProperties"]] = None, + service_bus_topics: Optional[List["RoutingServiceBusTopicEndpointProperties"]] = None, + event_hubs: Optional[List["RoutingEventHubProperties"]] = None, + storage_containers: Optional[List["RoutingStorageContainerProperties"]] = None, + **kwargs + ): + super(RoutingEndpoints, self).__init__(**kwargs) + self.service_bus_queues = service_bus_queues + self.service_bus_topics = service_bus_topics + self.event_hubs = event_hubs + self.storage_containers = storage_containers + + +class RoutingEventHubProperties(msrest.serialization.Model): + """The properties related to an event hub endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the event hub endpoint. + :type id: str + :param connection_string: The connection string of the event hub endpoint. + :type connection_string: str + :param endpoint_uri: The url of the event hub endpoint. It must include the protocol sb://. + :type endpoint_uri: str + :param entity_path: Event hub name on the event hub namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the event hub endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing event hub endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the event hub endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the event hub endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingEventHubProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingMessage(msrest.serialization.Model): + """Routing message. + + :param body: Body of routing message. + :type body: str + :param app_properties: App properties. + :type app_properties: dict[str, str] + :param system_properties: System properties. + :type system_properties: dict[str, str] + """ + + _attribute_map = { + 'body': {'key': 'body', 'type': 'str'}, + 'app_properties': {'key': 'appProperties', 'type': '{str}'}, + 'system_properties': {'key': 'systemProperties', 'type': '{str}'}, + } + + def __init__( + self, + *, + body: Optional[str] = None, + app_properties: Optional[Dict[str, str]] = None, + system_properties: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RoutingMessage, self).__init__(**kwargs) + self.body = body + self.app_properties = app_properties + self.system_properties = system_properties + + +class RoutingProperties(msrest.serialization.Model): + """The routing related properties of the IoT hub. See: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-messaging. + + :param endpoints: The properties related to the custom endpoints to which your IoT hub routes + messages based on the routing rules. A maximum of 10 custom endpoints are allowed across all + endpoint types for paid hubs and only 1 custom endpoint is allowed across all endpoint types + for free hubs. + :type endpoints: ~azure.mgmt.iothub.v2021_07_01.models.RoutingEndpoints + :param routes: The list of user-provided routing rules that the IoT hub uses to route messages + to built-in and custom endpoints. A maximum of 100 routing rules are allowed for paid hubs and + a maximum of 5 routing rules are allowed for free hubs. + :type routes: list[~azure.mgmt.iothub.v2021_07_01.models.RouteProperties] + :param fallback_route: The properties of the route that is used as a fall-back route when none + of the conditions specified in the 'routes' section are met. This is an optional parameter. + When this property is not set, the messages which do not meet any of the conditions specified + in the 'routes' section get routed to the built-in eventhub endpoint. + :type fallback_route: ~azure.mgmt.iothub.v2021_07_01.models.FallbackRouteProperties + :param enrichments: The list of user-provided enrichments that the IoT hub applies to messages + to be delivered to built-in and custom endpoints. See: https://aka.ms/telemetryoneventgrid. + :type enrichments: list[~azure.mgmt.iothub.v2021_07_01.models.EnrichmentProperties] + """ + + _attribute_map = { + 'endpoints': {'key': 'endpoints', 'type': 'RoutingEndpoints'}, + 'routes': {'key': 'routes', 'type': '[RouteProperties]'}, + 'fallback_route': {'key': 'fallbackRoute', 'type': 'FallbackRouteProperties'}, + 'enrichments': {'key': 'enrichments', 'type': '[EnrichmentProperties]'}, + } + + def __init__( + self, + *, + endpoints: Optional["RoutingEndpoints"] = None, + routes: Optional[List["RouteProperties"]] = None, + fallback_route: Optional["FallbackRouteProperties"] = None, + enrichments: Optional[List["EnrichmentProperties"]] = None, + **kwargs + ): + super(RoutingProperties, self).__init__(**kwargs) + self.endpoints = endpoints + self.routes = routes + self.fallback_route = fallback_route + self.enrichments = enrichments + + +class RoutingServiceBusQueueEndpointProperties(msrest.serialization.Model): + """The properties related to service bus queue endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus queue endpoint. + :type id: str + :param connection_string: The connection string of the service bus queue endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus queue endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus namespace. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus queue endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing service bus queue endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual queue + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus queue endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus queue endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusQueueEndpointProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingServiceBusTopicEndpointProperties(msrest.serialization.Model): + """The properties related to service bus topic endpoint types. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the service bus topic endpoint. + :type id: str + :param connection_string: The connection string of the service bus topic endpoint. + :type connection_string: str + :param endpoint_uri: The url of the service bus topic endpoint. It must include the protocol + sb://. + :type endpoint_uri: str + :param entity_path: Queue name on the service bus topic. + :type entity_path: str + :param authentication_type: Method used to authenticate against the service bus topic endpoint. + Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing service bus topic endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. The name need not be the same as the actual topic + name. + :type name: str + :param subscription_id: The subscription identifier of the service bus topic endpoint. + :type subscription_id: str + :param resource_group: The name of the resource group of the service bus topic endpoint. + :type resource_group: str + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'entity_path': {'key': 'entityPath', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + entity_path: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + **kwargs + ): + super(RoutingServiceBusTopicEndpointProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.entity_path = entity_path + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + + +class RoutingStorageContainerProperties(msrest.serialization.Model): + """The properties related to a storage container endpoint. + + All required parameters must be populated in order to send to Azure. + + :param id: Id of the storage container endpoint. + :type id: str + :param connection_string: The connection string of the storage account. + :type connection_string: str + :param endpoint_uri: The url of the storage endpoint. It must include the protocol https://. + :type endpoint_uri: str + :param authentication_type: Method used to authenticate against the storage endpoint. Possible + values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of routing storage endpoint. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + :param name: Required. The name that identifies this endpoint. The name can only include + alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 + characters. The following names are reserved: events, fileNotifications, $default. Endpoint + names must be unique across endpoint types. + :type name: str + :param subscription_id: The subscription identifier of the storage account. + :type subscription_id: str + :param resource_group: The name of the resource group of the storage account. + :type resource_group: str + :param container_name: Required. The name of storage container in the storage account. + :type container_name: str + :param file_name_format: File name format for the blob. Default format is + {iothub}/{partition}/{YYYY}/{MM}/{DD}/{HH}/{mm}. All parameters are mandatory but can be + reordered. + :type file_name_format: str + :param batch_frequency_in_seconds: Time interval at which blobs are written to storage. Value + should be between 60 and 720 seconds. Default value is 300 seconds. + :type batch_frequency_in_seconds: int + :param max_chunk_size_in_bytes: Maximum number of bytes for each blob written to storage. Value + should be between 10485760(10MB) and 524288000(500MB). Default value is 314572800(300MB). + :type max_chunk_size_in_bytes: int + :param encoding: Encoding that is used to serialize messages to blobs. Supported values are + 'avro', 'avrodeflate', and 'JSON'. Default value is 'avro'. Possible values include: "Avro", + "AvroDeflate", "JSON". + :type encoding: str or + ~azure.mgmt.iothub.v2021_07_01.models.RoutingStorageContainerPropertiesEncoding + """ + + _validation = { + 'name': {'required': True, 'pattern': r'^[A-Za-z0-9-._]{1,64}$'}, + 'container_name': {'required': True}, + 'batch_frequency_in_seconds': {'maximum': 720, 'minimum': 60}, + 'max_chunk_size_in_bytes': {'maximum': 524288000, 'minimum': 10485760}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'endpoint_uri': {'key': 'endpointUri', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'file_name_format': {'key': 'fileNameFormat', 'type': 'str'}, + 'batch_frequency_in_seconds': {'key': 'batchFrequencyInSeconds', 'type': 'int'}, + 'max_chunk_size_in_bytes': {'key': 'maxChunkSizeInBytes', 'type': 'int'}, + 'encoding': {'key': 'encoding', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + container_name: str, + id: Optional[str] = None, + connection_string: Optional[str] = None, + endpoint_uri: Optional[str] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + subscription_id: Optional[str] = None, + resource_group: Optional[str] = None, + file_name_format: Optional[str] = None, + batch_frequency_in_seconds: Optional[int] = None, + max_chunk_size_in_bytes: Optional[int] = None, + encoding: Optional[Union[str, "RoutingStorageContainerPropertiesEncoding"]] = None, + **kwargs + ): + super(RoutingStorageContainerProperties, self).__init__(**kwargs) + self.id = id + self.connection_string = connection_string + self.endpoint_uri = endpoint_uri + self.authentication_type = authentication_type + self.identity = identity + self.name = name + self.subscription_id = subscription_id + self.resource_group = resource_group + self.container_name = container_name + self.file_name_format = file_name_format + self.batch_frequency_in_seconds = batch_frequency_in_seconds + self.max_chunk_size_in_bytes = max_chunk_size_in_bytes + self.encoding = encoding + + +class RoutingTwin(msrest.serialization.Model): + """Twin reference input parameter. This is an optional parameter. + + :param tags: A set of tags. Twin Tags. + :type tags: any + :param properties: + :type properties: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwinProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + 'properties': {'key': 'properties', 'type': 'RoutingTwinProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Any] = None, + properties: Optional["RoutingTwinProperties"] = None, + **kwargs + ): + super(RoutingTwin, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class RoutingTwinProperties(msrest.serialization.Model): + """RoutingTwinProperties. + + :param desired: Twin desired properties. + :type desired: any + :param reported: Twin desired properties. + :type reported: any + """ + + _attribute_map = { + 'desired': {'key': 'desired', 'type': 'object'}, + 'reported': {'key': 'reported', 'type': 'object'}, + } + + def __init__( + self, + *, + desired: Optional[Any] = None, + reported: Optional[Any] = None, + **kwargs + ): + super(RoutingTwinProperties, self).__init__(**kwargs) + self.desired = desired + self.reported = reported + + +class SharedAccessSignatureAuthorizationRule(msrest.serialization.Model): + """The properties of an IoT hub shared access policy. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the shared access policy. + :type key_name: str + :param primary_key: The primary key. + :type primary_key: str + :param secondary_key: The secondary key. + :type secondary_key: str + :param rights: Required. The permissions assigned to the shared access policy. Possible values + include: "RegistryRead", "RegistryWrite", "ServiceConnect", "DeviceConnect", "RegistryRead, + RegistryWrite", "RegistryRead, ServiceConnect", "RegistryRead, DeviceConnect", "RegistryWrite, + ServiceConnect", "RegistryWrite, DeviceConnect", "ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect", "RegistryRead, RegistryWrite, DeviceConnect", + "RegistryRead, ServiceConnect, DeviceConnect", "RegistryWrite, ServiceConnect, DeviceConnect", + "RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect". + :type rights: str or ~azure.mgmt.iothub.v2021_07_01.models.AccessRights + """ + + _validation = { + 'key_name': {'required': True}, + 'rights': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'rights': {'key': 'rights', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + rights: Union[str, "AccessRights"], + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRule, self).__init__(**kwargs) + self.key_name = key_name + self.primary_key = primary_key + self.secondary_key = secondary_key + self.rights = rights + + +class SharedAccessSignatureAuthorizationRuleListResult(msrest.serialization.Model): + """The list of shared access policies with a next link. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of shared access policies. + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule] + :ivar next_link: The next link. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SharedAccessSignatureAuthorizationRule]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SharedAccessSignatureAuthorizationRule"]] = None, + **kwargs + ): + super(SharedAccessSignatureAuthorizationRuleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class StorageEndpointProperties(msrest.serialization.Model): + """The properties of the Azure Storage endpoint for file upload. + + All required parameters must be populated in order to send to Azure. + + :param sas_ttl_as_iso8601: The period of time for which the SAS URI generated by IoT Hub for + file upload is valid. See: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. + :type sas_ttl_as_iso8601: ~datetime.timedelta + :param connection_string: Required. The connection string for the Azure Storage account to + which files are uploaded. + :type connection_string: str + :param container_name: Required. The name of the root container where you upload files. The + container need not exist but should be creatable using the connectionString specified. + :type container_name: str + :param authentication_type: Specifies authentication type being used for connecting to the + storage account. Possible values include: "keyBased", "identityBased". + :type authentication_type: str or ~azure.mgmt.iothub.v2021_07_01.models.AuthenticationType + :param identity: Managed identity properties of storage endpoint for file upload. + :type identity: ~azure.mgmt.iothub.v2021_07_01.models.ManagedIdentity + """ + + _validation = { + 'connection_string': {'required': True}, + 'container_name': {'required': True}, + } + + _attribute_map = { + 'sas_ttl_as_iso8601': {'key': 'sasTtlAsIso8601', 'type': 'duration'}, + 'connection_string': {'key': 'connectionString', 'type': 'str'}, + 'container_name': {'key': 'containerName', 'type': 'str'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + } + + def __init__( + self, + *, + connection_string: str, + container_name: str, + sas_ttl_as_iso8601: Optional[datetime.timedelta] = None, + authentication_type: Optional[Union[str, "AuthenticationType"]] = None, + identity: Optional["ManagedIdentity"] = None, + **kwargs + ): + super(StorageEndpointProperties, self).__init__(**kwargs) + self.sas_ttl_as_iso8601 = sas_ttl_as_iso8601 + self.connection_string = connection_string + self.container_name = container_name + self.authentication_type = authentication_type + self.identity = identity + + +class TagsResource(msrest.serialization.Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on an IoT Hub instance. + + :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(TagsResource, self).__init__(**kwargs) + self.tags = tags + + +class TestAllRoutesInput(msrest.serialization.Model): + """Input for testing all routes. + + :param routing_source: Routing source. Possible values include: "Invalid", "DeviceMessages", + "TwinChangeEvents", "DeviceLifecycleEvents", "DeviceJobLifecycleEvents", + "DeviceConnectionStateEvents". + :type routing_source: str or ~azure.mgmt.iothub.v2021_07_01.models.RoutingSource + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwin + """ + + _attribute_map = { + 'routing_source': {'key': 'routingSource', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + routing_source: Optional[Union[str, "RoutingSource"]] = None, + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestAllRoutesInput, self).__init__(**kwargs) + self.routing_source = routing_source + self.message = message + self.twin = twin + + +class TestAllRoutesResult(msrest.serialization.Model): + """Result of testing all routes. + + :param routes: JSON-serialized array of matched routes. + :type routes: list[~azure.mgmt.iothub.v2021_07_01.models.MatchedRoute] + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': '[MatchedRoute]'}, + } + + def __init__( + self, + *, + routes: Optional[List["MatchedRoute"]] = None, + **kwargs + ): + super(TestAllRoutesResult, self).__init__(**kwargs) + self.routes = routes + + +class TestRouteInput(msrest.serialization.Model): + """Input for testing route. + + All required parameters must be populated in order to send to Azure. + + :param message: Routing message. + :type message: ~azure.mgmt.iothub.v2021_07_01.models.RoutingMessage + :param route: Required. Route properties. + :type route: ~azure.mgmt.iothub.v2021_07_01.models.RouteProperties + :param twin: Routing Twin Reference. + :type twin: ~azure.mgmt.iothub.v2021_07_01.models.RoutingTwin + """ + + _validation = { + 'route': {'required': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'RoutingMessage'}, + 'route': {'key': 'route', 'type': 'RouteProperties'}, + 'twin': {'key': 'twin', 'type': 'RoutingTwin'}, + } + + def __init__( + self, + *, + route: "RouteProperties", + message: Optional["RoutingMessage"] = None, + twin: Optional["RoutingTwin"] = None, + **kwargs + ): + super(TestRouteInput, self).__init__(**kwargs) + self.message = message + self.route = route + self.twin = twin + + +class TestRouteResult(msrest.serialization.Model): + """Result of testing one route. + + :param result: Result of testing route. Possible values include: "undefined", "false", "true". + :type result: str or ~azure.mgmt.iothub.v2021_07_01.models.TestResultStatus + :param details: Detailed result of testing route. + :type details: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResultDetails + """ + + _attribute_map = { + 'result': {'key': 'result', 'type': 'str'}, + 'details': {'key': 'details', 'type': 'TestRouteResultDetails'}, + } + + def __init__( + self, + *, + result: Optional[Union[str, "TestResultStatus"]] = None, + details: Optional["TestRouteResultDetails"] = None, + **kwargs + ): + super(TestRouteResult, self).__init__(**kwargs) + self.result = result + self.details = details + + +class TestRouteResultDetails(msrest.serialization.Model): + """Detailed result of testing a route. + + :param compilation_errors: JSON-serialized list of route compilation errors. + :type compilation_errors: list[~azure.mgmt.iothub.v2021_07_01.models.RouteCompilationError] + """ + + _attribute_map = { + 'compilation_errors': {'key': 'compilationErrors', 'type': '[RouteCompilationError]'}, + } + + def __init__( + self, + *, + compilation_errors: Optional[List["RouteCompilationError"]] = None, + **kwargs + ): + super(TestRouteResultDetails, self).__init__(**kwargs) + self.compilation_errors = compilation_errors + + +class UserSubscriptionQuota(msrest.serialization.Model): + """User subscription quota response. + + :param id: IotHub type id. + :type id: str + :param type: Response type. + :type type: str + :param unit: Unit of IotHub type. + :type unit: str + :param current_value: Current number of IotHub type. + :type current_value: int + :param limit: Numerical limit on IotHub type. + :type limit: int + :param name: IotHub type. + :type name: ~azure.mgmt.iothub.v2021_07_01.models.Name + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'Name'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + type: Optional[str] = None, + unit: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + name: Optional["Name"] = None, + **kwargs + ): + super(UserSubscriptionQuota, self).__init__(**kwargs) + self.id = id + self.type = type + self.unit = unit + self.current_value = current_value + self.limit = limit + self.name = name + + +class UserSubscriptionQuotaListResult(msrest.serialization.Model): + """Json-serialized array of User subscription quota response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: + :type value: list[~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuota] + :ivar next_link: + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSubscriptionQuota]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserSubscriptionQuota"]] = None, + **kwargs + ): + super(UserSubscriptionQuotaListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py new file mode 100644 index 000000000000..3930a2f261c8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/__init__.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._iot_hub_resource_operations import IotHubResourceOperations +from ._resource_provider_common_operations import ResourceProviderCommonOperations +from ._certificates_operations import CertificatesOperations +from ._iot_hub_operations import IotHubOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations + +__all__ = [ + 'Operations', + 'IotHubResourceOperations', + 'ResourceProviderCommonOperations', + 'CertificatesOperations', + 'IotHubOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', +] diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py new file mode 100644 index 000000000000..cb70d45419e0 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_certificates_operations.py @@ -0,0 +1,474 @@ +# 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.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, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations(object): + """CertificatesOperations 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.iothub.v2021_07_01.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_hub( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateListDescription" + """Get the certificate list. + + Returns the list of certificates. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateListDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateListDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateListDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.list_by_iot_hub.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('CertificateListDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_iot_hub.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Get the certificate. + + Returns the certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + certificate_description, # type: "_models.CertificateDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Upload the certificate to the IoT hub. + + Adds new or replaces existing certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_description: The certificate body. + :type certificate_description: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :param if_match: ETag of the Certificate. Do not specify for creating a brand new certificate. + Required to update an existing certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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(certificate_description, 'CertificateDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an X509 certificate. + + Deletes an existing X509 certificate or does nothing if it does not exist. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-07-01" + accept = "application/json" + + # Construct URL + url = self.delete.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}'} # type: ignore + + def generate_verification_code( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateWithNonceDescription" + """Generate verification code for proof of possession flow. + + Generates verification code for proof of possession flow. The verification code will be used to + generate a leaf certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateWithNonceDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateWithNonceDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateWithNonceDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.generate_verification_code.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(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('CertificateWithNonceDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_verification_code.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/generateVerificationCode'} # type: ignore + + def verify( + self, + resource_group_name, # type: str + resource_name, # type: str + certificate_name, # type: str + if_match, # type: str + certificate_verification_body, # type: "_models.CertificateVerificationDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateDescription" + """Verify certificate's private key possession. + + Verifies the certificate's private key possession by providing the leaf cert issued by the + verifying pre uploaded certificate. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param if_match: ETag of the Certificate. + :type if_match: str + :param certificate_verification_body: The name of the certificate. + :type certificate_verification_body: ~azure.mgmt.iothub.v2021_07_01.models.CertificateVerificationDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.CertificateDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.verify.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[A-Za-z0-9-._]{1,64}$'), + } + 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['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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(certificate_verification_body, 'CertificateVerificationDescription') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + verify.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/certificates/{certificateName}/verify'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py new file mode 100644 index 000000000000..0c1633b87c2a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_operations.py @@ -0,0 +1,173 @@ +# 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 IotHubOperations(object): + """IotHubOperations 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.iothub.v2021_07_01.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 _manual_failover_initial( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **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-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._manual_failover_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(failover_input, 'FailoverInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 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 cls: + return cls(pipeline_response, None, {}) + + _manual_failover_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore + + def begin_manual_failover( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + failover_input, # type: "_models.FailoverInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Manually initiate a failover for the IoT Hub to its secondary region. + + Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see + https://aka.ms/manualfailover. + + :param iot_hub_name: Name of the IoT hub to failover. + :type iot_hub_name: str + :param resource_group_name: Name of the resource group containing the IoT hub resource. + :type resource_group_name: str + :param failover_input: Region to failover to. Must be the Azure paired region. Get the value + from the secondary location in the locations property. To learn more, see + https://aka.ms/manualfailover/region. + :type failover_input: ~azure.mgmt.iothub.v2021_07_01.models.FailoverInput + :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._manual_failover_initial( + iot_hub_name=iot_hub_name, + resource_group_name=resource_group_name, + failover_input=failover_input, + 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 = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + + 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_manual_failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py new file mode 100644 index 000000000000..21d82dbf997a --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_iot_hub_resource_operations.py @@ -0,0 +1,1887 @@ +# 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 IotHubResourceOperations(object): + """IotHubResourceOperations 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.iothub.v2021_07_01.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 + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + """Get the non-security related metadata of an IoT hub. + + Get the non-security related metadata of an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubDescription, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + 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_hub_description, 'IotHubDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_description, # type: "_models.IotHubDescription" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Create or update the metadata of an IoT hub. + + Create or update the metadata of an Iot hub. The usual pattern to modify a property is to + retrieve the IoT hub metadata and security metadata, and then combine them with the modified + values in a new body to update the IoT hub. If certain properties are missing in the JSON, + updating IoT Hub may cause these values to fallback to default, which may lead to unexpected + behavior. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param iot_hub_description: The IoT hub metadata and security metadata. + :type iot_hub_description: ~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription + :param if_match: ETag of the IoT Hub. Do not specify for creating a brand new IoT Hub. Required + to update an existing IoT Hub. + :type if_match: 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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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, + resource_name=resource_name, + iot_hub_description=iot_hub_description, + if_match=if_match, + 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('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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.Devices/IotHubs/{resourceName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubDescription" + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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_hub_tags, 'TagsResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + iot_hub_tags, # type: "_models.TagsResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.IotHubDescription"] + """Update an existing IoT Hubs tags. + + Update an existing IoT Hub tags. to update other fields use the CreateOrUpdate method. + + :param resource_group_name: Resource group identifier. + :type resource_group_name: str + :param resource_name: Name of iot hub to update. + :type resource_name: str + :param iot_hub_tags: Updated tag information to set into the iot hub instance. + :type iot_hub_tags: ~azure.mgmt.iothub.v2021_07_01.models.TagsResource + :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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescription"] + 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, + resource_name=resource_name, + iot_hub_tags=iot_hub_tags, + 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('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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.Devices/IotHubs/{resourceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[Union["_models.IotHubDescription", "_models.ErrorDetails"]]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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, 404]: + 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 = None + if response.status_code == 200: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if response.status_code == 404: + deserialized = self._deserialize('ErrorDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + """Delete an IoT hub. + + Delete an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 IotHubDescription or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[Union["_models.IotHubDescription", "_models.ErrorDetails"]] + 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, + resource_name=resource_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): + deserialized = self._deserialize('IotHubDescription', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + + 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.Devices/IotHubs/{resourceName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a subscription. + + Get all the IoT hubs in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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('IotHubDescriptionListResult', 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.Devices/IotHubs'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubDescriptionListResult"] + """Get all the IoT hubs in a resource group. + + Get all the IoT hubs in a resource group. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :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 IotHubDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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'), + } + 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('IotHubDescriptionListResult', 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.Devices/IotHubs'} # type: ignore + + def get_stats( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistryStatistics" + """Get the statistics from an IoT hub. + + Get the statistics from an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistryStatistics, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.RegistryStatistics + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistryStatistics"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_stats.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('RegistryStatistics', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stats.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'} # type: ignore + + def get_valid_skus( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubSkuDescriptionListResult"] + """Get the list of valid SKUs for an IoT hub. + + Get the list of valid SKUs for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubSkuDescriptionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubSkuDescriptionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubSkuDescriptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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.get_valid_skus.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('IotHubSkuDescriptionListResult', 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 + ) + get_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/skus'} # type: ignore + + def list_event_hub_consumer_groups( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EventHubConsumerGroupsListResult"] + """Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an IoT hub. + + Get a list of the consumer groups in the Event Hub-compatible device-to-cloud endpoint in an + IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint. + :type event_hub_endpoint_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EventHubConsumerGroupsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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_event_hub_consumer_groups.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('EventHubConsumerGroupsListResult', 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_event_hub_consumer_groups.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'} # type: ignore + + def get_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + Get a consumer group from the Event Hub-compatible device-to-cloud endpoint for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to retrieve. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_event_hub_consumer_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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def create_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + consumer_group_body, # type: "_models.EventHubConsumerGroupBodyDescription" + **kwargs # type: Any + ): + # type: (...) -> "_models.EventHubConsumerGroupInfo" + """Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to add. + :type name: str + :param consumer_group_body: The consumer group to add. + :type consumer_group_body: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupBodyDescription + :keyword callable cls: A custom type or function that will be passed the direct response + :return: EventHubConsumerGroupInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.EventHubConsumerGroupInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EventHubConsumerGroupInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_event_hub_consumer_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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(consumer_group_body, 'EventHubConsumerGroupBodyDescription') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('EventHubConsumerGroupInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def delete_event_hub_consumer_group( + self, + resource_group_name, # type: str + resource_name, # type: str + event_hub_endpoint_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + Delete a consumer group from an Event Hub-compatible endpoint in an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param event_hub_endpoint_name: The name of the Event Hub-compatible endpoint in the IoT hub. + :type event_hub_endpoint_name: str + :param name: The name of the consumer group to delete. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-07-01" + accept = "application/json" + + # Construct URL + url = self.delete_event_hub_consumer_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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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]: + 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 cls: + return cls(pipeline_response, None, {}) + + delete_event_hub_consumer_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'} # type: ignore + + def list_jobs( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.JobResponseListResult"] + """Get a list of all the jobs in an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get a list of all the jobs in an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either JobResponseListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.JobResponseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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_jobs.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('JobResponseListResult', 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_jobs.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs'} # type: ignore + + def get_job( + self, + resource_group_name, # type: str + resource_name, # type: str + job_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + Get the details of a job from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param job_id: The job identifier. + :type job_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_job.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'jobId': self._serialize.url("job_id", job_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_job.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'} # type: ignore + + def get_quota_metrics( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IotHubQuotaMetricInfoListResult"] + """Get the quota metrics for an IoT hub. + + Get the quota metrics for an IoT hub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IotHubQuotaMetricInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.IotHubQuotaMetricInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubQuotaMetricInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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.get_quota_metrics.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('IotHubQuotaMetricInfoListResult', 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 + ) + get_quota_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/quotaMetrics'} # type: ignore + + def get_endpoint_health( + self, + resource_group_name, # type: str + iot_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.EndpointHealthDataListResult"] + """Get the health for routing endpoints. + + Get the health for routing endpoints. + + :param resource_group_name: + :type resource_group_name: str + :param iot_hub_name: + :type iot_hub_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either EndpointHealthDataListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.EndpointHealthDataListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.EndpointHealthDataListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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.get_endpoint_health.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'), + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + 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('EndpointHealthDataListResult', 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 + ) + get_endpoint_health.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routingEndpointsHealth'} # type: ignore + + def check_name_availability( + self, + operation_inputs, # type: "_models.OperationInputs" + **kwargs # type: Any + ): + # type: (...) -> "_models.IotHubNameAvailabilityInfo" + """Check if an IoT hub name is available. + + Check if an IoT hub name is available. + + :param operation_inputs: Set the name parameter in the OperationInputs structure to the name of + the IoT hub to check. + :type operation_inputs: ~azure.mgmt.iothub.v2021_07_01.models.OperationInputs + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IotHubNameAvailabilityInfo, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.IotHubNameAvailabilityInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IotHubNameAvailabilityInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(operation_inputs, 'OperationInputs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IotHubNameAvailabilityInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'} # type: ignore + + def test_all_routes( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestAllRoutesInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestAllRoutesResult" + """Test all routes. + + Test all routes configured in this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Input for testing all routes. + :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestAllRoutesResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestAllRoutesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestAllRoutesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_all_routes.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(input, 'TestAllRoutesInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestAllRoutesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_all_routes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testall'} # type: ignore + + def test_route( + self, + iot_hub_name, # type: str + resource_group_name, # type: str + input, # type: "_models.TestRouteInput" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestRouteResult" + """Test the new route. + + Test the new route for this Iot Hub. + + :param iot_hub_name: IotHub to be tested. + :type iot_hub_name: str + :param resource_group_name: resource group which Iot Hub belongs to. + :type resource_group_name: str + :param input: Route that needs to be tested. + :type input: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteInput + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestRouteResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.TestRouteResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestRouteResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.test_route.metadata['url'] # type: ignore + path_format_arguments = { + 'iotHubName': self._serialize.url("iot_hub_name", iot_hub_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(input, 'TestRouteInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestRouteResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + test_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/routing/routes/$testnew'} # type: ignore + + def list_keys( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SharedAccessSignatureAuthorizationRuleListResult"] + """Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get the security metadata for an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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_keys.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(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('SharedAccessSignatureAuthorizationRuleListResult', 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_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/listkeys'} # type: ignore + + def get_keys_for_key_name( + self, + resource_group_name, # type: str + resource_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SharedAccessSignatureAuthorizationRule" + """Get a shared access policy by name from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + Get a shared access policy by name from an IoT hub. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param key_name: The name of the shared access policy. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedAccessSignatureAuthorizationRule, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.SharedAccessSignatureAuthorizationRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SharedAccessSignatureAuthorizationRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_keys_for_key_name.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'keyName': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(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('SharedAccessSignatureAuthorizationRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'} # type: ignore + + def export_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + export_devices_parameters, # type: "_models.ExportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Exports all the device identities in the IoT hub identity registry to an Azure Storage blob + container. For more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param export_devices_parameters: The parameters that specify the export devices operation. + :type export_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ExportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.export_devices.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(export_devices_parameters, 'ExportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + export_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'} # type: ignore + + def import_devices( + self, + resource_group_name, # type: str + resource_name, # type: str + import_devices_parameters, # type: "_models.ImportDevicesRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.JobResponse" + """Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + Import, update, or delete device identities in the IoT hub identity registry from a blob. For + more information, see: + https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param import_devices_parameters: The parameters that specify the import devices operation. + :type import_devices_parameters: ~azure.mgmt.iothub.v2021_07_01.models.ImportDevicesRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: JobResponse, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.JobResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.import_devices.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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(import_devices_parameters, 'ImportDevicesRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('JobResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_devices.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py new file mode 100644 index 000000000000..1a1761258b1f --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_operations.py @@ -0,0 +1,110 @@ +# 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 Operations(object): + """Operations 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.iothub.v2021_07_01.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( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available IoT Hub REST API operations. + + :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.iothub.v2021_07_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = 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('OperationListResult', 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.metadata = {'url': '/providers/Microsoft.Devices/operations'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..201961a3f22c --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,446 @@ +# 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations 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.iothub.v2021_07_01.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( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.PrivateEndpointConnection"] + """List private endpoint connections. + + List private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of PrivateEndpointConnection, or the result of cls(response) + :rtype: list[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('[PrivateEndpointConnection]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Get private endpoint connection. + + Get private endpoint connection properties. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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(private_endpoint_connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + private_endpoint_connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Update private endpoint connection. + + Update the status of a private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The private endpoint connection with updated properties. + :type private_endpoint_connection: ~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_name, + private_endpoint_connection=private_endpoint_connection, + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + 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'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + resource_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Delete private endpoint connection. + + Delete private endpoint connection with the specified name. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.iothub.v2021_07_01.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + 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, + resource_name=resource_name, + private_endpoint_connection_name=private_endpoint_connection_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): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..fbd771d5cd42 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_private_link_resources_operations.py @@ -0,0 +1,173 @@ +# 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.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, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations 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.iothub.v2021_07_01.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( + self, + resource_group_name, # type: str + resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResources" + """List private link resources. + + List private link resources for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResources, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.PrivateLinkResources + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('PrivateLinkResources', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources'} # type: ignore + + def get( + self, + resource_group_name, # type: str + resource_name, # type: str + group_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GroupIdInformation" + """Get the specified private link resource. + + Get the specified private link resource for the given IotHub. + + :param resource_group_name: The name of the resource group that contains the IoT hub. + :type resource_group_name: str + :param resource_name: The name of the IoT hub. + :type resource_name: str + :param group_id: The name of the private link resource. + :type group_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GroupIdInformation, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.GroupIdInformation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GroupIdInformation"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'resourceName': self._serialize.url("resource_name", resource_name, 'str'), + 'groupId': self._serialize.url("group_id", group_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = 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('GroupIdInformation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py new file mode 100644 index 000000000000..3663daf69b22 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/operations/_resource_provider_common_operations.py @@ -0,0 +1,99 @@ +# 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.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, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ResourceProviderCommonOperations(object): + """ResourceProviderCommonOperations 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.iothub.v2021_07_01.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_subscription_quota( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.UserSubscriptionQuotaListResult" + """Get the number of iot hubs in the subscription. + + Get the number of free and paid iot hubs in the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSubscriptionQuotaListResult, or the result of cls(response) + :rtype: ~azure.mgmt.iothub.v2021_07_01.models.UserSubscriptionQuotaListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSubscriptionQuotaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-07-01" + accept = "application/json" + + # Construct URL + url = self.get_subscription_quota.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') + + # 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('UserSubscriptionQuotaListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_subscription_quota.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/usages'} # type: ignore diff --git a/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml index 7e44331fadbf..06c29fd90554 100644 --- a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml +++ b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub.yaml @@ -13,10 +13,10 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/checkNameAvailability?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/checkNameAvailability?api-version=2021-07-01 response: body: string: '{"nameAvailable":true,"reason":"Invalid","message":null}' @@ -28,7 +28,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:24:45 GMT + - Wed, 25 Aug 2021 03:07:25 GMT expires: - '-1' pragma: @@ -63,24 +63,24 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","properties":{"state":"Activating","provisioningState":"Accepted","enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","properties":{"state":"Activating","provisioningState":"Accepted","enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None","allowedFqdnList":[]},"sku":{"name":"S1","tier":"Standard","capacity":2}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYzRiYzYyNjMtZTE5YS00Mzk3LWJiMDEtYmQwMzg5NTY0YTY3?api-version=2021-07-01&operationSource=os_ih&asyncinfo cache-control: - no-cache content-length: - - '698' + - '719' content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:24:48 GMT + - Wed, 25 Aug 2021 03:07:28 GMT expires: - '-1' pragma: @@ -106,10 +106,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYzRiYzYyNjMtZTE5YS00Mzk3LWJiMDEtYmQwMzg5NTY0YTY3?api-version=2021-07-01&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Running"}' @@ -121,7 +121,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:25:18 GMT + - Wed, 25 Aug 2021 03:07:58 GMT expires: - '-1' pragma: @@ -149,10 +149,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYzRiYzYyNjMtZTE5YS00Mzk3LWJiMDEtYmQwMzg5NTY0YTY3?api-version=2021-07-01&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Running"}' @@ -164,7 +164,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:25:48 GMT + - Wed, 25 Aug 2021 03:08:28 GMT expires: - '-1' pragma: @@ -192,10 +192,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYzRiYzYyNjMtZTE5YS00Mzk3LWJiMDEtYmQwMzg5NTY0YTY3?api-version=2021-07-01&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Running"}' @@ -207,7 +207,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:18 GMT + - Wed, 25 Aug 2021 03:08:58 GMT expires: - '-1' pragma: @@ -235,10 +235,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfMjA5OGUwOWQtNGU0Yi00ODc5LTlhYjItODE5NzM0OTY2YTVm?api-version=2021-03-31&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfYzRiYzYyNjMtZTE5YS00Mzk3LWJiMDEtYmQwMzg5NTY0YTY3?api-version=2021-07-01&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Succeeded"}' @@ -250,7 +250,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:49 GMT + - Wed, 25 Aug 2021 03:09:29 GMT expires: - '-1' pragma: @@ -278,23 +278,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADFcm8MM=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-14441227-e5cd720306.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None","allowedFqdnList":[]},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' headers: cache-control: - no-cache content-length: - - '1581' + - '1602' content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:50 GMT + - Wed, 25 Aug 2021 03:09:29 GMT expires: - '-1' pragma: @@ -322,23 +322,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-07-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADFcm8MM=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-14441227-e5cd720306.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None","allowedFqdnList":[]},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}' headers: cache-control: - no-cache content-length: - - '1581' + - '1602' content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:50 GMT + - Wed, 25 Aug 2021 03:09:30 GMT expires: - '-1' pragma: @@ -366,23 +366,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs?api-version=2021-07-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADFcm8MM=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-14441227-e5cd720306.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None","allowedFqdnList":[]},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' headers: cache-control: - no-cache content-length: - - '1593' + - '1614' content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:50 GMT + - Wed, 25 Aug 2021 03:09:30 GMT expires: - '-1' pragma: @@ -410,24 +410,23 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/IotHubs?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/IotHubs?api-version=2021-07-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADEou5BY=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-10929372-22e5a427a3.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgpy-test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee","name":"iot88d011ee","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"rgpy-test_mgmt_iothub_test_iothub_consumer_group88d011ee","etag":"AAAADEou4WE=","properties":{"locations":[{"location":"West - US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Activating","provisioningState":"Activating","ipFilterRules":[],"eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None"},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97","name":"iota8d80b97","type":"Microsoft.Devices/IotHubs","location":"westus","tags":{},"subscriptionid":"00000000-0000-0000-0000-000000000000","resourcegroup":"test_mgmt_iothub_test_iothuba8d80b97","etag":"AAAADFcm8MM=","properties":{"locations":[{"location":"West + US","role":"primary"},{"location":"East US","role":"secondary"}],"state":"Active","provisioningState":"Succeeded","ipFilterRules":[],"hostName":"iota8d80b97.azure-devices.net","eventHubEndpoints":{"events":{"retentionTimeInDays":1,"partitionCount":4,"partitionIds":["0","1","2","3"],"path":"iota8d80b97","endpoint":"sb://iothub-ns-iota8d80b9-14441227-e5cd720306.servicebus.windows.net/"}},"routing":{"endpoints":{"serviceBusQueues":[],"serviceBusTopics":[],"eventHubs":[],"storageContainers":[]},"routes":[],"fallbackRoute":{"name":"$fallback","source":"DeviceMessages","condition":"true","endpointNames":["events"],"isEnabled":true}},"storageEndpoints":{"$default":{"sasTtlAsIso8601":"PT1H","connectionString":"","containerName":""}},"messagingEndpoints":{"fileNotifications":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"enableFileUploadNotifications":false,"cloudToDevice":{"maxDeliveryCount":10,"defaultTtlAsIso8601":"PT1H","feedback":{"lockDurationAsIso8601":"PT1M","ttlAsIso8601":"PT1H","maxDeliveryCount":10}},"features":"None","allowedFqdnList":[]},"sku":{"name":"S1","tier":"Standard","capacity":2},"identity":{"type":"None"}}]}' headers: cache-control: - no-cache content-length: - - '3030' + - '1614' content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:51 GMT + - Wed, 25 Aug 2021 03:09:30 GMT expires: - '-1' pragma: @@ -455,10 +454,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/IotHubStats?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/IotHubStats?api-version=2021-07-01 response: body: string: '{"totalDeviceCount":0,"enabledDeviceCount":0,"disabledDeviceCount":0}' @@ -470,7 +469,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:51 GMT + - Wed, 25 Aug 2021 03:09:31 GMT expires: - '-1' pragma: @@ -498,10 +497,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/skus?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/skus?api-version=2021-07-01 response: body: string: '{"value":[{"resourceType":"Microsoft.Devices/IotHubs","sku":{"name":"S1","tier":"Standard"},"capacity":{"minimum":1,"maximum":200,"default":1,"scaleType":"Manual"}},{"resourceType":"Microsoft.Devices/IotHubs","sku":{"name":"S2","tier":"Standard"},"capacity":{"minimum":1,"maximum":200,"default":1,"scaleType":"Manual"}},{"resourceType":"Microsoft.Devices/IotHubs","sku":{"name":"S3","tier":"Standard"},"capacity":{"minimum":1,"maximum":10,"default":1,"scaleType":"Manual"}}]}' @@ -513,7 +512,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:51 GMT + - Wed, 25 Aug 2021 03:09:31 GMT expires: - '-1' pragma: @@ -541,10 +540,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/jobs?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/jobs?api-version=2021-07-01 response: body: string: '{"value":[]}' @@ -556,7 +555,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:51 GMT + - Wed, 25 Aug 2021 03:09:31 GMT expires: - '-1' pragma: @@ -584,10 +583,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/quotaMetrics?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97/quotaMetrics?api-version=2021-07-01 response: body: string: '{"value":[{"name":"TotalMessages","currentValue":0,"maxValue":800000},{"name":"TotalDeviceCount","currentValue":0,"maxValue":1000000}]}' @@ -599,7 +598,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:51 GMT + - Wed, 25 Aug 2021 03:09:31 GMT expires: - '-1' pragma: @@ -629,16 +628,16 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-03-31 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothuba8d80b97/providers/Microsoft.Devices/IotHubs/iota8d80b97?api-version=2021-07-01 response: body: string: 'null' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZjY2ZTM2OWItMGY1NS00Mzk4LWFkNTUtOGNjYmUzMGJkOTI1?api-version=2021-03-31&operationSource=os_ih&asyncinfo + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfNThlN2EyZDMtM2Q2OC00NjQ2LTlhYzYtNGRmYWM5Mzk3M2Fj?api-version=2021-07-01&operationSource=os_ih&asyncinfo cache-control: - no-cache content-length: @@ -646,11 +645,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:26:52 GMT + - Wed, 25 Aug 2021 03:09:32 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZjY2ZTM2OWItMGY1NS00Mzk4LWFkNTUtOGNjYmUzMGJkOTI1?api-version=2021-03-31&operationSource=os_ih + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfNThlN2EyZDMtM2Q2OC00NjQ2LTlhYzYtNGRmYWM5Mzk3M2Fj?api-version=2021-07-01&operationSource=os_ih pragma: - no-cache server: @@ -674,10 +673,10 @@ interactions: Connection: - keep-alive User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 + - azsdk-python-azure-mgmt-iothub/2.1.0 Python/3.8.11 (Linux-5.8.0-1039-azure-x86_64-with-glibc2.2.5) + VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0 method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfZjY2ZTM2OWItMGY1NS00Mzk4LWFkNTUtOGNjYmUzMGJkOTI1?api-version=2021-03-31&operationSource=os_ih&asyncinfo + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.Devices/operationResults/b3NfaWhfNThlN2EyZDMtM2Q2OC00NjQ2LTlhYzYtNGRmYWM5Mzk3M2Fj?api-version=2021-07-01&operationSource=os_ih&asyncinfo response: body: string: '{"status":"Succeeded"}' @@ -689,7 +688,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 14 May 2021 09:27:07 GMT + - Wed, 25 Aug 2021 03:09:47 GMT expires: - '-1' pragma: diff --git a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml b/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml deleted file mode 100644 index 16e8c1fb9d3a..000000000000 --- a/sdk/iothub/azure-mgmt-iothub/tests/recordings/test_mgmt_iothub.test_iothub_consumer_group.yaml +++ /dev/null @@ -1,51 +0,0 @@ -interactions: -- request: - body: '{"location": "westus", "properties": {"enableFileUploadNotifications": - false, "features": "None"}, "sku": {"name": "S1", "capacity": 2}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '136' - Content-Type: - - application/json - User-Agent: - - azsdk-python-azure-mgmt-iothub/2.0.0 Python/3.8.10 (Linux-5.4.0-1047-azure-x86_64-with-glibc2.2.5) - VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2384_0 - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_mgmt_iothub_test_iothub_consumer_group88d011ee/providers/Microsoft.Devices/IotHubs/iot88d011ee?api-version=2021-03-31 - response: - body: - string: '{"code":409002,"httpStatusCode":"Conflict","message":"Operation in - progress. If you contact a support representative please include this correlation - identifier: 2e9406bd-2d51-4a9a-a7c3-1fe1c4df18f4, timestamp: 2021-05-14 09:27:09Z, - errorcode: IH409002."}' - headers: - cache-control: - - no-cache - content-length: - - '254' - content-type: - - application/json; charset=utf-8 - date: - - Fri, 14 May 2021 09:27:09 GMT - expires: - - '-1' - pragma: - - no-cache - server: - - Microsoft-HTTPAPI/2.0 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '4999' - status: - code: 409 - message: Conflict -version: 1 From 0bd54914deb85f1248eca03e3348ebf88c193d8e Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Thu, 26 Aug 2021 16:20:30 +0800 Subject: [PATCH 03/10] [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 From 716a7d1f4a115a74243fd399fa2e6d08c81a9aeb Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 26 Aug 2021 16:11:59 -0700 Subject: [PATCH 04/10] Stip empty changelog sections before release (#20437) Co-authored-by: Chidozie Ononiwu --- eng/common/scripts/Prepare-Release.ps1 | 7 +++++ eng/common/scripts/Update-ChangeLog.ps1 | 42 ++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/Prepare-Release.ps1 b/eng/common/scripts/Prepare-Release.ps1 index 95f175d3fdaf..cee038dd18a0 100644 --- a/eng/common/scripts/Prepare-Release.ps1 +++ b/eng/common/scripts/Prepare-Release.ps1 @@ -184,6 +184,13 @@ else exit 1 } +$changelogIsValid = Confirm-ChangeLogEntry -ChangeLogLocation $packageProperties.ChangeLogPath -VersionString $newVersion -ForRelease $true + +if (!$changelogIsValid) +{ + Write-Host "The changelog [$($packageProperties.ChangeLogPath)] is not valid for release. Please make sure it is valid before queuing release build." -ForegroundColor Red +} + git diff -s --exit-code $packageProperties.DirectoryPath if ($LASTEXITCODE -ne 0) { diff --git a/eng/common/scripts/Update-ChangeLog.ps1 b/eng/common/scripts/Update-ChangeLog.ps1 index b4c07d597629..1524bd7318c1 100644 --- a/eng/common/scripts/Update-ChangeLog.ps1 +++ b/eng/common/scripts/Update-ChangeLog.ps1 @@ -106,7 +106,47 @@ if ($LatestsSorted[0] -ne $Version) { if ($ReplaceLatestEntryTitle) { - $newChangeLogEntry = New-ChangeLogEntry -Version $Version -Status $ReleaseStatus -Content $ChangeLogEntries[$LatestVersion].ReleaseContent + # Remove empty sections from content + $sanitizedContent = @() + $sectionContent = @() + $sectionContentCount = 0 + $latesVersionContent = $ChangeLogEntries[$LatestVersion].ReleaseContent + + foreach ($line in $latesVersionContent) + { + if ($line.StartsWith("### ") -or $sectionContentCount -gt 0) + { + if ($line.StartsWith("#") -and $sectionContentCount -gt 1) + { + $sanitizedContent += $sectionContent + $sectionContent = @() + $sectionContentCount = 0 + } + + if ($line.StartsWith("#") -and $sectionContentCount -eq 1) + { + $sectionContent = @() + $sectionContentCount = 0 + } + + $sectionContent += $line + if (-not [System.String]::IsNullOrWhiteSpace($line)) + { + $sectionContentCount++ + } + } + elseif ($sectionContent.Count -eq 0) + { + $sanitizedContent += $line + } + } + + if ($sectionContentCount -gt 1) + { + $sanitizedContent += $sectionContent + } + + $newChangeLogEntry = New-ChangeLogEntry -Version $Version -Status $ReleaseStatus -Content $sanitizedContent LogDebug "Resetting latest entry title to [$($newChangeLogEntry.ReleaseTitle)]" $ChangeLogEntries.Remove($LatestVersion) if ($newChangeLogEntry) { From 09e50673cc61cad3f4427b34ab751d0658a69df2 Mon Sep 17 00:00:00 2001 From: annatisch Date: Fri, 27 Aug 2021 07:14:47 -0700 Subject: [PATCH 05/10] Update question-answering readme links (#20439) --- .../README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md index a3e4f543c1dd..06fb24064963 100644 --- a/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md +++ b/sdk/cognitivelanguage/azure-ai-language-questionanswering/README.md @@ -79,7 +79,7 @@ params = qna.KnowledgeBaseQueryOptions( question="How long should my Surface battery last?" ) -output = client.query_knowledge_base( +output = client.query_knowledgebase( params, project_name="FAQ", ) @@ -93,18 +93,17 @@ You can set additional properties on `KnowledgeBaseQueryOptions` to limit the nu ### Ask a follow-up question -If your knowledge base is configured for [chit-chat][questionanswering_docs_chat], you can ask a follow-up question provided the previous question-answering ID and, optionally, the exact question the user asked: +If your knowledge base is configured for [chit-chat][questionanswering_docs_chat], the answers from the knowledge base may include suggested [prompts for follow-up questions][questionanswering_refdocs_prompts] to initiate a conversation. You can ask a follow-up question by providing the ID of your chosen answer as the context for the continued conversation: ```python params = qna.models.KnowledgeBaseQueryOptions( question="How long should charging take?" context=qna.models.KnowledgeBaseAnswerRequestContext( - previous_user_query="How long should my Surface battery last?", previous_qna_id=previous_answer.id ) ) -output = client.query_knowledge_base( +output = client.query_knowledgebase( params, project_name="FAQ" ) @@ -127,7 +126,7 @@ params = qna.KnowledgeBaseQueryOptions( question="How long should my Surface battery last?" ) -output = await client.query_knowledge_base( +output = await client.query_knowledgebase( params, project_name="FAQ" ) @@ -148,7 +147,7 @@ For example, if you submit a question to a non-existant knowledge base, a `400` from azure.core.exceptions import HttpResponseError try: - client.query_knowledge_base( + client.query_knowledgebase( params, project_name="invalid-knowledge-base" ) @@ -198,14 +197,15 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [azure_core_ref_docs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md [pip_link]:https://pypi.org/project/pip/ -[questionanswering_client_class]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/azure/ai/language/questionanswering/_question_answering_client.py#L27 +[questionanswering_client_class]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.html#azure.ai.language.questionanswering.QuestionAnsweringClient +[questionanswering_refdocs_prompts]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.models.html#azure.ai.language.questionanswering.models.KnowledgeBaseAnswerDialog [questionanswering_client_src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/ [questionanswering_docs]: https://azure.microsoft.com/services/cognitive-services/qna-maker/ [questionanswering_docs_chat]: https://docs.microsoft.com/azure/cognitive-services/qnamaker/how-to/chit-chat-knowledge-base [questionanswering_docs_demos]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#demo [questionanswering_docs_features]: https://azure.microsoft.com/services/cognitive-services/qna-maker/#features -[questionanswering_pypi_package]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/ -[questionanswering_refdocs]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/ +[questionanswering_pypi_package]: https://pypi.org/project/azure-ai-language-questionanswering/ +[questionanswering_refdocs]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-language-questionanswering/1.0.0b1/azure.ai.language.questionanswering.html [questionanswering_rest_docs]: https://docs.microsoft.com/rest/api/cognitiveservices-qnamaker/ [questionanswering_samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitivelanguage/azure-ai-language-questionanswering/samples/README.md From d99ff958da9996b3a3bee8d9cede5a46657a35ce Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 27 Aug 2021 10:54:15 -0700 Subject: [PATCH 06/10] ensure test principal creation succeeds properly (#20446) Co-authored-by: scbedd <45376673+scbedd@users.noreply.github.com> --- eng/common/TestResources/New-TestResources.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/TestResources/New-TestResources.ps1 b/eng/common/TestResources/New-TestResources.ps1 index 7d5353202fea..e2a4ef125d6e 100644 --- a/eng/common/TestResources/New-TestResources.ps1 +++ b/eng/common/TestResources/New-TestResources.ps1 @@ -289,7 +289,7 @@ try { $AzureTestPrincipal } else { Log "TestApplicationId was not specified; creating a new service principal in subscription '$SubscriptionId'" - $global:AzureTestPrincipal = New-AzADServicePrincipal -Role Owner -Scope "/subscriptions/$SubscriptionId" + $global:AzureTestPrincipal = New-AzADServicePrincipal -Role Owner -Scope "/subscriptions/$SubscriptionId" -DisplayName "test-resources-$($baseName).microsoft.com" $global:AzureTestSubscription = $SubscriptionId Log "Created service principal '$($AzureTestPrincipal.ApplicationId)'" From edab6261ba67cf1dd149c88ae4f6a9bc538df50c Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 27 Aug 2021 15:45:07 -0400 Subject: [PATCH 07/10] switch to protocol --- .../azure/core/_pipeline_client_async.py | 31 ++- .../azure-core/azure/core/rest/_aiohttp.py | 5 +- .../azure/core/rest/_http_response_impl.py | 185 ++++++++++++++++ .../core/rest/_http_response_impl_async.py | 109 ++++++++++ .../azure/core/rest/_requests_asyncio.py | 4 +- .../azure/core/rest/_requests_basic.py | 6 +- .../azure/core/rest/_requests_trio.py | 4 +- sdk/core/azure-core/azure/core/rest/_rest.py | 124 ++++------- .../azure-core/azure/core/rest/_rest_py3.py | 200 +++++------------- 9 files changed, 415 insertions(+), 253 deletions(-) create mode 100644 sdk/core/azure-core/azure/core/rest/_http_response_impl.py create mode 100644 sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py diff --git a/sdk/core/azure-core/azure/core/_pipeline_client_async.py b/sdk/core/azure-core/azure/core/_pipeline_client_async.py index 357b3d9b917d..f6c7f37277dd 100644 --- a/sdk/core/azure-core/azure/core/_pipeline_client_async.py +++ b/sdk/core/azure-core/azure/core/_pipeline_client_async.py @@ -25,7 +25,7 @@ # -------------------------------------------------------------------------- import logging -from collections.abc import Iterable +import collections.abc from typing import Any, Awaitable from .configuration import Configuration from .pipeline import AsyncPipeline @@ -63,6 +63,26 @@ _LOGGER = logging.getLogger(__name__) +class _AsyncContextManager(collections.abc.Awaitable): + + def __init__(self, wrapped: collections.abc.Awaitable): + super().__init__() + self.wrapped = wrapped + self.response = None + + def __await__(self): + return self.wrapped.__await__() + + async def __aenter__(self): + self.response = await self + return self.response + + async def __aexit__(self, *args): + await self.response.__aexit__(*args) + + async def close(self): + await self.response.close() + class AsyncPipelineClient(PipelineClientBase): """Service client core methods. @@ -126,7 +146,7 @@ def _build_pipeline(self, config, **kwargs): # pylint: disable=no-self-use config.proxy_policy, ContentDecodePolicy(**kwargs) ] - if isinstance(per_call_policies, Iterable): + if isinstance(per_call_policies, collections.abc.Iterable): policies.extend(per_call_policies) else: policies.append(per_call_policies) @@ -135,7 +155,7 @@ def _build_pipeline(self, config, **kwargs): # pylint: disable=no-self-use config.retry_policy, config.authentication_policy, config.custom_hook_policy]) - if isinstance(per_retry_policies, Iterable): + if isinstance(per_retry_policies, collections.abc.Iterable): policies.extend(per_retry_policies) else: policies.append(per_retry_policies) @@ -144,13 +164,13 @@ def _build_pipeline(self, config, **kwargs): # pylint: disable=no-self-use DistributedTracingPolicy(**kwargs), config.http_logging_policy or HttpLoggingPolicy(**kwargs)]) else: - if isinstance(per_call_policies, Iterable): + if isinstance(per_call_policies, collections.abc.Iterable): per_call_policies_list = list(per_call_policies) else: per_call_policies_list = [per_call_policies] per_call_policies_list.extend(policies) policies = per_call_policies_list - if isinstance(per_retry_policies, Iterable): + if isinstance(per_retry_policies, collections.abc.Iterable): per_retry_policies_list = list(per_retry_policies) else: per_retry_policies_list = [per_retry_policies] @@ -223,6 +243,5 @@ def send_request( :return: The response of your network call. Does not do error handling on your response. :rtype: ~azure.core.rest.AsyncHttpResponse """ - from .rest._rest_py3 import _AsyncContextManager wrapped = self._make_pipeline_call(request, stream=stream, **kwargs) return _AsyncContextManager(wrapped=wrapped) diff --git a/sdk/core/azure-core/azure/core/rest/_aiohttp.py b/sdk/core/azure-core/azure/core/rest/_aiohttp.py index f25d9f7679b0..9b5b1bc0848a 100644 --- a/sdk/core/azure-core/azure/core/rest/_aiohttp.py +++ b/sdk/core/azure-core/azure/core/rest/_aiohttp.py @@ -27,12 +27,13 @@ import asyncio from typing import AsyncIterator from multidict import CIMultiDict -from . import HttpRequest, AsyncHttpResponse +from . import HttpRequest +from ._http_response_impl_async import AsyncHttpResponseImpl from ._helpers_py3 import iter_raw_helper, iter_bytes_helper from ..pipeline.transport._aiohttp import AioHttpStreamDownloadGenerator -class RestAioHttpTransportResponse(AsyncHttpResponse): +class RestAioHttpTransportResponse(AsyncHttpResponseImpl): def __init__( self, *, diff --git a/sdk/core/azure-core/azure/core/rest/_http_response_impl.py b/sdk/core/azure-core/azure/core/rest/_http_response_impl.py new file mode 100644 index 000000000000..5954b4178c90 --- /dev/null +++ b/sdk/core/azure-core/azure/core/rest/_http_response_impl.py @@ -0,0 +1,185 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +from json import loads +from typing import cast, Any, Optional, Iterator +from ._helpers import ( + HeadersType, + get_charset_encoding, + decode_to_text, + parse_lines_from_text, +) +from ..exceptions import HttpResponseError, ResponseNotReadError +try: + from ._rest_py3 import _HttpResponseBase, HttpResponse as _HttpResponse +except (SyntaxError, ImportError): + from ._rest import _HttpResponseBase, HttpResponse as _HttpResponse # type: ignore + + +class _HttpResponseBaseImpl(_HttpResponseBase): # pylint: disable=too-many-instance-attributes + + def __init__(self, **kwargs): + # type: (Any) -> None + super(_HttpResponseBaseImpl, self).__init__() + self.request = kwargs.pop("request") + self._internal_response = kwargs.pop("internal_response") + self.headers = {} # type: HeadersType + self.is_closed = False + self.is_stream_consumed = False + self._connection_data_block_size = None + self._json = None # this is filled in ContentDecodePolicy, when we deserialize + self._content = None # type: Optional[bytes] + self._text = None # type: Optional[str] + + @property + def url(self): + # type: (...) -> str + """Returns the URL that resulted in this response""" + return self.request.url + + @property + def encoding(self): + # type: (...) -> Optional[str] + """Returns the response encoding. + + :return: The response encoding. We either return the encoding set by the user, + or try extracting the encoding from the response's content type. If all fails, + we return `None`. + :rtype: optional[str] + """ + try: + return self._encoding + except AttributeError: + self._encoding = get_charset_encoding(self) # type: Optional[str] + return self._encoding + + @encoding.setter + def encoding(self, value): + # type: (str) -> None + """Sets the response encoding""" + self._encoding = value + self._text = None # clear text cache + + def text(self, encoding=None): + # type: (Optional[str]) -> str + """Returns the response body as a string + + :param optional[str] encoding: The encoding you want to decode the text with. Can + also be set independently through our encoding property + :return: The response's content decoded as a string. + """ + if self._text is None or encoding: + encoding_to_pass = encoding or self.encoding + self._text = decode_to_text(encoding_to_pass, self.content) + return self._text + + def json(self): + # type: (...) -> Any + """Returns the whole body as a json object. + + :return: The JSON deserialized response body + :rtype: any + :raises json.decoder.JSONDecodeError or ValueError (in python 2.7) if object is not JSON decodable: + """ + # this will trigger errors if response is not read in + self.content # pylint: disable=pointless-statement + if not self._json: + self._json = loads(self.text()) + return self._json + + def raise_for_status(self): + # type: (...) -> None + """Raises an HttpResponseError if the response has an error status code. + + If response is good, does nothing. + """ + if cast(int, self.status_code) >= 400: + raise HttpResponseError(response=self) + + @property + def content(self): + # type: (...) -> bytes + """Return the response's content in bytes.""" + if self._content is None: + raise ResponseNotReadError(self) + return self._content + + def __repr__(self): + # type: (...) -> str + content_type_str = ( + ", Content-Type: {}".format(self.content_type) if self.content_type else "" + ) + return "".format( + self.status_code, self.reason, content_type_str + ) + +class HttpResponseImpl(_HttpResponseBaseImpl, _HttpResponse): # pylint: disable=too-many-instance-attributes + """HttpResponseImpl built on top of our HttpResponse protocol class. + + Helper impl for creating our transport responses + """ + + def __enter__(self): + # type: (...) -> HttpResponseImpl + return self + + def close(self): + # type: (...) -> None + self.is_closed = True + self._internal_response.close() + + def __exit__(self, *args): + # type: (...) -> None + self.close() + + def read(self): + # type: (...) -> bytes + """ + Read the response's bytes. + + """ + if self._content is None: + self._content = b"".join(self.iter_bytes()) + return self.content + + def iter_text(self): + # type: () -> Iterator[str] + """Iterate over the response text + """ + for byte in self.iter_bytes(): + text = byte.decode(self.encoding or "utf-8") + yield text + + def iter_lines(self): + # type: () -> Iterator[str] + for text in self.iter_text(): + lines = parse_lines_from_text(text) + for line in lines: + yield line + + def _close_stream(self): + # type: (...) -> None + self.is_stream_consumed = True + self.close() diff --git a/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py b/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py new file mode 100644 index 000000000000..47e2c243d070 --- /dev/null +++ b/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py @@ -0,0 +1,109 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +from typing import AsyncIterator +from ._rest_py3 import AsyncHttpResponse as _AsyncHttpResponse +from ._http_response_impl import _HttpResponseBaseImpl +from ._helpers import parse_lines_from_text + +class AsyncHttpResponseImpl(_HttpResponseBaseImpl, _AsyncHttpResponse): + """AsyncHttpResponseImpl built on top of our HttpResponse protocol class. + + Helper impl for creating our transport responses + """ + + async def read(self) -> bytes: + """Read the response's bytes into memory. + + :return: The response's bytes + :rtype: bytes + """ + if self._content is None: + parts = [] + async for part in self.iter_bytes(): + parts.append(part) + self._content = b"".join(parts) + return self._content + + async def iter_text(self) -> AsyncIterator[str]: + """Asynchronously iterates over the text in the response. + + :return: An async iterator of string. Each string chunk will be a text from the response + :rtype: AsyncIterator[str] + """ + async for byte in self.iter_bytes(): # type: ignore + text = byte.decode(self.encoding or "utf-8") + yield text + + async def iter_lines(self) -> AsyncIterator[str]: + """Asynchronously iterates over the lines in the response. + + :return: An async iterator of string. Each string chunk will be a line from the response + :rtype: AsyncIterator[str] + """ + async for text in self.iter_text(): + lines = parse_lines_from_text(text) + for line in lines: + yield line + + async def iter_raw(self) -> AsyncIterator[bytes]: + """Asynchronously iterates over the response's bytes. Will not decompress in the process + + :return: An async iterator of bytes from the response + :rtype: AsyncIterator[bytes] + """ + raise NotImplementedError() + # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 + yield # pylint: disable=unreachable + + async def iter_bytes(self) -> AsyncIterator[bytes]: + """Asynchronously iterates over the response's bytes. Will decompress in the process + + :return: An async iterator of bytes from the response + :rtype: AsyncIterator[bytes] + """ + raise NotImplementedError() + # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 + yield # pylint: disable=unreachable + + async def close(self) -> None: + """Close the response. + + :return: None + :rtype: None + """ + self.is_closed = True + await self._internal_response.close() + + async def __aexit__(self, *args) -> None: + await self.close() + + def __repr__(self) -> str: + content_type_str = ( + ", Content-Type: {}".format(self.content_type) if self.content_type else "" + ) + return "".format( + self.status_code, self.reason, content_type_str + ) diff --git a/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py b/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py index b21545a79804..73ee5cdffc9b 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py @@ -26,11 +26,11 @@ from typing import AsyncIterator import asyncio from ._helpers_py3 import iter_bytes_helper, iter_raw_helper -from . import AsyncHttpResponse +from ._http_response_impl_async import AsyncHttpResponseImpl from ._requests_basic import _RestRequestsTransportResponseBase, _has_content from ..pipeline.transport._requests_asyncio import AsyncioStreamDownloadGenerator -class RestAsyncioRequestsTransportResponse(AsyncHttpResponse, _RestRequestsTransportResponseBase): # type: ignore +class RestAsyncioRequestsTransportResponse(AsyncHttpResponseImpl, _RestRequestsTransportResponseBase): # type: ignore """Asynchronous streaming of data from the response. """ diff --git a/sdk/core/azure-core/azure/core/rest/_requests_basic.py b/sdk/core/azure-core/azure/core/rest/_requests_basic.py index bd83dc29bd39..7844a04fd8c7 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_basic.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_basic.py @@ -26,7 +26,7 @@ from typing import TYPE_CHECKING, cast from ..exceptions import ResponseNotReadError, StreamConsumedError, StreamClosedError -from ._rest import _HttpResponseBase, HttpResponse +from ._http_response_impl import _HttpResponseBaseImpl, HttpResponseImpl from ..pipeline.transport._requests_basic import StreamDownloadGenerator if TYPE_CHECKING: @@ -39,7 +39,7 @@ def _has_content(response): except ResponseNotReadError: return False -class _RestRequestsTransportResponseBase(_HttpResponseBase): +class _RestRequestsTransportResponseBase(_HttpResponseBaseImpl): def __init__(self, **kwargs): super(_RestRequestsTransportResponseBase, self).__init__(**kwargs) self.status_code = self._internal_response.status_code @@ -76,7 +76,7 @@ def _stream_download_helper(decompress, response): for part in stream_download: yield part -class RestRequestsTransportResponse(HttpResponse, _RestRequestsTransportResponseBase): +class RestRequestsTransportResponse(HttpResponseImpl, _RestRequestsTransportResponseBase): def iter_bytes(self): # type: () -> Iterator[bytes] diff --git a/sdk/core/azure-core/azure/core/rest/_requests_trio.py b/sdk/core/azure-core/azure/core/rest/_requests_trio.py index 9806380ef04f..81cb2db2d47d 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_trio.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_trio.py @@ -25,12 +25,12 @@ # -------------------------------------------------------------------------- from typing import AsyncIterator import trio -from . import AsyncHttpResponse +from ._http_response_impl_async import AsyncHttpResponseImpl from ._requests_basic import _RestRequestsTransportResponseBase, _has_content from ._helpers_py3 import iter_bytes_helper, iter_raw_helper from ..pipeline.transport._requests_trio import TrioStreamDownloadGenerator -class RestTrioRequestsTransportResponse(AsyncHttpResponse, _RestRequestsTransportResponseBase): # type: ignore +class RestTrioRequestsTransportResponse(AsyncHttpResponseImpl, _RestRequestsTransportResponseBase): # type: ignore """Asynchronous streaming of data from the response. """ async def iter_raw(self) -> AsyncIterator[bytes]: diff --git a/sdk/core/azure-core/azure/core/rest/_rest.py b/sdk/core/azure-core/azure/core/rest/_rest.py index 10a8486a2c64..42172529df64 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest.py +++ b/sdk/core/azure-core/azure/core/rest/_rest.py @@ -24,16 +24,12 @@ # # -------------------------------------------------------------------------- import copy -from json import loads -from typing import TYPE_CHECKING, cast - -from azure.core.exceptions import HttpResponseError +from typing import TYPE_CHECKING, Protocol from ..utils._utils import _case_insensitive_dict from ._helpers import ( FilesType, - parse_lines_from_text, set_content_body, set_json_body, set_multipart_body, @@ -41,10 +37,7 @@ format_parameters, to_pipeline_transport_request_helper, from_pipeline_transport_request_helper, - get_charset_encoding, - decode_to_text, ) -from ..exceptions import ResponseNotReadError if TYPE_CHECKING: from typing import ( Iterable, @@ -191,28 +184,14 @@ def _to_pipeline_transport_request(self): def _from_pipeline_transport_request(cls, pipeline_transport_request): return from_pipeline_transport_request_helper(cls, pipeline_transport_request) -class _HttpResponseBase(object): # pylint: disable=too-many-instance-attributes - - def __init__(self, **kwargs): - # type: (Any) -> None - self.request = kwargs.pop("request") - self._internal_response = kwargs.pop("internal_response") - self.status_code = None - self.headers = {} # type: HeadersType - self.reason = None - self.is_closed = False - self.is_stream_consumed = False - self.content_type = None - self._json = None # this is filled in ContentDecodePolicy, when we deserialize - self._connection_data_block_size = None # type: Optional[int] - self._content = None # type: Optional[bytes] - self._text = None # type: Optional[str] - - @property - def url(self): - # type: (...) -> str - """Returns the URL that resulted in this response""" - return self.request.url +class _HttpResponseBase(Protocol): + request = None # type: HttpRequest + headers = None # type: HeadersType + status_code = None # type: int + reason = None # type: str + content_type = None # type: str + is_closed = None # type: bool + is_stream_consumed = None # type: bool @property def encoding(self): @@ -224,18 +203,16 @@ def encoding(self): we return `None`. :rtype: optional[str] """ - try: - return self._encoding - except AttributeError: - self._encoding = get_charset_encoding(self) # type: Optional[str] - return self._encoding @encoding.setter def encoding(self, value): # type: (str) -> None """Sets the response encoding""" - self._encoding = value - self._text = None # clear text cache + + @property + def url(self): + # type: (...) -> str + """Returns the URL that resulted in this response""" def text(self, encoding=None): # type: (Optional[str]) -> str @@ -245,10 +222,6 @@ def text(self, encoding=None): also be set independently through our encoding property :return: The response's content decoded as a string. """ - if self._text is None or encoding: - encoding_to_pass = encoding or self.encoding - self._text = decode_to_text(encoding_to_pass, self.content) - return self._text def json(self): # type: (...) -> Any @@ -258,11 +231,6 @@ def json(self): :rtype: any :raises json.decoder.JSONDecodeError or ValueError (in python 2.7) if object is not JSON decodable: """ - # this will trigger errors if response is not read in - self.content # pylint: disable=pointless-statement - if not self._json: - self._json = loads(self.text()) - return self._json def raise_for_status(self): # type: (...) -> None @@ -270,28 +238,15 @@ def raise_for_status(self): If response is good, does nothing. """ - if cast(int, self.status_code) >= 400: - raise HttpResponseError(response=self) @property def content(self): # type: (...) -> bytes """Return the response's content in bytes.""" - if self._content is None: - raise ResponseNotReadError(self) - return self._content - def __repr__(self): - # type: (...) -> str - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "".format( - self.status_code, self.reason, content_type_str - ) -class HttpResponse(_HttpResponseBase): # pylint: disable=too-many-instance-attributes - """**Provisional** object that represents an HTTP response. +class HttpResponse(_HttpResponseBase): + """**Provisional** protocol object that represents an HTTP response. **This object is provisional**, meaning it may be changed in a future release. @@ -324,55 +279,52 @@ class HttpResponse(_HttpResponseBase): # pylint: disable=too-many-instance-attr def __enter__(self): # type: (...) -> HttpResponse - return self + """Enter this response""" def close(self): # type: (...) -> None - self.is_closed = True - self._internal_response.close() + """Close this response""" def __exit__(self, *args): # type: (...) -> None - self.close() + """Exit this response""" def read(self): # type: (...) -> bytes - """ - Read the response's bytes. + """Read the response's bytes. + :return: The read in bytes + :rtype: bytes """ - if self._content is None: - self._content = b"".join(self.iter_bytes()) - return self.content def iter_raw(self): # type: () -> Iterator[bytes] - """Iterate over the raw response bytes + """Iterates over the response's bytes. Will not decompress in the process + + :return: An iterator of bytes from the response + :rtype: Iterator[str] """ - raise NotImplementedError() def iter_bytes(self): # type: () -> Iterator[bytes] - """Iterate over the response bytes + """Iterates over the response's bytes. Will decompress in the process + + :return: An iterator of bytes from the response + :rtype: Iterator[str] """ - raise NotImplementedError() def iter_text(self): # type: () -> Iterator[str] - """Iterate over the response text + """Iterates over the text in the response. + + :return: An iterator of string. Each string chunk will be a text from the response + :rtype: Iterator[str] """ - for byte in self.iter_bytes(): - text = byte.decode(self.encoding or "utf-8") - yield text def iter_lines(self): # type: () -> Iterator[str] - for text in self.iter_text(): - lines = parse_lines_from_text(text) - for line in lines: - yield line + """Iterates over the lines in the response. - def _close_stream(self): - # type: (...) -> None - self.is_stream_consumed = True - self.close() + :return: An iterator of string. Each string chunk will be a line from the response + :rtype: Iterator[str] + """ diff --git a/sdk/core/azure-core/azure/core/rest/_rest_py3.py b/sdk/core/azure-core/azure/core/rest/_rest_py3.py index 21e42f46b044..88b61d7ab368 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest_py3.py +++ b/sdk/core/azure-core/azure/core/rest/_rest_py3.py @@ -24,64 +24,34 @@ # # -------------------------------------------------------------------------- import copy -import collections -import collections.abc -from json import loads from typing import ( Any, AsyncIterable, AsyncIterator, - Dict, Iterable, Iterator, Optional, - Type, Union, + Protocol, ) - -from azure.core.exceptions import HttpResponseError - from ..utils._utils import _case_insensitive_dict from ._helpers import ( ParamsType, FilesType, HeadersType, - cast, - parse_lines_from_text, set_json_body, set_multipart_body, set_urlencoded_body, format_parameters, to_pipeline_transport_request_helper, from_pipeline_transport_request_helper, - get_charset_encoding, - decode_to_text, ) from ._helpers_py3 import set_content_body -from ..exceptions import ResponseNotReadError ContentType = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]] -class _AsyncContextManager(collections.abc.Awaitable): - - def __init__(self, wrapped: collections.abc.Awaitable): - super().__init__() - self.wrapped = wrapped - self.response = None - - def __await__(self): - return self.wrapped.__await__() - - async def __aenter__(self): - self.response = await self - return self.response - - async def __aexit__(self, *args): - await self.response.__aexit__(*args) - async def close(self): - await self.response.close() ################################## CLASSES ###################################### @@ -217,34 +187,22 @@ def _to_pipeline_transport_request(self): def _from_pipeline_transport_request(cls, pipeline_transport_request): return from_pipeline_transport_request_helper(cls, pipeline_transport_request) -class _HttpResponseBase: # pylint: disable=too-many-instance-attributes +class _HttpResponseBase(Protocol): + """Base Protocol class for HttpResponses + """ - def __init__( - self, - *, - request: HttpRequest, - **kwargs - ): - self.request = request - self._internal_response = kwargs.pop("internal_response") - self.status_code = None - self.headers = {} # type: HeadersType - self.reason = None - self.is_closed = False - self.is_stream_consumed = False - self.content_type = None - self._connection_data_block_size = None - self._json = None # this is filled in ContentDecodePolicy, when we deserialize - self._content = None # type: Optional[bytes] - self._text = None # type: Optional[str] + request: HttpRequest + status_code: int + headers: Optional[HeadersType] + reason: str + content_type: str + is_closed: bool + is_stream_consumed: bool - @property - def url(self) -> str: - """Returns the URL that resulted in this response""" - return self.request.url @property - def encoding(self) -> Optional[str]: + def encoding(self): + # type: (...) -> Optional[str] """Returns the response encoding. :return: The response encoding. We either return the encoding set by the user, @@ -252,17 +210,22 @@ def encoding(self) -> Optional[str]: we return `None`. :rtype: optional[str] """ - try: - return self._encoding - except AttributeError: - self._encoding: Optional[str] = get_charset_encoding(self) - return self._encoding + ... @encoding.setter - def encoding(self, value: str) -> None: + def encoding(self, value): + # type: (Optional[str]) -> None """Sets the response encoding""" - self._encoding = value - self._text = None # clear text cache + + @property + def url(self) -> str: + """The URL that resulted in this response""" + ... + + @property + def content(self) -> bytes: + """Return the response's content in bytes.""" + ... def text(self, encoding: Optional[str] = None) -> str: """Returns the response body as a string @@ -271,10 +234,7 @@ def text(self, encoding: Optional[str] = None) -> str: also be set independently through our encoding property :return: The response's content decoded as a string. """ - if self._text is None or encoding: - encoding_to_pass = encoding or self.encoding - self._text = decode_to_text(encoding_to_pass, self.content) - return self._text + ... def json(self) -> Any: """Returns the whole body as a json object. @@ -283,29 +243,17 @@ def json(self) -> Any: :rtype: any :raises json.decoder.JSONDecodeError or ValueError (in python 2.7) if object is not JSON decodable: """ - # this will trigger errors if response is not read in - self.content # pylint: disable=pointless-statement - if not self._json: - self._json = loads(self.text()) - return self._json + ... def raise_for_status(self) -> None: """Raises an HttpResponseError if the response has an error status code. If response is good, does nothing. """ - if cast(int, self.status_code) >= 400: - raise HttpResponseError(response=self) - - @property - def content(self) -> bytes: - """Return the response's content in bytes.""" - if self._content is None: - raise ResponseNotReadError(self) - return self._content + ... class HttpResponse(_HttpResponseBase): - """**Provisional** object that represents an HTTP response. + """**Provisional** protocol object that represents an HTTP response. **This object is provisional**, meaning it may be changed in a future release. @@ -318,8 +266,6 @@ class HttpResponse(_HttpResponseBase): >>> response = client.send_request(request) - :keyword request: The request that resulted in this response. - :paramtype request: ~azure.core.rest.HttpRequest :ivar int status_code: The status code of this response :ivar mapping headers: The response headers :ivar str reason: The reason phrase for this response @@ -327,7 +273,6 @@ class HttpResponse(_HttpResponseBase): :ivar str url: The URL that resulted in this response :ivar str encoding: The response encoding. Is settable, by default is the response Content-Type header - :ivar str text: The response body as a string. :ivar request: The request that resulted in this response. :vartype request: ~azure.core.rest.HttpRequest :ivar str content_type: The content type of the response @@ -336,20 +281,11 @@ class HttpResponse(_HttpResponseBase): whether the stream has been fully consumed """ - def __enter__(self) -> "HttpResponse": - return self + def __enter__(self) -> "HttpResponse": ... - def close(self) -> None: - """Close the response + def __exit__(self, *args) -> None: ... - :return: None - :rtype: None - """ - self.is_closed = True - self._internal_response.close() - - def __exit__(self, *args) -> None: - self.close() + def close(self) -> None: ... def read(self) -> bytes: """Read the response's bytes. @@ -357,9 +293,7 @@ def read(self) -> bytes: :return: The read in bytes :rtype: bytes """ - if self._content is None: - self._content = b"".join(self.iter_bytes()) - return self.content + ... def iter_raw(self) -> Iterator[bytes]: """Iterates over the response's bytes. Will not decompress in the process @@ -367,7 +301,7 @@ def iter_raw(self) -> Iterator[bytes]: :return: An iterator of bytes from the response :rtype: Iterator[str] """ - raise NotImplementedError() + ... def iter_bytes(self) -> Iterator[bytes]: """Iterates over the response's bytes. Will decompress in the process @@ -375,7 +309,7 @@ def iter_bytes(self) -> Iterator[bytes]: :return: An iterator of bytes from the response :rtype: Iterator[str] """ - raise NotImplementedError() + ... def iter_text(self) -> Iterator[str]: """Iterates over the text in the response. @@ -383,9 +317,7 @@ def iter_text(self) -> Iterator[str]: :return: An iterator of string. Each string chunk will be a text from the response :rtype: Iterator[str] """ - for byte in self.iter_bytes(): - text = byte.decode(self.encoding or "utf-8") - yield text + ... def iter_lines(self) -> Iterator[str]: """Iterates over the lines in the response. @@ -393,21 +325,10 @@ def iter_lines(self) -> Iterator[str]: :return: An iterator of string. Each string chunk will be a line from the response :rtype: Iterator[str] """ - for text in self.iter_text(): - lines = parse_lines_from_text(text) - for line in lines: - yield line - - def __repr__(self) -> str: - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "".format( - self.status_code, self.reason, content_type_str - ) + ... class AsyncHttpResponse(_HttpResponseBase): - """**Provisional** object that represents an Async HTTP response. + """**Provisional** protocol object that represents an Async HTTP response. **This object is provisional**, meaning it may be changed in a future release. @@ -420,8 +341,6 @@ class AsyncHttpResponse(_HttpResponseBase): >>> response = await client.send_request(request) - :keyword request: The request that resulted in this response. - :paramtype request: ~azure.core.rest.HttpRequest :ivar int status_code: The status code of this response :ivar mapping headers: The response headers :ivar str reason: The reason phrase for this response @@ -429,7 +348,6 @@ class AsyncHttpResponse(_HttpResponseBase): :ivar str url: The URL that resulted in this response :ivar str encoding: The response encoding. Is settable, by default is the response Content-Type header - :ivar str text: The response body as a string. :ivar request: The request that resulted in this response. :vartype request: ~azure.core.rest.HttpRequest :ivar str content_type: The content type of the response @@ -444,12 +362,7 @@ async def read(self) -> bytes: :return: The response's bytes :rtype: bytes """ - if self._content is None: - parts = [] - async for part in self.iter_bytes(): - parts.append(part) - self._content = b"".join(parts) - return self._content + ... async def iter_raw(self) -> AsyncIterator[bytes]: """Asynchronously iterates over the response's bytes. Will not decompress in the process @@ -477,9 +390,9 @@ async def iter_text(self) -> AsyncIterator[str]: :return: An async iterator of string. Each string chunk will be a text from the response :rtype: AsyncIterator[str] """ - async for byte in self.iter_bytes(): # type: ignore - text = byte.decode(self.encoding or "utf-8") - yield text + raise NotImplementedError() + # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 + yield # pylint: disable=unreachable async def iter_lines(self) -> AsyncIterator[str]: """Asynchronously iterates over the lines in the response. @@ -487,27 +400,10 @@ async def iter_lines(self) -> AsyncIterator[str]: :return: An async iterator of string. Each string chunk will be a line from the response :rtype: AsyncIterator[str] """ - async for text in self.iter_text(): - lines = parse_lines_from_text(text) - for line in lines: - yield line - - async def close(self) -> None: - """Close the response. - - :return: None - :rtype: None - """ - self.is_closed = True - await self._internal_response.close() + raise NotImplementedError() + # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 + yield # pylint: disable=unreachable - async def __aexit__(self, *args) -> None: - await self.close() + async def close(self) -> None: ... - def __repr__(self) -> str: - content_type_str = ( - ", Content-Type: {}".format(self.content_type) if self.content_type else "" - ) - return "".format( - self.status_code, self.reason, content_type_str - ) + async def __aexit__(self, *args) -> None: ... From c2157a54860304a46cf212f519ea4156325c1b35 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 27 Aug 2021 16:22:44 -0400 Subject: [PATCH 08/10] update changelog --- sdk/core/azure-core/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 811230155bbb..69ecf0ee701f 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -10,6 +10,8 @@ - The `text` property on `azure.core.rest.HttpResponse` and `azure.core.rest.AsyncHttpResponse` has changed to a method, which also takes an `encoding` parameter. +- `azure.core.rest.HttpResponse` and `azure.core.rest.AsyncHttpResponse` are now protocols. They should not be initialized directly, instead +your transport responses should inherit from them and implement their protocol. ### Bugs Fixed From bdbbb6e1ad337421c5c7af763a730ca3d9bf3707 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 27 Aug 2021 16:48:09 -0400 Subject: [PATCH 09/10] add initial tests --- sdk/core/azure-core/azure/core/rest/_rest.py | 5 +---- .../azure-core/azure/core/rest/_rest_py3.py | 4 ++-- .../async_tests/test_rest_protocol_async.py | 17 +++++++++++++++++ sdk/core/azure-core/tests/test_rest_protocol.py | 17 +++++++++++++++++ 4 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py create mode 100644 sdk/core/azure-core/tests/test_rest_protocol.py diff --git a/sdk/core/azure-core/azure/core/rest/_rest.py b/sdk/core/azure-core/azure/core/rest/_rest.py index 42172529df64..d61e43b211e1 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest.py +++ b/sdk/core/azure-core/azure/core/rest/_rest.py @@ -245,7 +245,7 @@ def content(self): """Return the response's content in bytes.""" -class HttpResponse(_HttpResponseBase): +class HttpResponse(_HttpResponseBase, Protocol): """**Provisional** protocol object that represents an HTTP response. **This object is provisional**, meaning it may be changed in a future release. @@ -259,8 +259,6 @@ class HttpResponse(_HttpResponseBase): >>> response = client.send_request(request) - :keyword request: The request that resulted in this response. - :paramtype request: ~azure.core.rest.HttpRequest :ivar int status_code: The status code of this response :ivar mapping headers: The response headers :ivar str reason: The reason phrase for this response @@ -268,7 +266,6 @@ class HttpResponse(_HttpResponseBase): :ivar str url: The URL that resulted in this response :ivar str encoding: The response encoding. Is settable, by default is the response Content-Type header - :ivar str text: The response body as a string. :ivar request: The request that resulted in this response. :vartype request: ~azure.core.rest.HttpRequest :ivar str content_type: The content type of the response diff --git a/sdk/core/azure-core/azure/core/rest/_rest_py3.py b/sdk/core/azure-core/azure/core/rest/_rest_py3.py index 88b61d7ab368..63dcaaf070db 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest_py3.py +++ b/sdk/core/azure-core/azure/core/rest/_rest_py3.py @@ -252,7 +252,7 @@ def raise_for_status(self) -> None: """ ... -class HttpResponse(_HttpResponseBase): +class HttpResponse(_HttpResponseBase, Protocol): """**Provisional** protocol object that represents an HTTP response. **This object is provisional**, meaning it may be changed in a future release. @@ -327,7 +327,7 @@ def iter_lines(self) -> Iterator[str]: """ ... -class AsyncHttpResponse(_HttpResponseBase): +class AsyncHttpResponse(_HttpResponseBase, Protocol): """**Provisional** protocol object that represents an Async HTTP response. **This object is provisional**, meaning it may be changed in a future release. diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py new file mode 100644 index 000000000000..84253d96c781 --- /dev/null +++ b/sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE.txt in the project root for +# license information. +# -------------------------------------------------------------------------= +import pytest +from azure.core.rest import AsyncHttpResponse + +def test_initialize_response(): + with pytest.raises(TypeError) as ex: + AsyncHttpResponse() + assert "Protocols cannot be instantiated" in str(ex) + +def test_no_required_params(): + class MyHttpResponse(AsyncHttpResponse): + pass + MyHttpResponse() diff --git a/sdk/core/azure-core/tests/test_rest_protocol.py b/sdk/core/azure-core/tests/test_rest_protocol.py new file mode 100644 index 000000000000..d8e5762693cb --- /dev/null +++ b/sdk/core/azure-core/tests/test_rest_protocol.py @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +import pytest +from azure.core.rest import HttpResponse + +def test_initialize_response(): + with pytest.raises(TypeError) as ex: + HttpResponse() + assert "Protocols cannot be instantiated" in str(ex) + +def test_no_required_params(): + class MyHttpResponse(HttpResponse): + pass + MyHttpResponse() From 324f1ae9574391fa91c1ec214561d3629f25620f Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 27 Aug 2021 18:58:59 -0400 Subject: [PATCH 10/10] switch from protocol to abc --- sdk/core/azure-core/CHANGELOG.md | 4 +- .../azure/core/_pipeline_client_async.py | 1 + .../azure-core/azure/core/pipeline/_tools.py | 3 +- .../azure/core/pipeline/_tools_async.py | 3 +- .../azure-core/azure/core/rest/_aiohttp.py | 28 ++++- .../azure/core/rest/_helpers_py3.py | 2 +- .../azure/core/rest/_http_response_impl.py | 44 +++++-- .../core/rest/_http_response_impl_async.py | 3 +- .../azure/core/rest/_requests_asyncio.py | 3 +- .../azure/core/rest/_requests_basic.py | 35 ++++-- .../azure/core/rest/_requests_trio.py | 3 +- sdk/core/azure-core/azure/core/rest/_rest.py | 78 +++++++++++-- .../azure-core/azure/core/rest/_rest_py3.py | 107 ++++++++++++++---- .../test_rest_asyncio_transport.py | 14 ++- .../test_rest_http_response_async.py | 19 +++- .../async_tests/test_rest_protocol_async.py | 17 --- .../async_tests/test_rest_trio_transport.py | 15 ++- .../tests/test_rest_http_response.py | 16 ++- .../azure-core/tests/test_rest_protocol.py | 17 --- sdk/core/azure-core/tests/utils.py | 49 ++++++++ 20 files changed, 353 insertions(+), 108 deletions(-) delete mode 100644 sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py delete mode 100644 sdk/core/azure-core/tests/test_rest_protocol.py create mode 100644 sdk/core/azure-core/tests/utils.py diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 69ecf0ee701f..7fee9a8442fe 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -10,8 +10,8 @@ - The `text` property on `azure.core.rest.HttpResponse` and `azure.core.rest.AsyncHttpResponse` has changed to a method, which also takes an `encoding` parameter. -- `azure.core.rest.HttpResponse` and `azure.core.rest.AsyncHttpResponse` are now protocols. They should not be initialized directly, instead -your transport responses should inherit from them and implement their protocol. +- `azure.core.rest.HttpResponse` and `azure.core.rest.AsyncHttpResponse` are now abstract base classes. They should not be initialized directly, instead +your transport responses should inherit from them and implement them. ### Bugs Fixed diff --git a/sdk/core/azure-core/azure/core/_pipeline_client_async.py b/sdk/core/azure-core/azure/core/_pipeline_client_async.py index f6c7f37277dd..b64e7e47daa4 100644 --- a/sdk/core/azure-core/azure/core/_pipeline_client_async.py +++ b/sdk/core/azure-core/azure/core/_pipeline_client_async.py @@ -209,6 +209,7 @@ async def _make_pipeline_call(self, request, **kwargs): # the body is loaded. instead of doing response.read(), going to set the body # to the internal content rest_response._content = response.body() # pylint: disable=protected-access + await rest_response.read() await rest_response.close() except Exception as exc: await rest_response.close() diff --git a/sdk/core/azure-core/azure/core/pipeline/_tools.py b/sdk/core/azure-core/azure/core/pipeline/_tools.py index a8beebd75b99..f3ce9826e614 100644 --- a/sdk/core/azure-core/azure/core/pipeline/_tools.py +++ b/sdk/core/azure-core/azure/core/pipeline/_tools.py @@ -46,11 +46,10 @@ def to_rest_request(pipeline_transport_request): def to_rest_response(pipeline_transport_response): from .transport._requests_basic import RequestsTransportResponse from ..rest._requests_basic import RestRequestsTransportResponse - from ..rest import HttpResponse if isinstance(pipeline_transport_response, RequestsTransportResponse): response_type = RestRequestsTransportResponse else: - response_type = HttpResponse + raise ValueError("Unknown transport response") response = response_type( request=to_rest_request(pipeline_transport_response.request), internal_response=pipeline_transport_response.internal_response, diff --git a/sdk/core/azure-core/azure/core/pipeline/_tools_async.py b/sdk/core/azure-core/azure/core/pipeline/_tools_async.py index de59dfdd86ed..098043d2c6de 100644 --- a/sdk/core/azure-core/azure/core/pipeline/_tools_async.py +++ b/sdk/core/azure-core/azure/core/pipeline/_tools_async.py @@ -55,8 +55,7 @@ def _get_response_type(pipeline_transport_response): return RestTrioRequestsTransportResponse except ImportError: pass - from ..rest import AsyncHttpResponse - return AsyncHttpResponse + raise ValueError("Unknown transport response") def to_rest_response(pipeline_transport_response): response_type = _get_response_type(pipeline_transport_response) diff --git a/sdk/core/azure-core/azure/core/rest/_aiohttp.py b/sdk/core/azure-core/azure/core/rest/_aiohttp.py index 9b5b1bc0848a..7044b666d235 100644 --- a/sdk/core/azure-core/azure/core/rest/_aiohttp.py +++ b/sdk/core/azure-core/azure/core/rest/_aiohttp.py @@ -29,6 +29,7 @@ from multidict import CIMultiDict from . import HttpRequest from ._http_response_impl_async import AsyncHttpResponseImpl +from ._helpers import HeadersType from ._helpers_py3 import iter_raw_helper, iter_bytes_helper from ..pipeline.transport._aiohttp import AioHttpStreamDownloadGenerator @@ -41,10 +42,27 @@ def __init__( internal_response, ): super().__init__(request=request, internal_response=internal_response) - self.status_code = internal_response.status - self.headers = CIMultiDict(internal_response.headers) # type: ignore - self.reason = internal_response.reason - self.content_type = internal_response.headers.get('content-type') + self._headers = CIMultiDict(internal_response.headers) # type: ignore + + @property + def status_code(self) -> int: + """The status code of this response""" + return self._internal_response.status + + @property + def headers(self) -> HeadersType: + """The response headers""" + return self._headers + + @property + def content_type(self) -> str: + """The content type of the response""" + return self._internal_response.headers.get('content-type') + + @property + def reason(self) -> str: + """The reason phrase for this response""" + return self._internal_response.reason async def iter_raw(self) -> AsyncIterator[bytes]: """Asynchronously iterates over the response's bytes. Will not decompress in the process @@ -83,6 +101,6 @@ async def close(self) -> None: :return: None :rtype: None """ - self.is_closed = True + self._is_closed = True self._internal_response.close() await asyncio.sleep(0) diff --git a/sdk/core/azure-core/azure/core/rest/_helpers_py3.py b/sdk/core/azure-core/azure/core/rest/_helpers_py3.py index 90948012db2a..dccf3e67e3b2 100644 --- a/sdk/core/azure-core/azure/core/rest/_helpers_py3.py +++ b/sdk/core/azure-core/azure/core/rest/_helpers_py3.py @@ -65,7 +65,7 @@ def _stream_download_helper( if response.is_closed: raise StreamClosedError(response) - response.is_stream_consumed = True + response._is_stream_consumed = True # pylint: disable=protected-access return stream_download_generator( pipeline=None, response=response, diff --git a/sdk/core/azure-core/azure/core/rest/_http_response_impl.py b/sdk/core/azure-core/azure/core/rest/_http_response_impl.py index 5954b4178c90..efc99aeb31c1 100644 --- a/sdk/core/azure-core/azure/core/rest/_http_response_impl.py +++ b/sdk/core/azure-core/azure/core/rest/_http_response_impl.py @@ -33,32 +33,56 @@ ) from ..exceptions import HttpResponseError, ResponseNotReadError try: - from ._rest_py3 import _HttpResponseBase, HttpResponse as _HttpResponse + from ._rest_py3 import ( + _HttpResponseBase, + HttpResponse as _HttpResponse, + HttpRequest as _HttpRequest + ) except (SyntaxError, ImportError): - from ._rest import _HttpResponseBase, HttpResponse as _HttpResponse # type: ignore + from ._rest import ( # type: ignore + _HttpResponseBase, + HttpResponse as _HttpResponse, + HttpRequest as _HttpRequest + ) -class _HttpResponseBaseImpl(_HttpResponseBase): # pylint: disable=too-many-instance-attributes +class _HttpResponseBaseImpl(_HttpResponseBase): def __init__(self, **kwargs): # type: (Any) -> None super(_HttpResponseBaseImpl, self).__init__() - self.request = kwargs.pop("request") + self._request = kwargs.pop("request") self._internal_response = kwargs.pop("internal_response") - self.headers = {} # type: HeadersType - self.is_closed = False - self.is_stream_consumed = False + self._is_closed = False + self._is_stream_consumed = False self._connection_data_block_size = None self._json = None # this is filled in ContentDecodePolicy, when we deserialize self._content = None # type: Optional[bytes] self._text = None # type: Optional[str] + @property + def request(self): + # type: (...) -> _HttpRequest + return self._request + @property def url(self): # type: (...) -> str """Returns the URL that resulted in this response""" return self.request.url + @property + def is_closed(self): + # type: (...) -> bool + """Whether the network connection has been closed yet""" + return self._is_closed + + @property + def is_stream_consumed(self): + # type: (...) -> bool + """Whether the stream has been fully consumed""" + return self._is_stream_consumed + @property def encoding(self): # type: (...) -> Optional[str] @@ -135,7 +159,7 @@ def __repr__(self): self.status_code, self.reason, content_type_str ) -class HttpResponseImpl(_HttpResponseBaseImpl, _HttpResponse): # pylint: disable=too-many-instance-attributes +class HttpResponseImpl(_HttpResponseBaseImpl, _HttpResponse): """HttpResponseImpl built on top of our HttpResponse protocol class. Helper impl for creating our transport responses @@ -147,7 +171,7 @@ def __enter__(self): def close(self): # type: (...) -> None - self.is_closed = True + self._is_closed = True self._internal_response.close() def __exit__(self, *args): @@ -181,5 +205,5 @@ def iter_lines(self): def _close_stream(self): # type: (...) -> None - self.is_stream_consumed = True + self._is_stream_consumed = True self.close() diff --git a/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py b/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py index 47e2c243d070..e08f75d61485 100644 --- a/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py +++ b/sdk/core/azure-core/azure/core/rest/_http_response_impl_async.py @@ -45,6 +45,7 @@ async def read(self) -> bytes: async for part in self.iter_bytes(): parts.append(part) self._content = b"".join(parts) + self._is_stream_consumed = True return self._content async def iter_text(self) -> AsyncIterator[str]: @@ -94,7 +95,7 @@ async def close(self) -> None: :return: None :rtype: None """ - self.is_closed = True + self._is_closed = True await self._internal_response.close() async def __aexit__(self, *args) -> None: diff --git a/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py b/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py index 73ee5cdffc9b..b2866dc1ceca 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_asyncio.py @@ -65,7 +65,7 @@ async def close(self) -> None: :return: None :rtype: None """ - self.is_closed = True + self._is_closed = True self._internal_response.close() await asyncio.sleep(0) @@ -80,4 +80,5 @@ async def read(self) -> bytes: async for part in self.iter_bytes(): # type: ignore parts.append(part) self._internal_response._content = b"".join(parts) # pylint: disable=protected-access + self._is_stream_consumed = True return self.content diff --git a/sdk/core/azure-core/azure/core/rest/_requests_basic.py b/sdk/core/azure-core/azure/core/rest/_requests_basic.py index 7844a04fd8c7..8c6960b8e133 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_basic.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_basic.py @@ -28,6 +28,7 @@ from ..exceptions import ResponseNotReadError, StreamConsumedError, StreamClosedError from ._http_response_impl import _HttpResponseBaseImpl, HttpResponseImpl from ..pipeline.transport._requests_basic import StreamDownloadGenerator +from ._helpers import HeadersType if TYPE_CHECKING: from typing import Iterator, Optional @@ -40,12 +41,30 @@ def _has_content(response): return False class _RestRequestsTransportResponseBase(_HttpResponseBaseImpl): - def __init__(self, **kwargs): - super(_RestRequestsTransportResponseBase, self).__init__(**kwargs) - self.status_code = self._internal_response.status_code - self.headers = self._internal_response.headers - self.reason = self._internal_response.reason - self.content_type = self._internal_response.headers.get('content-type') + + @property + def status_code(self): + # type: (...) -> int + """The status code of this response""" + return self._internal_response.status_code + + @property + def headers(self): + # type: (...) -> Optional[HeadersType] + return self._internal_response.headers + + @property + def reason(self): + # type: (...) -> str + """The response headers""" + return self._internal_response.reason + + @property + def content_type(self): + # type: (...) -> str + """The content type of the response""" + return self._internal_response.headers.get('content-type') + @property def content(self): @@ -62,12 +81,13 @@ def content(self): raise ResponseNotReadError(self) def _stream_download_helper(decompress, response): + # type: (bool, _RestRequestsTransportResponseBase) -> Iterator[bytes] if response.is_stream_consumed: raise StreamConsumedError(response) if response.is_closed: raise StreamClosedError(response) - response.is_stream_consumed = True + response._is_stream_consumed = True # pylint: disable=protected-access stream_download = StreamDownloadGenerator( pipeline=None, response=response, @@ -118,4 +138,5 @@ def read(self): """ if not _has_content(self): self._internal_response._content = b"".join(self.iter_bytes()) # pylint: disable=protected-access + self._is_stream_consumed = True return self.content diff --git a/sdk/core/azure-core/azure/core/rest/_requests_trio.py b/sdk/core/azure-core/azure/core/rest/_requests_trio.py index 81cb2db2d47d..98d8565ead5e 100644 --- a/sdk/core/azure-core/azure/core/rest/_requests_trio.py +++ b/sdk/core/azure-core/azure/core/rest/_requests_trio.py @@ -69,9 +69,10 @@ async def read(self) -> bytes: async for part in self.iter_bytes(): # type: ignore parts.append(part) self._internal_response._content = b"".join(parts) # pylint: disable=protected-access + self._is_stream_consumed = True return self.content async def close(self) -> None: - self.is_closed = True + self._is_closed = True self._internal_response.close() await trio.sleep(0) diff --git a/sdk/core/azure-core/azure/core/rest/_rest.py b/sdk/core/azure-core/azure/core/rest/_rest.py index d61e43b211e1..0bcf683ff0e7 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest.py +++ b/sdk/core/azure-core/azure/core/rest/_rest.py @@ -23,9 +23,10 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- +import abc import copy -from typing import TYPE_CHECKING, Protocol +from typing import TYPE_CHECKING from ..utils._utils import _case_insensitive_dict from ._helpers import ( @@ -53,7 +54,10 @@ from ._helpers import HeadersType, ContentTypeBase as ContentType - +try: + ABC = abc.ABC +except AttributeError: # Python 2.7, abc exists, but not ABC + ABC = abc.ABCMeta("ABC", (object,), {"__slots__": ()}) # type: ignore ################################## CLASSES ###################################### @@ -184,16 +188,52 @@ def _to_pipeline_transport_request(self): def _from_pipeline_transport_request(cls, pipeline_transport_request): return from_pipeline_transport_request_helper(cls, pipeline_transport_request) -class _HttpResponseBase(Protocol): - request = None # type: HttpRequest - headers = None # type: HeadersType - status_code = None # type: int - reason = None # type: str - content_type = None # type: str - is_closed = None # type: bool - is_stream_consumed = None # type: bool +class _HttpResponseBase(ABC): + + @property + @abc.abstractmethod + def request(self): + # type: (...) -> HttpRequest + """The request that resulted in this response.""" + + @property + @abc.abstractmethod + def status_code(self): + # type: (...) -> int + """The status code of this response""" + + @property + @abc.abstractmethod + def headers(self): + # type: (...) -> Optional[HeadersType] + """The response headers""" + + @property + @abc.abstractmethod + def reason(self): + # type: (...) -> str + """The reason phrase for this response""" + + @property + @abc.abstractmethod + def content_type(self): + # type: (...) -> str + """The content type of the response""" + + @property + @abc.abstractmethod + def is_closed(self): + # type: (...) -> bool + """Whether the network connection has been closed yet""" + + @property + @abc.abstractmethod + def is_stream_consumed(self): + # type: (...) -> bool + """Whether the stream has been fully consumed""" @property + @abc.abstractmethod def encoding(self): # type: (...) -> Optional[str] """Returns the response encoding. @@ -210,10 +250,12 @@ def encoding(self, value): """Sets the response encoding""" @property + @abc.abstractmethod def url(self): # type: (...) -> str """Returns the URL that resulted in this response""" + @abc.abstractmethod def text(self, encoding=None): # type: (Optional[str]) -> str """Returns the response body as a string @@ -223,6 +265,7 @@ def text(self, encoding=None): :return: The response's content decoded as a string. """ + @abc.abstractmethod def json(self): # type: (...) -> Any """Returns the whole body as a json object. @@ -232,6 +275,7 @@ def json(self): :raises json.decoder.JSONDecodeError or ValueError (in python 2.7) if object is not JSON decodable: """ + @abc.abstractmethod def raise_for_status(self): # type: (...) -> None """Raises an HttpResponseError if the response has an error status code. @@ -240,15 +284,17 @@ def raise_for_status(self): """ @property + @abc.abstractmethod def content(self): # type: (...) -> bytes """Return the response's content in bytes.""" -class HttpResponse(_HttpResponseBase, Protocol): - """**Provisional** protocol object that represents an HTTP response. +class HttpResponse(_HttpResponseBase): + """**Provisional** abstract base class for HTTP responses. **This object is provisional**, meaning it may be changed in a future release. + Use this abstract base class to create your own transport responses. It is returned from your client's `send_request` method if you pass in an :class:`~azure.core.rest.HttpRequest` @@ -274,18 +320,22 @@ class HttpResponse(_HttpResponseBase, Protocol): whether the stream has been fully consumed """ + @abc.abstractmethod def __enter__(self): # type: (...) -> HttpResponse """Enter this response""" + @abc.abstractmethod def close(self): # type: (...) -> None """Close this response""" + @abc.abstractmethod def __exit__(self, *args): # type: (...) -> None """Exit this response""" + @abc.abstractmethod def read(self): # type: (...) -> bytes """Read the response's bytes. @@ -294,6 +344,7 @@ def read(self): :rtype: bytes """ + @abc.abstractmethod def iter_raw(self): # type: () -> Iterator[bytes] """Iterates over the response's bytes. Will not decompress in the process @@ -302,6 +353,7 @@ def iter_raw(self): :rtype: Iterator[str] """ + @abc.abstractmethod def iter_bytes(self): # type: () -> Iterator[bytes] """Iterates over the response's bytes. Will decompress in the process @@ -310,6 +362,7 @@ def iter_bytes(self): :rtype: Iterator[str] """ + @abc.abstractmethod def iter_text(self): # type: () -> Iterator[str] """Iterates over the text in the response. @@ -318,6 +371,7 @@ def iter_text(self): :rtype: Iterator[str] """ + @abc.abstractmethod def iter_lines(self): # type: () -> Iterator[str] """Iterates over the lines in the response. diff --git a/sdk/core/azure-core/azure/core/rest/_rest_py3.py b/sdk/core/azure-core/azure/core/rest/_rest_py3.py index 63dcaaf070db..8292562f2f50 100644 --- a/sdk/core/azure-core/azure/core/rest/_rest_py3.py +++ b/sdk/core/azure-core/azure/core/rest/_rest_py3.py @@ -23,6 +23,7 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- +import abc import copy from typing import ( Any, @@ -31,7 +32,6 @@ Iterable, Iterator, Optional, Union, - Protocol, ) from ..utils._utils import _case_insensitive_dict @@ -51,8 +51,6 @@ ContentType = Union[str, bytes, Iterable[bytes], AsyncIterable[bytes]] - - ################################## CLASSES ###################################### class HttpRequest: @@ -187,22 +185,55 @@ def _to_pipeline_transport_request(self): def _from_pipeline_transport_request(cls, pipeline_transport_request): return from_pipeline_transport_request_helper(cls, pipeline_transport_request) -class _HttpResponseBase(Protocol): - """Base Protocol class for HttpResponses +class _HttpResponseBase(abc.ABC): + """Base abstract base class for HttpResponses """ - request: HttpRequest - status_code: int - headers: Optional[HeadersType] - reason: str - content_type: str - is_closed: bool - is_stream_consumed: bool + @property + @abc.abstractmethod + def request(self) -> HttpRequest: + """The request that resulted in this response.""" + ... + + @property + @abc.abstractmethod + def status_code(self) -> int: + """The status code of this response""" + ... + + @property + @abc.abstractmethod + def headers(self) -> Optional[HeadersType]: + """The response headers""" + ... + + @property + @abc.abstractmethod + def reason(self) -> str: + """The reason phrase for this response""" + ... + + @property + @abc.abstractmethod + def content_type(self) -> str: + """The content type of the response""" + ... + @property + @abc.abstractmethod + def is_closed(self) -> bool: + """Whether the network connection has been closed yet""" + ... @property - def encoding(self): - # type: (...) -> Optional[str] + @abc.abstractmethod + def is_stream_consumed(self) -> bool: + """Whether the stream has been fully consumed""" + ... + + @property + @abc.abstractmethod + def encoding(self) -> Optional[str]: """Returns the response encoding. :return: The response encoding. We either return the encoding set by the user, @@ -213,20 +244,22 @@ def encoding(self): ... @encoding.setter - def encoding(self, value): - # type: (Optional[str]) -> None + def encoding(self, value: Optional[str]) -> None: """Sets the response encoding""" @property + @abc.abstractmethod def url(self) -> str: """The URL that resulted in this response""" ... @property + @abc.abstractmethod def content(self) -> bytes: """Return the response's content in bytes.""" ... + @abc.abstractmethod def text(self, encoding: Optional[str] = None) -> str: """Returns the response body as a string @@ -236,6 +269,7 @@ def text(self, encoding: Optional[str] = None) -> str: """ ... + @abc.abstractmethod def json(self) -> Any: """Returns the whole body as a json object. @@ -245,6 +279,7 @@ def json(self) -> Any: """ ... + @abc.abstractmethod def raise_for_status(self) -> None: """Raises an HttpResponseError if the response has an error status code. @@ -252,10 +287,11 @@ def raise_for_status(self) -> None: """ ... -class HttpResponse(_HttpResponseBase, Protocol): - """**Provisional** protocol object that represents an HTTP response. +class HttpResponse(_HttpResponseBase): + """**Provisional** abstract base class for HTTP responses. **This object is provisional**, meaning it may be changed in a future release. + Use this abstract base class to create your own transport responses. It is returned from your client's `send_request` method if you pass in an :class:`~azure.core.rest.HttpRequest` @@ -281,12 +317,19 @@ class HttpResponse(_HttpResponseBase, Protocol): whether the stream has been fully consumed """ - def __enter__(self) -> "HttpResponse": ... + @abc.abstractmethod + def __enter__(self) -> "HttpResponse": + ... - def __exit__(self, *args) -> None: ... + @abc.abstractmethod + def __exit__(self, *args) -> None: + ... - def close(self) -> None: ... + @abc.abstractmethod + def close(self) -> None: + ... + @abc.abstractmethod def read(self) -> bytes: """Read the response's bytes. @@ -295,6 +338,7 @@ def read(self) -> bytes: """ ... + @abc.abstractmethod def iter_raw(self) -> Iterator[bytes]: """Iterates over the response's bytes. Will not decompress in the process @@ -303,6 +347,7 @@ def iter_raw(self) -> Iterator[bytes]: """ ... + @abc.abstractmethod def iter_bytes(self) -> Iterator[bytes]: """Iterates over the response's bytes. Will decompress in the process @@ -311,6 +356,7 @@ def iter_bytes(self) -> Iterator[bytes]: """ ... + @abc.abstractmethod def iter_text(self) -> Iterator[str]: """Iterates over the text in the response. @@ -319,6 +365,7 @@ def iter_text(self) -> Iterator[str]: """ ... + @abc.abstractmethod def iter_lines(self) -> Iterator[str]: """Iterates over the lines in the response. @@ -327,10 +374,11 @@ def iter_lines(self) -> Iterator[str]: """ ... -class AsyncHttpResponse(_HttpResponseBase, Protocol): - """**Provisional** protocol object that represents an Async HTTP response. +class AsyncHttpResponse(_HttpResponseBase): + """**Provisional** abstract base class for Async HTTP responses. **This object is provisional**, meaning it may be changed in a future release. + Use this abstract base class to create your own transport responses. It is returned from your async client's `send_request` method if you pass in an :class:`~azure.core.rest.HttpRequest` @@ -356,6 +404,7 @@ class AsyncHttpResponse(_HttpResponseBase, Protocol): whether the stream has been fully consumed """ + @abc.abstractmethod async def read(self) -> bytes: """Read the response's bytes into memory. @@ -364,6 +413,7 @@ async def read(self) -> bytes: """ ... + @abc.abstractmethod async def iter_raw(self) -> AsyncIterator[bytes]: """Asynchronously iterates over the response's bytes. Will not decompress in the process @@ -374,6 +424,7 @@ async def iter_raw(self) -> AsyncIterator[bytes]: # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 yield # pylint: disable=unreachable + @abc.abstractmethod async def iter_bytes(self) -> AsyncIterator[bytes]: """Asynchronously iterates over the response's bytes. Will decompress in the process @@ -384,6 +435,7 @@ async def iter_bytes(self) -> AsyncIterator[bytes]: # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 yield # pylint: disable=unreachable + @abc.abstractmethod async def iter_text(self) -> AsyncIterator[str]: """Asynchronously iterates over the text in the response. @@ -394,6 +446,7 @@ async def iter_text(self) -> AsyncIterator[str]: # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 yield # pylint: disable=unreachable + @abc.abstractmethod async def iter_lines(self) -> AsyncIterator[str]: """Asynchronously iterates over the lines in the response. @@ -404,6 +457,10 @@ async def iter_lines(self) -> AsyncIterator[str]: # getting around mypy behavior, see https://github.com/python/mypy/issues/10732 yield # pylint: disable=unreachable - async def close(self) -> None: ... + @abc.abstractmethod + async def close(self) -> None: + ... - async def __aexit__(self, *args) -> None: ... + @abc.abstractmethod + async def __aexit__(self, *args) -> None: + ... diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py b/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py index 9f5052cdb4bd..11a2ca3f52ca 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_asyncio_transport.py @@ -5,10 +5,11 @@ # ------------------------------------------------------------------------- from azure.core.pipeline.transport import AsyncioRequestsTransport from azure.core.rest import HttpRequest +from azure.core.rest._requests_asyncio import RestAsyncioRequestsTransportResponse from rest_client_async import AsyncTestRestClient import pytest - +from utils import readonly_checks @pytest.mark.asyncio async def test_async_gen_data(port): @@ -39,3 +40,14 @@ async def test_send_data(port): response = await client.send_request(request) assert response.json()['data'] == "azerty" + +@pytest.mark.asyncio +async def test_readonly(port): + """Make sure everything that is readonly is readonly""" + async with AsyncioRequestsTransport() as transport: + client = AsyncTestRestClient(port, transport=transport) + response = await client.send_request(HttpRequest("GET", "/health")) + response.raise_for_status() + + assert isinstance(response, RestAsyncioRequestsTransportResponse) + readonly_checks(response) diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py index 40587252a14f..7239dcd7a547 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_http_response_async.py @@ -8,8 +8,10 @@ # Thank you httpx for your wonderful tests! import io import pytest -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, AsyncHttpResponse +from azure.core.rest._aiohttp import RestAioHttpTransportResponse from azure.core.exceptions import HttpResponseError +from utils import readonly_checks @pytest.fixture def send_request(client): @@ -294,4 +296,17 @@ async def test_text_and_encoding(send_request): # "/multipart/non-seekable-filelike", # files=files, # ) -# await send_request(request) \ No newline at end of file +# await send_request(request) + +def test_initialize_response_abc(): + with pytest.raises(TypeError) as ex: + AsyncHttpResponse() + assert "Can't instantiate abstract class" in str(ex) + +@pytest.mark.asyncio +async def test_readonly(send_request): + """Make sure everything that is readonly is readonly""" + response = await send_request(HttpRequest("GET", "/health")) + + assert isinstance(response, RestAioHttpTransportResponse) + readonly_checks(response) diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py deleted file mode 100644 index 84253d96c781..000000000000 --- a/sdk/core/azure-core/tests/async_tests/test_rest_protocol_async.py +++ /dev/null @@ -1,17 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE.txt in the project root for -# license information. -# -------------------------------------------------------------------------= -import pytest -from azure.core.rest import AsyncHttpResponse - -def test_initialize_response(): - with pytest.raises(TypeError) as ex: - AsyncHttpResponse() - assert "Protocols cannot be instantiated" in str(ex) - -def test_no_required_params(): - class MyHttpResponse(AsyncHttpResponse): - pass - MyHttpResponse() diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py b/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py index ba9981df6697..18eb6ad7a84b 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_trio_transport.py @@ -5,8 +5,9 @@ # ------------------------------------------------------------------------- from azure.core.pipeline.transport import TrioRequestsTransport from azure.core.rest import HttpRequest +from azure.core.rest._requests_trio import RestTrioRequestsTransportResponse from rest_client_async import AsyncTestRestClient - +from utils import readonly_checks import pytest @@ -39,3 +40,15 @@ async def test_send_data(port): response = await client.send_request(request) assert response.json()['data'] == "azerty" + +@pytest.mark.trio +async def test_readonly(port): + """Make sure everything that is readonly is readonly""" + async with TrioRequestsTransport() as transport: + request = HttpRequest('GET', 'http://localhost:{}/health'.format(port)) + client = AsyncTestRestClient(port, transport=transport) + response = await client.send_request(HttpRequest("GET", "/health")) + response.raise_for_status() + + assert isinstance(response, RestTrioRequestsTransportResponse) + readonly_checks(response) diff --git a/sdk/core/azure-core/tests/test_rest_http_response.py b/sdk/core/azure-core/tests/test_rest_http_response.py index f3abec23a30a..a0ac268c52e4 100644 --- a/sdk/core/azure-core/tests/test_rest_http_response.py +++ b/sdk/core/azure-core/tests/test_rest_http_response.py @@ -11,9 +11,11 @@ import io import sys import pytest -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.rest._requests_basic import RestRequestsTransportResponse from azure.core.exceptions import HttpResponseError import xml.etree.ElementTree as ET +from utils import readonly_checks @pytest.fixture def send_request(client): @@ -311,3 +313,15 @@ def test_text_and_encoding(send_request): # assert latin-1 changes text decoding without changing encoding property assert response.text("latin-1") == u'ð\x9f\x91©' == response.content.decode("latin-1") assert response.encoding == "utf-16" + +def test_initialize_response_abc(): + with pytest.raises(TypeError) as ex: + HttpResponse() + assert "Can't instantiate abstract class" in str(ex) + +def test_readonly(send_request): + """Make sure everything that is readonly is readonly""" + response = send_request(HttpRequest("GET", "/health")) + + assert isinstance(response, RestRequestsTransportResponse) + readonly_checks(response) diff --git a/sdk/core/azure-core/tests/test_rest_protocol.py b/sdk/core/azure-core/tests/test_rest_protocol.py deleted file mode 100644 index d8e5762693cb..000000000000 --- a/sdk/core/azure-core/tests/test_rest_protocol.py +++ /dev/null @@ -1,17 +0,0 @@ -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See LICENSE.txt in the project root for -# license information. -# ------------------------------------------------------------------------- -import pytest -from azure.core.rest import HttpResponse - -def test_initialize_response(): - with pytest.raises(TypeError) as ex: - HttpResponse() - assert "Protocols cannot be instantiated" in str(ex) - -def test_no_required_params(): - class MyHttpResponse(HttpResponse): - pass - MyHttpResponse() diff --git a/sdk/core/azure-core/tests/utils.py b/sdk/core/azure-core/tests/utils.py new file mode 100644 index 000000000000..821aa63eb528 --- /dev/null +++ b/sdk/core/azure-core/tests/utils.py @@ -0,0 +1,49 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE.txt in the project root for +# license information. +# ------------------------------------------------------------------------- +import pytest +from azure.core.rest import HttpRequest + +def readonly_checks(response): + assert isinstance(response.request, HttpRequest) + with pytest.raises(AttributeError): + response.request = None + + assert isinstance(response.status_code, int) + with pytest.raises(AttributeError): + response.status_code = 200 + + assert response.headers + with pytest.raises(AttributeError): + response.headers = {"hello": "world"} + + assert response.reason == "OK" + with pytest.raises(AttributeError): + response.reason = "Not OK" + + assert response.content_type == 'text/html; charset=utf-8' + with pytest.raises(AttributeError): + response.content_type = "bad content type" + + assert response.is_closed + with pytest.raises(AttributeError): + response.is_closed = False + + assert response.is_stream_consumed + with pytest.raises(AttributeError): + response.is_stream_consumed = False + + # you can set encoding + assert response.encoding == "utf-8" + response.encoding = "blah" + assert response.encoding == "blah" + + assert isinstance(response.url, str) + with pytest.raises(AttributeError): + response.url = "http://fakeurl" + + assert response.content is not None + with pytest.raises(AttributeError): + response.content = b"bad" \ No newline at end of file