From 2df4fe5739d1351cba7acbb243db5fdc5eb208d7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 20 Jul 2021 23:48:19 +0000 Subject: [PATCH] CodeGen from PR 15275 in Azure/azure-rest-api-specs Merge 8b1e661e9478789602828f9c18024a54eb8363c0 into d241e05b224891ddc0147544213d8edccf53f7d9 --- sdk/maps/azure-maps-creator/CHANGELOG.md | 5 + sdk/maps/azure-maps-creator/MANIFEST.in | 6 + sdk/maps/azure-maps-creator/README.md | 27 + sdk/maps/azure-maps-creator/_meta.json | 11 + sdk/maps/azure-maps-creator/azure/__init__.py | 1 + .../azure-maps-creator/azure/maps/__init__.py | 1 + .../azure/maps/creator/__init__.py | 19 + .../azure/maps/creator/_configuration.py | 73 + .../azure/maps/creator/_creator_client.py | 124 + .../azure/maps/creator/_metadata.json | 110 + .../azure/maps/creator/_version.py | 9 + .../azure/maps/creator/aio/__init__.py | 10 + .../azure/maps/creator/aio/_configuration.py | 69 + .../azure/maps/creator/aio/_creator_client.py | 117 + .../maps/creator/aio/operations/__init__.py | 27 + .../aio/operations/_alias_operations.py | 504 +++ .../aio/operations/_conversion_operations.py | 572 ++++ .../aio/operations/_data_operations.py | 834 +++++ .../aio/operations/_dataset_operations.py | 627 ++++ .../operations/_feature_state_operations.py | 620 ++++ .../aio/operations/_spatial_operations.py | 944 ++++++ .../aio/operations/_tileset_operations.py | 501 +++ .../creator/aio/operations/_wfs_operations.py | 672 ++++ .../azure/maps/creator/models/__init__.py | 259 ++ .../creator/models/_creator_client_enums.py | 133 + .../azure/maps/creator/models/_models.py | 2601 ++++++++++++++++ .../azure/maps/creator/models/_models_py3.py | 2753 +++++++++++++++++ .../azure/maps/creator/operations/__init__.py | 27 + .../creator/operations/_alias_operations.py | 513 +++ .../operations/_conversion_operations.py | 582 ++++ .../creator/operations/_data_operations.py | 846 +++++ .../creator/operations/_dataset_operations.py | 637 ++++ .../operations/_feature_state_operations.py | 632 ++++ .../creator/operations/_spatial_operations.py | 957 ++++++ .../creator/operations/_tileset_operations.py | 511 +++ .../creator/operations/_wfs_operations.py | 684 ++++ .../azure/maps/creator/py.typed | 1 + .../azure-maps-creator/sdk_packaging.toml | 9 + sdk/maps/azure-maps-creator/setup.cfg | 2 + sdk/maps/azure-maps-creator/setup.py | 91 + 40 files changed, 17121 insertions(+) create mode 100644 sdk/maps/azure-maps-creator/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-creator/MANIFEST.in create mode 100644 sdk/maps/azure-maps-creator/README.md create mode 100644 sdk/maps/azure-maps-creator/_meta.json create mode 100644 sdk/maps/azure-maps-creator/azure/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_version.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/py.typed create mode 100644 sdk/maps/azure-maps-creator/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-creator/setup.cfg create mode 100644 sdk/maps/azure-maps-creator/setup.py diff --git a/sdk/maps/azure-maps-creator/CHANGELOG.md b/sdk/maps/azure-maps-creator/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-creator/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-creator/MANIFEST.in b/sdk/maps/azure-maps-creator/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /dev/null +++ b/sdk/maps/azure-maps-creator/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/maps/__init__.py + diff --git a/sdk/maps/azure-maps-creator/README.md b/sdk/maps/azure-maps-creator/README.md new file mode 100644 index 000000000000..b630555efe6d --- /dev/null +++ b/sdk/maps/azure-maps-creator/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-creator%2FREADME.png) diff --git a/sdk/maps/azure-maps-creator/_meta.json b/sdk/maps/azure-maps-creator/_meta.json new file mode 100644 index 000000000000..657fc5a9f486 --- /dev/null +++ b/sdk/maps/azure-maps-creator/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "ff86977884b0a3f23df909e6a742116bfb81ee28", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Creator/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/maps/data-plane/Creator/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-creator/azure/__init__.py b/sdk/maps/azure-maps-creator/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-creator/azure/maps/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py new file mode 100644 index 000000000000..a498de7096c7 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/__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 ._creator_client import CreatorClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['CreatorClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py b/sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py new file mode 100644 index 000000000000..e4d1f60285cb --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py @@ -0,0 +1,73 @@ +# 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 ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional, Union + + from azure.core.credentials import TokenCredential + + +class CreatorClientConfiguration(Configuration): + """Configuration for CreatorClient. + + 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(CreatorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-creator/{}'.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 policies.HttpLoggingPolicy(**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/maps/azure-maps-creator/azure/maps/creator/_creator_client.py b/sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py new file mode 100644 index 000000000000..bd7ffa7a9dd3 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py @@ -0,0 +1,124 @@ +# 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 import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional, Union + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import CreatorClientConfiguration +from .operations import AliasOperations +from .operations import DataOperations +from .operations import DatasetOperations +from .operations import ConversionOperations +from .operations import FeatureStateOperations +from .operations import SpatialOperations +from .operations import TilesetOperations +from .operations import WFSOperations +from . import models + + +class CreatorClient(object): + """APIs for managing aliases in Azure Maps. + + :ivar alias: AliasOperations operations + :vartype alias: azure.maps.creator.operations.AliasOperations + :ivar data: DataOperations operations + :vartype data: azure.maps.creator.operations.DataOperations + :ivar dataset: DatasetOperations operations + :vartype dataset: azure.maps.creator.operations.DatasetOperations + :ivar conversion: ConversionOperations operations + :vartype conversion: azure.maps.creator.operations.ConversionOperations + :ivar feature_state: FeatureStateOperations operations + :vartype feature_state: azure.maps.creator.operations.FeatureStateOperations + :ivar spatial: SpatialOperations operations + :vartype spatial: azure.maps.creator.operations.SpatialOperations + :ivar tileset: TilesetOperations operations + :vartype tileset: azure.maps.creator.operations.TilesetOperations + :ivar wfs: WFSOperations operations + :vartype wfs: azure.maps.creator.operations.WFSOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + :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" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = CreatorClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(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.alias = AliasOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data = DataOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dataset = DatasetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.conversion = ConversionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.feature_state = FeatureStateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.spatial = SpatialOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tileset = TilesetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.wfs = WFSOperations( + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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: () -> CreatorClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json b/sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json new file mode 100644 index 000000000000..6a47d2ea8ca9 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json @@ -0,0 +1,110 @@ +{ + "chosen_version": "", + "total_api_version_list": ["1.0", "2.0"], + "client": { + "name": "CreatorClient", + "filename": "_creator_client", + "description": "APIs for managing aliases in Azure Maps.", + "base_url": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"CreatorClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"CreatorClientConfiguration\"]}}}" + }, + "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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.creator.models.Geography", + "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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.creator.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "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 + }, + "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 + }, + "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://atlas.microsoft.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\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "alias": "AliasOperations", + "data": "DataOperations", + "dataset": "DatasetOperations", + "conversion": "ConversionOperations", + "feature_state": "FeatureStateOperations", + "spatial": "SpatialOperations", + "tileset": "TilesetOperations", + "wfs": "WFSOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_version.py b/sdk/maps/azure-maps-creator/azure/maps/creator/_version.py new file mode 100644 index 000000000000..c92f6c4472cf --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_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.0-preview" diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py new file mode 100644 index 000000000000..fb2feed1a1e3 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/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 ._creator_client import CreatorClient +__all__ = ['CreatorClient'] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py new file mode 100644 index 000000000000..79e22643ea3b --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py @@ -0,0 +1,69 @@ +# 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, Union + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class CreatorClientConfiguration(Configuration): + """Configuration for CreatorClient. + + 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(CreatorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-creator/{}'.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 policies.HttpLoggingPolicy(**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/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py new file mode 100644 index 000000000000..5de869a7d449 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py @@ -0,0 +1,117 @@ +# 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, Union + +from azure.core import AsyncPipelineClient +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import CreatorClientConfiguration +from .operations import AliasOperations +from .operations import DataOperations +from .operations import DatasetOperations +from .operations import ConversionOperations +from .operations import FeatureStateOperations +from .operations import SpatialOperations +from .operations import TilesetOperations +from .operations import WFSOperations +from .. import models + + +class CreatorClient(object): + """APIs for managing aliases in Azure Maps. + + :ivar alias: AliasOperations operations + :vartype alias: azure.maps.creator.aio.operations.AliasOperations + :ivar data: DataOperations operations + :vartype data: azure.maps.creator.aio.operations.DataOperations + :ivar dataset: DatasetOperations operations + :vartype dataset: azure.maps.creator.aio.operations.DatasetOperations + :ivar conversion: ConversionOperations operations + :vartype conversion: azure.maps.creator.aio.operations.ConversionOperations + :ivar feature_state: FeatureStateOperations operations + :vartype feature_state: azure.maps.creator.aio.operations.FeatureStateOperations + :ivar spatial: SpatialOperations operations + :vartype spatial: azure.maps.creator.aio.operations.SpatialOperations + :ivar tileset: TilesetOperations operations + :vartype tileset: azure.maps.creator.aio.operations.TilesetOperations + :ivar wfs: WFSOperations operations + :vartype wfs: azure.maps.creator.aio.operations.WFSOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + :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", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = CreatorClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(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.alias = AliasOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data = DataOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dataset = DatasetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.conversion = ConversionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.feature_state = FeatureStateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.spatial = SpatialOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tileset = TilesetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.wfs = WFSOperations( + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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) -> "CreatorClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py new file mode 100644 index 000000000000..caac2ed53e58 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._alias_operations import AliasOperations +from ._data_operations import DataOperations +from ._dataset_operations import DatasetOperations +from ._conversion_operations import ConversionOperations +from ._feature_state_operations import FeatureStateOperations +from ._spatial_operations import SpatialOperations +from ._tileset_operations import TilesetOperations +from ._wfs_operations import WFSOperations + +__all__ = [ + 'AliasOperations', + 'DataOperations', + 'DatasetOperations', + 'ConversionOperations', + 'FeatureStateOperations', + 'SpatialOperations', + 'TilesetOperations', + 'WFSOperations', +] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py new file mode 100644 index 000000000000..14545ab5fb5b --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py @@ -0,0 +1,504 @@ +# 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 ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AliasOperations: + """AliasOperations 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.maps.creator.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 create( + self, + creator_data_item_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.AliasesCreateResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create an alias. You can also assign the alias during the create + request. An alias can reference an ID generated by a creator service, but cannot reference + another alias ID. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your alias, you will use a ``POST`` request. If you would like to assign the alias + during the creation, you will pass the ``resourceId`` query parameter. + + Create Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Create API returns a HTTP ``201 Created`` response with the alias resource in the body. + + A sample response from creating an alias: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasesCreateResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasesCreateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasesCreateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + if creator_data_item_id is not None: + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, '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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Access-Control-Expose-Headers']=self._deserialize('str', response.headers.get('Access-Control-Expose-Headers')) + deserialized = self._deserialize('AliasesCreateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/aliases'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AliasListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created aliases. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your aliases, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all aliases in ``json`` format. The response contains + the following details for each alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + yyyy-MM-ddTHH:mm:ss.sssZ + + + A sample response returning 2 alias resources: + + .. code-block:: json + + { + "aliases": [ + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }, + { + "createdTimestamp": "2020-02-18T19:53:33.123Z", + "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + "creatorDataItemId": null, + "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AliasListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.AliasListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AliasListResponse', pipeline_response) + list_of_elem = deserialized.aliases + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/aliases'} # type: ignore + + async def assign( + self, + alias_id: str, + creator_data_item_id: str, + **kwargs: Any + ) -> "_models.AliasListItem": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to assign an alias to reference a resource. + + Submit Assign Request + ^^^^^^^^^^^^^^^^^^^^^ + + To assign your alias to a resource, you will use a ``PUT`` request with the ``aliasId`` in the + path and the ``creatorDataItemId`` passed as a query parameter. + + Assign Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Assign API returns a HTTP ``200 OK`` response with the updated alias resource in the body, + if the alias was assigned successfully. A sample of the assign response is + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.assign.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_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') + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + assign.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + async def delete( + self, + alias_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a previously created alias. You can also use this API to + delete old/unused aliases to create space for new content.This API does not delete the + references resource, only the alias referencing the resource. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your alias you will issue a ``DELETE`` request where the path will contain the + ``aliasId`` of the alias to delete. + + Delete Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Delete API returns a HTTP ``204 No Content`` response with an empty body, if the alias was + deleted successfully. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + async def get_details( + self, + alias_id: str, + **kwargs: Any + ) -> "_models.AliasListItem": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch the details of a previously created alias. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details of your alias, you will issue a ``GET`` request with the ``aliasId`` in the + path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the previously created alias in ``json`` format. The response + contains the following details for the alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. + + + Here's a sample response: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_details.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_details.metadata = {'url': '/aliases/{aliasId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py new file mode 100644 index 000000000000..3791a560e402 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py @@ -0,0 +1,572 @@ +# 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.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConversionOperations: + """ConversionOperations 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.maps.creator.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 _convert_initial( + self, + udid: str, + output_ontology: str, + description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._convert_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['outputOntology'] = self._serialize.query("output_ontology", output_ontology, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _convert_initial.metadata = {'url': '/conversions'} # type: ignore + + async def begin_convert( + self, + udid: str, + output_ontology: str, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Conversion API lets the caller import a set of DWG design files as a zipped `Drawing + Package `_ into Azure Maps. The `Drawing Package + `_ should first be uploaded using the `Azure Maps Data + Service `_. Once uploaded, use the ``udid`` + returned by the `Data Upload API + `_ to call this Conversion API. + + Convert DWG package + ------------------- + + The Conversion API performs a `long-running request `_. + + Debug DWG package issues + ------------------------ + + During the Conversion process, if there are any issues with the DWG package `errors and + warnings `_ are provided in the response along with a + *diagnostic package* to visualize and diagnose these issues. In case any issues are encountered + with your DWG package, the Conversion operation status process as detailed `here + `_ returns the location of the *diagnostic package* that can + be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + package* location can be found in the properties section of the conversion operation status + response and looks like the following: + + .. code-block:: json + + { + "properties": { + "diagnosticPackageLocation": + "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + } + } + + The *diagnostic package* can be downloaded by executing a ``HTTP GET`` request on the + ``diagnosticPackageLocation``. + For more details on how to use the tool to visualize and diagnose all the errors and warnings + see `Drawing Error Visualizer `_. :code:`
` + + A conversion operation will be marked as *success* if there are zero or more warnings but will + be marked as *failed* if any errors are encountered. + + :param udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: str + :param output_ontology: Output ontology version. "facility-2.0" is the only supported value at + this time. Please refer to this `article + `_ for more + information about Azure Maps Creator ontologies. + :type output_ontology: str + :param description: User provided description of the content being converted. + :type description: 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 AsyncLROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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._convert_initial( + udid=udid, + output_ontology=output_ontology, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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_convert.metadata = {'url': '/conversions'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ConversionListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all successful data conversions submitted + previously using the `Conversion API + `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all successful conversions you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Conversion List API returns the complete list of all conversion details in ``json`` + format.:code:`
` + + Here is a sample response returning the details of two successful conversion requests: + + :code:`
` + + .. code-block:: json + + { + "conversions": + [ + { + "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + "udid": "31838736-8b84-11ea-bc55-0242ac130003", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + }, + { + "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + } + ] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConversionListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.ConversionListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConversionListResponse', pipeline_response) + list_of_elem = deserialized.conversions + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/conversions'} # type: ignore + + async def get( + self, + conversion_id: str, + **kwargs: Any + ) -> "_models.ConversionListDetailInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a successful data conversion submitted previously using the + `Conversion API `_. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConversionListDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConversionListDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConversionListDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + async def delete( + self, + conversion_id: str, + **kwargs: Any + ) -> None: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete any data conversions created previously using the + `Conversion API `_. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your conversion data you will issue a ``DELETE`` request where the path will contain + the ``conversionId`` of the data to delete. + + Conversion Delete Response + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Conversion Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + converted data resources were deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if no resource associated with the + passed-in ``conversionId`` is found. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + async def get_operation( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This path will be obtained from a call to POST /conversions. While in progress, an http200 + will be returned with no extra headers - followed by an http200 with Resource-Location header + once successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/conversions/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py new file mode 100644 index 000000000000..590d4a7b0628 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py @@ -0,0 +1,834 @@ +# 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, IO, 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.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataOperations: + """DataOperations 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.maps.creator.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 _upload_preview_initial( + self, + upload_data_format: Union[str, "_models.UploadDataFormat"], + upload_content: Union[IO, Any], + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/octet-stream") + accept = "application/json" + + # Construct URL + url = self._upload_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + query_parameters['dataFormat'] = self._serialize.query("upload_data_format", upload_data_format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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] + if header_parameters['Content-Type'].split(";")[0] in ['application/octet-stream']: + body_content_kwargs['stream_content'] = upload_content + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + body_content = self._serialize.body(upload_content, 'object') + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/octet-stream', 'application/json']".format(header_parameters['Content-Type']) + ) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _upload_preview_initial.metadata = {'url': '/mapData'} # type: ignore + + async def begin_upload_preview( + self, + upload_data_format: Union[str, "_models.UploadDataFormat"], + upload_content: Union[IO, Any], + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + The Data Upload API allows the caller to upload data content to the Azure Maps service. + You can use this API in a scenario like uploading a collection of Geofences in ``GeoJSON`` + format, for use in our `Azure Maps Geofencing Service + `_. + + Submit Upload Request + --------------------- + + To upload your content you will use a ``POST`` request. The request body will contain the data + to upload. The + ``dataFormat`` query parameter will contain the format for the data, the ``dataSharingLevel`` + query parameter + can contain the sharing level for the data. The ``Content-Type`` header will be set to the + content type of the + data. + + For example, to upload a collection of geofences in ``GeoJSON`` format, set the request body + to the geofence + content. Set the ``dataFormat`` query parameter to *geojson*\ , and set the ``Content-Type`` + header to either one + of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for uploading a simple Geofence represented as a circle geometry + using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The Data Upload API performs a + `long-running request `_. + + Data Upload Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param upload_data_format: Data format of the content being uploaded. + :type upload_data_format: str or ~azure.maps.creator.models.UploadDataFormat + :param upload_content: The content to upload. + :type upload_content: IO or any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: str + :keyword str content_type: Media type of the body sent to the API. Default value is "application/octet-stream". + Allowed values are: "application/octet-stream", "application/json". + :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 AsyncLROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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._upload_preview_initial( + upload_data_format=upload_data_format, + upload_content=upload_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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_upload_preview.metadata = {'url': '/mapData'} # type: ignore + + async def list_preview( + self, + **kwargs: Any + ) -> "_models.MapDataListResponse": + """**Applies to:** see pricing `tiers `_. + + This API allows the caller to fetch a list of all content uploaded previously using the `Data + Upload API `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your map data content you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Data List API returns the complete list of all data in ``json`` format. The response + contains the following details for each data resource: + + .. + + udid - The unique data id for the data resource. + + location - The location of the data resource. Execute a HTTP ``GET`` on this location to + download the data. + + + Here's a sample response returning the ``udid`` and ``location`` of 3 data resources: + + :code:`
` + + .. code-block:: json + + { + "mapDataList": + [ + { + "udid": "9a1288fa-1858-4a3b-b68d-13a8j5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/9a1288fa-1858-4a3b-b68d-13a8j5af7d7c?api-version=1.0", + "sizeInBytes": 29920, + "uploadStatus": "Completed" + }, + { + "udid": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/8b1288fa-1958-4a2b-b68e-13a7i5af7d7c?api-version=1.0", + "sizeInBytes": 1339, + "uploadStatus": "Completed" + }, + { + "udid": "7c1288fa-2058-4a1b-b68f-13a6h5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/7c1288fa-2058-4a1b-b68f-13a6h5af7d7c?api-version=1.0", + "sizeInBytes": 1650, + "uploadStatus": "Pending" + }] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapDataListResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.MapDataListResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapDataListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.list_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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 self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('MapDataListResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_preview.metadata = {'url': '/mapData'} # type: ignore + + async def _update_preview_initial( + self, + unique_data_id: str, + update_content: Any, + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_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') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(update_content, 'object') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_preview_initial.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def begin_update_preview( + self, + unique_data_id: str, + update_content: Any, + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + The Data Update API allows the caller to update a previously uploaded data content. + + You can use this API in a scenario like adding or removing geofences to or from an existing + collection of geofences. + Geofences are uploaded using the `Data Upload API + `_\ , for + use in the `Azure Maps Geofencing Service `_. + + Please note that the Update API will *replace* and *override* the existing data content. + + Submit Update Request + --------------------- + + To update your content you will use a ``PUT`` request. The request body will contain the new + data that will replace + the existing data. The ``Content-Type`` header will be set to the content type of the data, and + the path will contain + the ``udid`` of the data to be update. + + For example, to update a collection of geofences that were previously uploaded using the Upload + API, place the new + geofence content in the request body. Set the ``udid`` parameter in the path to the ``udid`` of + the data received + previously in the upload API response. And set the ``Content-Type`` header to one of the + following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for updating a simple Geofence. It's represented as a circle + geometry using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The previously uploaded geofence had a radius of 100m. The above request will update it to + 500m. + + The Data Update API performs a + `long-running request `_. + + Data Update Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :param update_content: The new content that will update/replace the previously uploaded + content. + :type update_content: any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: 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 AsyncLROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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_preview_initial( + unique_data_id=unique_data_id, + update_content=update_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def download_preview( + self, + unique_data_id: str, + **kwargs: Any + ) -> IO: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to download a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like downloading an existing collection of geofences + uploaded previously using the `Data Upload API + `_ for use in our + `Azure Maps Geofencing Service `_. + + Submit Download Request + ^^^^^^^^^^^^^^^^^^^^^^^ + + To download your content you will use a ``GET`` request where the path will contain the + ``udid`` of the data to download. Optionally, you can also pass in an ``Accept`` header to + specify a preference for the ``Content-Type`` of the data response. :code:`
` + For example, to download a collection of geofences previously uploaded using the Upload API, + set the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response and set the ``Accept`` header to either one of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Download Data Response + ^^^^^^^^^^^^^^^^^^^^^^ + + The Download API will return a HTTP ``200 OK`` response if the data resource with the passed-in + ``udid`` is found, where the response body will contain the content of the data + resource.:code:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found.:code:`
` + + Here's a sample response body for a simple geofence represented in ``GeoJSON`` uploaded + previously using the Upload API: + :code:`
` + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + }. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json, application/vnd.geo+json, application/octet-stream" + + # Construct URL + url = self.download_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + download_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def delete_preview( + self, + unique_data_id: str, + **kwargs: Any + ) -> None: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to delete a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like removing geofences previously uploaded using the `Data + Upload API `_ for use + in our `Azure Maps Geofencing Service + `_. You can also use this API to delete + old/unused uploaded content and create space for new content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``udid`` of the data to delete.:code:`
`\ :raw-html-m2r:`
` + For example, to delete a collection of geofences previously uploaded using the Upload API, set + the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response. + + Delete Data Response + ^^^^^^^^^^^^^^^^^^^^ + + The Data Delete API returns a HTTP ``204 No Content`` response with an empty body, if the data + resource was deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def get_operation_preview( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This path will be obtained from a call to POST /mapData. While in progress, an http200 will be + returned with no extra headers - followed by an http200 with Resource-Location header once + completed. + + :param operation_id: The ID to query the status for the data upload request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation_preview.metadata = {'url': '/mapData/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py new file mode 100644 index 000000000000..4911765318f1 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py @@ -0,0 +1,627 @@ +# 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.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DatasetOperations: + """DatasetOperations 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.maps.creator.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 _create_initial( + self, + conversion_id: str, + dataset_id: Optional[str] = None, + description_dataset: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['conversionId'] = self._serialize.query("conversion_id", conversion_id, 'str') + if dataset_id is not None: + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description_dataset is not None: + query_parameters['description'] = self._serialize.query("description_dataset", description_dataset, '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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/datasets'} # type: ignore + + async def begin_create( + self, + conversion_id: str, + dataset_id: Optional[str] = None, + description_dataset: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create a dataset from data that was uploaded to the Azure Maps + Data Service and converted using the Azure Maps Conversion Service. + + You can use this API in a scenario like uploading a DWG zip package for a building, converting + the zip package using the Azure Maps Conversion Service, and creating a dataset from the + converted zip package. The created dataset can be used to create tilesets using the Azure Maps + Tileset Service and can be queried via the Azure Maps WFS Service. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your dataset, you will use a ``POST`` request where the ``conversionId`` query + parameter is an ID that represents the converted DWG zip package, the ``datasetId`` parameter + will be the ID of a previously created dataset to append with the current dataset and, + optionally, the ``description`` query parameter will contain a description (if description is + not provided a default description will be given). + + The Create API is a `long-running request `_. + + :param conversion_id: The unique ID used to create the dataset. The ``conversionId`` must have + been obtained from a successful call to the Conversion Service Convert API and may be provided + with multiple query parameters with same name (if more than one is provided). + :type conversion_id: str + :param dataset_id: The ID for the dataset to append with. The dataset must originate from a + previous dataset creation call that matches the datasetId. + :type dataset_id: str + :param description_dataset: The description to be given to the dataset. + :type description_dataset: 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 AsyncLROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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_initial( + conversion_id=conversion_id, + dataset_id=dataset_id, + description_dataset=description_dataset, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.metadata = {'url': '/datasets'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DatasetListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created datasets. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your datasets, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all datasets in ``json`` format. The response + contains the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of 3 dataset resources: + + .. code-block:: json + + { + "datasets": [ + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }, + { + "timestamp": "2020-01-01T22:57:53.123Z", + "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + "datasetSources": { + "conversionIds": [ + "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + ], + "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatasetListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.DatasetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatasetListResponse', pipeline_response) + list_of_elem = deserialized.datasets + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/datasets'} # type: ignore + + async def get( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.DatasetDetailInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a previously successfully created dataset. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details for a previously created dataset, you will issue a ``GET`` request with the + ``datasetId`` in the path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the details for a dataset in ``json`` format. The response contains + the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of a dataset resource: + + .. code-block:: json + + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.DatasetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DatasetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + async def delete( + self, + dataset_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + You can also use this API to delete old/unused datasets to create space for new Creator + content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``datasetId`` of the dataset to delete. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + async def get_operation( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This API allows the caller to view the current progress of a dataset operation and the path is + obtained from a call to the Create API. + + Submit Operations Request + ^^^^^^^^^^^^^^^^^^^^^^^^^ + + To view the current progress of a dataset operation, you will use a ``GET`` request where the + ``operationId`` given the path is the ID that represents the operation. + + Operation Response + ^^^^^^^^^^^^^^^^^^ + + While in progress, a ``200-OK`` http status code will be returned with no extra headers. If the + operation succeeds, a ``200-OK`` http status code with Resource-Location header will be + returned. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/datasets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py new file mode 100644 index 000000000000..386317ee7b71 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py @@ -0,0 +1,620 @@ +# 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 ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FeatureStateOperations: + """FeatureStateOperations 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.maps.creator.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 create_stateset( + self, + dataset_id: str, + stateset_create_request_body: "_models.StylesObject", + description: Optional[str] = None, + **kwargs: Any + ) -> "_models.StatesetCreatedResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This POST API allows the user to create a new Stateset and define stateset style using request + body. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. The Feature State API is part of Creator. + + The Feature State service allows the user to update the states of a feature and query them to + be used in other services. The dynamic properties of a feature that don't belong to the dataset + are referred to as *states* here. + + This Feature State service pivot on the Stateset. Like Tileset, Stateset encapsulates the + storage mechanism for feature states for a dataset. + + Once the stateset is created, users can use that statesetId to post feature state updates and + retrieve the current feature states. A feature can have only one state at a given point in + time. + + Feature state is defined by the key name, value and the timestamp. When a feature state update + is posted to Azure Maps, the state value gets updated only if the provided state’s timestamp is + later than the stored timestamp. + + Azure Maps MapControl provides a way to use these feature states to style the features. Please + refer to the State Tile documentation for more information. + + :param dataset_id: The datasetId must have been obtained from a successful `Dataset Create API + `_ call. + :type dataset_id: str + :param stateset_create_request_body: The stateset style JSON data. + :type stateset_create_request_body: ~azure.maps.creator.models.StylesObject + :param description: Description for the stateset. Max length allowed is 1000. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetCreatedResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetCreatedResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetCreatedResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, '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(stateset_create_request_body, 'StylesObject') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetCreatedResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def list_stateset( + self, + **kwargs: Any + ) -> AsyncIterable["_models.StatesetListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created statesets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StatesetListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.StatesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + 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_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StatesetListResponse', pipeline_response) + list_of_elem = deserialized.statesets + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + async def put_stateset( + self, + stateset_id: str, + stateset_style_update_request_body: "_models.StylesObject", + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the stateset style rules. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param stateset_style_update_request_body: The stateset style JSON data. Only style rules are + allowed to be updated, update on keyname and type is not allowed. + :type stateset_style_update_request_body: ~azure.maps.creator.models.StylesObject + :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 = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_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(stateset_style_update_request_body, 'StylesObject') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + put_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def delete_stateset( + self, + stateset_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This DELETE API allows the user to delete the stateset and the associated data. + + :param stateset_id: The stateset id that was created. + :type stateset_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def get_stateset( + self, + stateset_id: str, + **kwargs: Any + ) -> "_models.StatesetGetResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This GET API allows the user to get the stateset Information. + + The stateset Information includes the datasetId associated to the stateset, and the styles of + that stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetGetResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetGetResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetGetResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetGetResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def update_states( + self, + stateset_id: str, + feature_id: str, + feature_state_update_request_body: "_models.FeatureStatesStructure", + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the state of the given feature in the given stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given dataset. If the featureId is not present in + the dataset, Bad Request response will be returned. + :type feature_id: str + :param feature_state_update_request_body: The feature state JSON data. A feature can have only + one state at a given point in time. The specified state keyname must have been defined during + the stateset creation. + :type feature_state_update_request_body: ~azure.maps.creator.models.FeatureStatesStructure + :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 = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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(feature_state_update_request_body, 'FeatureStatesStructure') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + update_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + async def delete_state( + self, + stateset_id: str, + feature_id: str, + state_key_name: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API deletes the state information identified by the StateKeyName parameter for the + feature identified by the FeatureId parameter in the the stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :param state_key_name: The Name of the state to be deleted. + :type state_key_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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_state.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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') + query_parameters['stateKeyName'] = self._serialize.query("state_key_name", state_key_name, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_state.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + async def get_states( + self, + stateset_id: str, + feature_id: str, + **kwargs: Any + ) -> "_models.FeatureStatesStructure": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API returns the current state information associated with the given feature in the given + stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureStatesStructure, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureStatesStructure + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureStatesStructure"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureStatesStructure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py new file mode 100644 index 000000000000..28ca5600aecd --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py @@ -0,0 +1,944 @@ +# 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, 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 ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SpatialOperations: + """SpatialOperations 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.maps.creator.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_geofence( + self, + format: Union[str, "_models.ResponseFormat"], + device_id: str, + udid: str, + latitude: float, + longitude: float, + z: Optional[float] = None, + user_time: Optional[datetime.datetime] = None, + search_buffer: Optional[float] = None, + is_async: Optional[bool] = None, + mode: Optional[Union[str, "_models.GeofenceMode"]] = None, + **kwargs: Any + ) -> "_models.GeofenceResponse": + """**Search Geofence Get API** + + **Applies to:** S1 Pricing tier. + + The Geofence Get API allows you to retrieve the proximity of a coordinate to a + geofence that has been uploaded to the Data service. You can use the + `Data Upload API `_ to + upload + a geofence or set of fences. See `Geofencing GeoJSON data + `_ + for more details on the geofence data format. To query the proximity of a coordinate, you + supply the location of the object you are tracking as well + as the ID for the fence or set of fences, and the response will contain information about + the distance from the outer edge of the geofence. A negative value signifies that the + coordinate is inside of the fence while a positive value means that it is outside of the + fence.:code:`
`:code:`
`This API can be used for a variety of scenarios that include + things like asset + tracking, fleet management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + To test this API, you can upload the sample data from Post Geofence API examples(Request Body) + via Data Upload API and replace the [udid] from the sample request below with the udid returned + by Data Upload API. + + Geofencing InnerError code + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + In geofencing response error contract, ``innererror`` is an object containing service specific + information about the error. ``code`` is a property in ``innererror`` which can map to a + specific geofencing error type. The table belows shows the code mapping between all the known + client error type to the corresponding geofencing error ``message``. + + .. list-table:: + :header-rows: 1 + + * - innererror.code + - error.message + * - NullDeviceId + - Device Id should not be null. + * - NullUdid + - Udid should not be null. + * - UdidWrongFormat + - Udid should be acquired from user data ingestion API. + * - InvalidUserTime + - Usertime is invalid. + * - InvalidSearchBuffer + - Searchbuffer is invalid. + * - InvalidSearchRange + - The value range of searchbuffer should be from 0 to 500 meters. + * - InvalidLatLon + - Lat and/or lon parameters are invalid. + * - InvalidIsAsyncValue + - The IsAsync parameter is invalid. + * - InvalidModeValue + - The mode parameter invalid. + * - InvalidJson + - Geofencing data is not a valid json file. + * - NotSupportedGeoJson + - Geofencing data can't be read as a Feature or FeatureCollections. + * - InvalidGeoJson + - Geofencing data is invalid. + * - NoUserDataWithAccountOrSubscription + - Can't find user geofencing data with provided account-id and/or subscription-id. + * - NoUserDataWithUdid + - Can't find user geofencing data with provided udid. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion is used. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.Now. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + async def post_geofence( + self, + format: Union[str, "_models.ResponseFormat"], + device_id: str, + latitude: float, + longitude: float, + search_geofence_request_body: "_models.GeoJsonFeatureCollection", + z: Optional[float] = None, + user_time: Optional[datetime.datetime] = None, + search_buffer: Optional[float] = None, + is_async: Optional[bool] = None, + mode: Optional[Union[str, "_models.GeofenceMode"]] = None, + **kwargs: Any + ) -> "_models.GeofenceResponse": + """**Search Geofence Post API** + **Applies to:** S1 Pricing tier. + The Geofence Post API allows you to retrieve the proximity of a coordinate to a provided + geofence or set of fences. With POST call, you do not have to upload the fence data in advance, + instead you supply the location of the object you are tracking in query parameters as well as + the fence or set of fences data in post request body. See `Geofencing GeoJSON data + `_ for more details on the + geofence data format. The response will contain information about the distance from the outer + edge of the geofence. A negative value signifies that the coordinate is inside of the fence + while a positive value means that it is outside of the fence.:code:`
`:code:`
`This API + can be used for a variety of scenarios that include things like asset tracking, fleet + management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param search_geofence_request_body: The geofencing GeoJSON data. + :type search_geofence_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion geofencing is applied. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.UtcNow. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(search_geofence_request_body, 'GeoJsonFeatureCollection') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + post_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + async def post_buffer( + self, + format: Union[str, "_models.ResponseFormat"], + buffer_request_body: "_models.BufferRequestBody", + **kwargs: Any + ) -> "_models.BufferResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input may contain a collection of Point, MultiPoint, Polygon, + MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if provided. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param buffer_request_body: The FeatureCollection and the list of distances (one per feature or + one for all features). + :type buffer_request_body: ~azure.maps.creator.models.BufferRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(buffer_request_body, 'BufferRequestBody') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + async def get_buffer( + self, + format: Union[str, "_models.ResponseFormat"], + udid: str, + distances: str, + **kwargs: Any + ) -> "_models.BufferResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input features are provided by a GeoJSON file which is uploaded + via `Data Upload API `_ and + referenced by a unique udid. The GeoJSON file may contain a collection of Point, MultiPoint, + Polygon, MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if + provided. + + To test this API, you can upload the sample data from `Post Buffer API + `_ examples(Request + Body without distances array) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the udid + returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param distances: The list of distances (one per feature or one for all features), delimited by + semicolons. For example, 12.34;-56.78. Positive distance will generate a buffer outside of the + feature, whereas negative distance will generate a buffer inside of the feature. If the + negative distance larger than the geometry itself, an empty polygon will be returned. + :type distances: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['distances'] = self._serialize.query("distances", distances, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + async def post_closest_point( + self, + format: Union[str, "_models.ResponseFormat"], + latitude: float, + longitude: float, + closest_point_request_body: "_models.GeoJsonFeatureCollection", + number_of_closest_points: Optional[int] = None, + **kwargs: Any + ) -> "_models.ClosestPointResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of target points. The + set of target points is provided by user data in post request body. The user data may only + contain a collection of Point geometry. MultiPoint or other geometries will be ignored if + provided. The algorithm does not take into account routing or traffic. The maximum number of + points accepted is 100,000. Information returned includes closest point latitude, longitude, + and distance in meters from the closest point. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param closest_point_request_body: The FeatureCollection of Point geometries from which closest + point to source point should be determined. All the feature's properties should contain + ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + :type closest_point_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(closest_point_request_body, 'GeoJsonFeatureCollection') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + async def get_closest_point( + self, + format: Union[str, "_models.ResponseFormat"], + udid: str, + latitude: float, + longitude: float, + number_of_closest_points: Optional[int] = None, + **kwargs: Any + ) -> "_models.ClosestPointResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of points in the user + uploaded data set identified by udid. The set of target points is provided by a GeoJSON file + which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may only contain a collection of Point geometry. MultiPoint or + other geometries will be ignored if provided. The maximum number of points accepted is 100,000. + The algorithm does not take into account routing or traffic. Information returned includes + closest point latitude, longitude, and distance in meters from the closest point. + + To test this API, you can upload the sample data from `Post Closest Point API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + async def post_point_in_polygon( + self, + format: Union[str, "_models.ResponseFormat"], + latitude: float, + longitude: float, + point_in_polygon_request_body: "_models.GeoJsonFeatureCollection", + **kwargs: Any + ) -> "_models.PointInPolygonResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + user data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if + provided. If the point is inside or on the boundary of one of these polygons, the value + returned is true. In all other cases, the value returned is false. When the point is inside + multiple polygons, the result will give intersecting geometries section to show all valid + geometries (referenced by geometryId) in user data. The maximum number of vertices accepted to + form a Polygon is 10,000. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param point_in_polygon_request_body: A FeatureCollection with a set of Polygon/MultiPolygon + geometries. The maximum number of vertices accepted to form a Polygon is 10,000. All the + feature's properties should contain ``geometryId``\ , which is used for identifying the + geometry and is case-sensitive. + :type point_in_polygon_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(point_in_polygon_request_body, 'GeoJsonFeatureCollection') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + async def get_point_in_polygon( + self, + format: Union[str, "_models.ResponseFormat"], + udid: str, + latitude: float, + longitude: float, + **kwargs: Any + ) -> "_models.PointInPolygonResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + set of polygons is provided by a GeoJSON file which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries + will be ignored if provided. If the point is inside or on the boundary of one of these + polygons, the value returned is true. In all other cases, the value returned is false. When the + point is inside multiple polygons, the result will give intersecting geometries section to show + all valid geometries(referenced by geometryId) in user data. The maximum number of vertices + accepted to form a Polygon is 10,000. + + To test this API, you can upload the sample data from `Post Point In Polygon API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + async def get_great_circle_distance( + self, + format: Union[str, "_models.ResponseFormat"], + query: str, + **kwargs: Any + ) -> "_models.GreatCircleDistanceResponse": + """**Applies to**\ : S1 pricing tier. + + This API will return the great-circle or shortest distance between two points on the surface of + a sphere, measured along the surface of the sphere. This differs from calculating a straight + line through the sphere's interior. This method is helpful for estimating travel distances for + airplanes by calculating the shortest distance between airports. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param query: The Coordinates through which the distance is calculated, delimited by a colon. + Two coordinates are required. The first one is the source point coordinate and the last is the + target point coordinate. For example, 47.622942,122.316456:57.673988,127.121513. + :type query: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GreatCircleDistanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GreatCircleDistanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GreatCircleDistanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_great_circle_distance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GreatCircleDistanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_great_circle_distance.metadata = {'url': '/spatial/greatCircleDistance/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py new file mode 100644 index 000000000000..fee72365ff9d --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py @@ -0,0 +1,501 @@ +# 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.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TilesetOperations: + """TilesetOperations 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.maps.creator.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 _create_initial( + self, + dataset_id: str, + description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/tilesets'} # type: ignore + + async def begin_create( + self, + dataset_id: str, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. + + The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains + a set of tiles that can be consumed + from the `Get Map Tile `_ to retrieve custom tiles. To make a + dataset, use the + `DataSet Create API `_. + + Submit Create Request + --------------------- + + To create your tileset you will make a ``POST`` request with an empty body. The ``datasetId`` + query parameter will be + used as the source of the tileset data. + + The Create Tileset API is a + `long-running request `_. + + :param dataset_id: The unique ``datasetId`` that the tileset create API uses to retrieve + features to generate tiles. The ``datasetId`` must have been obtained from a successful + `Dataset Create API `_ call. + :type dataset_id: str + :param description: User provided description of the tileset. + :type description: 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 AsyncLROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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_initial( + dataset_id=dataset_id, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.metadata = {'url': '/tilesets'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.TilesetListResponse"]: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all tilesets created.\ :raw-html-m2r:`
` + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TilesetListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.TilesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TilesetListResponse', pipeline_response) + list_of_elem = deserialized.tilesets + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/tilesets'} # type: ignore + + async def get( + self, + tileset_id: str, + **kwargs: Any + ) -> "_models.TilesetDetailInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a tileset. + + :param tileset_id: The Tileset Id. + :type tileset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TilesetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.TilesetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TilesetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + async def delete( + self, + tileset_id: str, + **kwargs: Any + ) -> None: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a created tileset.:code:`
`\ :raw-html-m2r:`
` + You can use this API if a tileset is no longer needed. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``tilesetId`` of the tileset to delete.:code:`
` + + Delete request "Successful" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The Tileset Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + tileset was deleted successfully.:code:`
` + + Delete request "Failed" + ~~~~~~~~~~~~~~~~~~~~~~~ + + A HTTP ``400 Bad Request`` error response will be returned if the tileset with the passed-in + ``tilesetId`` is not found. + + Here is a sample error response: + + :code:`
` + + .. code-block:: json + + { + "error": { + "code": "400 BadRequest", + "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce does not + exist." + } + }. + + :param tileset_id: The Tileset Id. + :type tileset_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + async def get_operation( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This path will be obtained from a call to /tilesets/create. While in progress, an http200 will + be returned with no extra headers - followed by an http200 with Resource-Location header once + successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/tilesets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py new file mode 100644 index 000000000000..966b85e20b27 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py @@ -0,0 +1,672 @@ +# 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 ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WFSOperations: + """WFSOperations 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.maps.creator.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_landing_page( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.LandingPageResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Landing Page API provides links to the API definition, the Conformance statements and + the metadata about the feature data in this dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LandingPageResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LandingPageResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LandingPageResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_landing_page.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LandingPageResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_landing_page.metadata = {'url': '/wfs/datasets/{datasetId}/'} # type: ignore + + async def get_conformance( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.ConformanceResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Requirements Classes lists all requirements classes specified in the standard that the + server conforms to. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConformanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConformanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConformanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_conformance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConformanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_conformance.metadata = {'url': '/wfs/datasets/{datasetId}/conformance'} # type: ignore + + async def get_collections( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.CollectionsResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Collections Description API provides descriptions of all the collections in a given + dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collections.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collections.metadata = {'url': '/wfs/datasets/{datasetId}/collections'} # type: ignore + + async def get_collection( + self, + dataset_id: str, + collection_id: str, + **kwargs: Any + ) -> "_models.CollectionInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Description API provides the description of a given collection. It includes the + links to the operations that can be performed on the collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}'} # type: ignore + + async def get_collection_definition( + self, + dataset_id: str, + collection_id: str, + **kwargs: Any + ) -> "_models.CollectionDefinitionResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. WFS API follows the `Open + Geospatial Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Definition API provides the detailed data model of a given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionDefinitionResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionDefinitionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionDefinitionResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection_definition.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionDefinitionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection_definition.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/definition'} # type: ignore + + async def get_features( + self, + dataset_id: str, + collection_id: str, + limit: Optional[int] = None, + bbox: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> "_models.ExtendedGeoJsonFeatureCollection": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Features API returns the list of features in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param limit: The optional limit parameter limits the number of features that are presented in + the response document. + Only features that are on the first level of the collection in the response document are + counted. Nested objects contained within the explicitly requested features shall not be + counted. + + + * Minimum = 1 * Maximum = 500 * Default = 10. + :type limit: int + :param bbox: Only features that have a geometry that intersects the supplied bounding box are + selected. + + + * Lower left corner, coordinate axis 1 * Lower left corner, coordinate axis 2 * Upper right + corner, coordinate axis 1 * Upper right corner, coordinate axis 2 + The coordinate reference system of the values is WGS84 longitude/latitude + (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system + is specified in the parameter ``bbox-crs``. + For WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, + minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans + the antimeridian the first value (west-most box edge) is larger than the third value (east-most + box edge). + :type bbox: str + :param filter: Filter expression to search for features with specific property values in a + given collection. Only feature properties of scalar type and equals operator are supported. + This is a special parameter where the parameter name is a case sensitive property name. The + scheme for this parameter is {property name}={property value}. Unless "filter" is one of the + property names in the collection, "filter" should not be used as a parameter name. To search + for features with "name" property value "21N13", use "name=21N13". + Multiple filters are supported and should be represented as multiple query parameters. E.g., + :code:``=:code:``&:code:``=:code:`` String values are + case sensitive. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedGeoJsonFeatureCollection, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ExtendedGeoJsonFeatureCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedGeoJsonFeatureCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_features.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_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') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=500, minimum=1) + if bbox is not None: + query_parameters['bbox'] = self._serialize.query("bbox", bbox, 'str') + if filter is not None: + query_parameters['filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ExtendedGeoJsonFeatureCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_features.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items'} # type: ignore + + async def get_feature( + self, + dataset_id: str, + collection_id: str, + feature_id: str, + **kwargs: Any + ) -> "_models.FeatureResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Feature API returns the feature identified by the provided id in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore + + async def delete_feature( + self, + dataset_id: str, + collection_id: str, + feature_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Delete Feature API deletes the feature identified by the provided id in the given + collection. At this point this API supports only facility features. Deleting a facility feature + deletes all the child features of that facility recursively. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py new file mode 100644 index 000000000000..6f6a90b20af7 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py @@ -0,0 +1,259 @@ +# 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 AliasListItem + from ._models_py3 import AliasListResponse + from ._models_py3 import AliasesCreateResponse + from ._models_py3 import BooleanRuleObject + from ._models_py3 import BooleanTypeStyleRule + from ._models_py3 import BufferRequestBody + from ._models_py3 import BufferResponse + from ._models_py3 import BufferResponseSummary + from ._models_py3 import ClosestPointResponse + from ._models_py3 import ClosestPointResultEntry + from ._models_py3 import ClosestPointSummary + from ._models_py3 import CollectionDefinitionResponse + from ._models_py3 import CollectionInfo + from ._models_py3 import CollectionsResponse + from ._models_py3 import ConformanceResponse + from ._models_py3 import ConversionListDetailInfo + from ._models_py3 import ConversionListResponse + from ._models_py3 import DatasetDetailInfo + from ._models_py3 import DatasetListResponse + from ._models_py3 import DatasetSources + from ._models_py3 import DefinitionProperties + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import ExtendedGeoJsonFeatureCollection + from ._models_py3 import ExtendedGeoJsonFeatureCollectionData + from ._models_py3 import FeatureResponse + from ._models_py3 import FeatureStateObject + from ._models_py3 import FeatureStatesStructure + from ._models_py3 import GeoJsonFeature + from ._models_py3 import GeoJsonFeatureCollection + from ._models_py3 import GeoJsonFeatureCollectionData + from ._models_py3 import GeoJsonFeatureData + from ._models_py3 import GeoJsonGeometry + from ._models_py3 import GeoJsonGeometryCollection + from ._models_py3 import GeoJsonGeometryCollectionData + from ._models_py3 import GeoJsonLineString + from ._models_py3 import GeoJsonLineStringData + from ._models_py3 import GeoJsonMultiLineString + from ._models_py3 import GeoJsonMultiLineStringData + from ._models_py3 import GeoJsonMultiPoint + from ._models_py3 import GeoJsonMultiPointData + from ._models_py3 import GeoJsonMultiPolygon + from ._models_py3 import GeoJsonMultiPolygonData + from ._models_py3 import GeoJsonObject + from ._models_py3 import GeoJsonPoint + from ._models_py3 import GeoJsonPointData + from ._models_py3 import GeoJsonPolygon + from ._models_py3 import GeoJsonPolygonData + from ._models_py3 import GeofenceGeometry + from ._models_py3 import GeofenceResponse + from ._models_py3 import GreatCircleDistanceResponse + from ._models_py3 import GreatCircleDistanceResponseResult + from ._models_py3 import GreatCircleDistanceResponseSummary + from ._models_py3 import LandingPageResponse + from ._models_py3 import LongRunningOperationResult + from ._models_py3 import MapDataDetailInfo + from ._models_py3 import MapDataListResponse + from ._models_py3 import NumberRuleObject + from ._models_py3 import NumberTypeStyleRule + from ._models_py3 import PointInPolygonResponse + from ._models_py3 import PointInPolygonResult + from ._models_py3 import PointInPolygonSummary + from ._models_py3 import RangeObject + from ._models_py3 import SpatialCoordinate + from ._models_py3 import StatesetCreatedResponse + from ._models_py3 import StatesetGetResponse + from ._models_py3 import StatesetInfoObject + from ._models_py3 import StatesetListResponse + from ._models_py3 import StringTypeStyleRule + from ._models_py3 import StyleObject + from ._models_py3 import StylesObject + from ._models_py3 import TilesetDetailInfo + from ._models_py3 import TilesetListResponse + from ._models_py3 import WfsEndpointLink +except (SyntaxError, ImportError): + from ._models import AliasListItem # type: ignore + from ._models import AliasListResponse # type: ignore + from ._models import AliasesCreateResponse # type: ignore + from ._models import BooleanRuleObject # type: ignore + from ._models import BooleanTypeStyleRule # type: ignore + from ._models import BufferRequestBody # type: ignore + from ._models import BufferResponse # type: ignore + from ._models import BufferResponseSummary # type: ignore + from ._models import ClosestPointResponse # type: ignore + from ._models import ClosestPointResultEntry # type: ignore + from ._models import ClosestPointSummary # type: ignore + from ._models import CollectionDefinitionResponse # type: ignore + from ._models import CollectionInfo # type: ignore + from ._models import CollectionsResponse # type: ignore + from ._models import ConformanceResponse # type: ignore + from ._models import ConversionListDetailInfo # type: ignore + from ._models import ConversionListResponse # type: ignore + from ._models import DatasetDetailInfo # type: ignore + from ._models import DatasetListResponse # type: ignore + from ._models import DatasetSources # type: ignore + from ._models import DefinitionProperties # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExtendedGeoJsonFeatureCollection # type: ignore + from ._models import ExtendedGeoJsonFeatureCollectionData # type: ignore + from ._models import FeatureResponse # type: ignore + from ._models import FeatureStateObject # type: ignore + from ._models import FeatureStatesStructure # type: ignore + from ._models import GeoJsonFeature # type: ignore + from ._models import GeoJsonFeatureCollection # type: ignore + from ._models import GeoJsonFeatureCollectionData # type: ignore + from ._models import GeoJsonFeatureData # type: ignore + from ._models import GeoJsonGeometry # type: ignore + from ._models import GeoJsonGeometryCollection # type: ignore + from ._models import GeoJsonGeometryCollectionData # type: ignore + from ._models import GeoJsonLineString # type: ignore + from ._models import GeoJsonLineStringData # type: ignore + from ._models import GeoJsonMultiLineString # type: ignore + from ._models import GeoJsonMultiLineStringData # type: ignore + from ._models import GeoJsonMultiPoint # type: ignore + from ._models import GeoJsonMultiPointData # type: ignore + from ._models import GeoJsonMultiPolygon # type: ignore + from ._models import GeoJsonMultiPolygonData # type: ignore + from ._models import GeoJsonObject # type: ignore + from ._models import GeoJsonPoint # type: ignore + from ._models import GeoJsonPointData # type: ignore + from ._models import GeoJsonPolygon # type: ignore + from ._models import GeoJsonPolygonData # type: ignore + from ._models import GeofenceGeometry # type: ignore + from ._models import GeofenceResponse # type: ignore + from ._models import GreatCircleDistanceResponse # type: ignore + from ._models import GreatCircleDistanceResponseResult # type: ignore + from ._models import GreatCircleDistanceResponseSummary # type: ignore + from ._models import LandingPageResponse # type: ignore + from ._models import LongRunningOperationResult # type: ignore + from ._models import MapDataDetailInfo # type: ignore + from ._models import MapDataListResponse # type: ignore + from ._models import NumberRuleObject # type: ignore + from ._models import NumberTypeStyleRule # type: ignore + from ._models import PointInPolygonResponse # type: ignore + from ._models import PointInPolygonResult # type: ignore + from ._models import PointInPolygonSummary # type: ignore + from ._models import RangeObject # type: ignore + from ._models import SpatialCoordinate # type: ignore + from ._models import StatesetCreatedResponse # type: ignore + from ._models import StatesetGetResponse # type: ignore + from ._models import StatesetInfoObject # type: ignore + from ._models import StatesetListResponse # type: ignore + from ._models import StringTypeStyleRule # type: ignore + from ._models import StyleObject # type: ignore + from ._models import StylesObject # type: ignore + from ._models import TilesetDetailInfo # type: ignore + from ._models import TilesetListResponse # type: ignore + from ._models import WfsEndpointLink # type: ignore + +from ._creator_client_enums import ( + GeoJsonGeometryType, + GeoJsonObjectType, + GeofenceMode, + GeographicResourceLocation, + Geography, + LroStatus, + ResponseFormat, + StyleObjectType, + UploadDataFormat, +) + +__all__ = [ + 'AliasListItem', + 'AliasListResponse', + 'AliasesCreateResponse', + 'BooleanRuleObject', + 'BooleanTypeStyleRule', + 'BufferRequestBody', + 'BufferResponse', + 'BufferResponseSummary', + 'ClosestPointResponse', + 'ClosestPointResultEntry', + 'ClosestPointSummary', + 'CollectionDefinitionResponse', + 'CollectionInfo', + 'CollectionsResponse', + 'ConformanceResponse', + 'ConversionListDetailInfo', + 'ConversionListResponse', + 'DatasetDetailInfo', + 'DatasetListResponse', + 'DatasetSources', + 'DefinitionProperties', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExtendedGeoJsonFeatureCollection', + 'ExtendedGeoJsonFeatureCollectionData', + 'FeatureResponse', + 'FeatureStateObject', + 'FeatureStatesStructure', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'GeofenceGeometry', + 'GeofenceResponse', + 'GreatCircleDistanceResponse', + 'GreatCircleDistanceResponseResult', + 'GreatCircleDistanceResponseSummary', + 'LandingPageResponse', + 'LongRunningOperationResult', + 'MapDataDetailInfo', + 'MapDataListResponse', + 'NumberRuleObject', + 'NumberTypeStyleRule', + 'PointInPolygonResponse', + 'PointInPolygonResult', + 'PointInPolygonSummary', + 'RangeObject', + 'SpatialCoordinate', + 'StatesetCreatedResponse', + 'StatesetGetResponse', + 'StatesetInfoObject', + 'StatesetListResponse', + 'StringTypeStyleRule', + 'StyleObject', + 'StylesObject', + 'TilesetDetailInfo', + 'TilesetListResponse', + 'WfsEndpointLink', + 'GeoJsonGeometryType', + 'GeoJsonObjectType', + 'GeofenceMode', + 'GeographicResourceLocation', + 'Geography', + 'LroStatus', + 'ResponseFormat', + 'StyleObjectType', + 'UploadDataFormat', +] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py new file mode 100644 index 000000000000..8df43612a4dc --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py @@ -0,0 +1,133 @@ +# 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 GeofenceMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Publish all the query results to Azure Maps account event subscription. + ALL = "All" + #: Only publish result when user location is considered as crossing geofencing boarder. + ENTER_AND_EXIT = "EnterAndExit" + +class GeographicResourceLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Used to access an Azure Maps Creator resource in the United States. + US = "us" + #: Used to access an Azure Maps Creator resource in Europe. + EU = "eu" + +class Geography(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This parameter specifies where the Azure Maps Creator resource is located. Valid values are us + and eu. + """ + + US = "us" + EU = "eu" + +class GeoJsonGeometryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """type of geometry returned + """ + + #: ``GeoJSON Point`` geometry. + GEO_JSON_POINT = "Point" + #: ``GeoJSON MultiPoint`` geometry. + GEO_JSON_MULTI_POINT = "MultiPoint" + #: ``GeoJSON LineString`` geometry. + GEO_JSON_LINE_STRING = "LineString" + #: ``GeoJSON MultiLineString`` geometry. + GEO_JSON_MULTI_LINE_STRING = "MultiLineString" + #: ``GeoJSON Polygon`` geometry. + GEO_JSON_POLYGON = "Polygon" + #: ``GeoJSON MultiPolygon`` geometry. + GEO_JSON_MULTI_POLYGON = "MultiPolygon" + #: ``GeoJSON GeometryCollection`` geometry. + GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" + +class GeoJsonObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON object types - Point, + MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and + FeatureCollection. + """ + + #: ``GeoJSON Point`` geometry. + GEO_JSON_POINT = "Point" + #: ``GeoJSON MultiPoint`` geometry. + GEO_JSON_MULTI_POINT = "MultiPoint" + #: ``GeoJSON LineString`` geometry. + GEO_JSON_LINE_STRING = "LineString" + #: ``GeoJSON MultiLineString`` geometry. + GEO_JSON_MULTI_LINE_STRING = "MultiLineString" + #: ``GeoJSON Polygon`` geometry. + GEO_JSON_POLYGON = "Polygon" + #: ``GeoJSON MultiPolygon`` geometry. + GEO_JSON_MULTI_POLYGON = "MultiPolygon" + #: ``GeoJSON GeometryCollection`` geometry. + GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" + #: ``GeoJSON Feature`` object. + GEO_JSON_FEATURE = "Feature" + #: ``GeoJSON FeatureCollection`` object. + GEO_JSON_FEATURE_COLLECTION = "FeatureCollection" + +class LroStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status state of the request. + """ + + #: The request has not started processing yet. + NOT_STARTED = "NotStarted" + #: The request has started processing. + RUNNING = "Running" + #: The request has one or more failures. + FAILED = "Failed" + #: The request has successfully completed. + SUCCEEDED = "Succeeded" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class StyleObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of stateset style. + """ + + #: Boolean type of stateset style. + BOOLEAN_TYPE_STYLE_RULE = "boolean" + #: Number type of stateset style. + NUMBER_TYPE_STYLE_RULE = "number" + #: String type of stateset style. + STRING_TYPE_STYLE_RULE = "string" + +class UploadDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `GeoJSON `_ is a JSON based geospatial data interchange + #: format. + GEOJSON = "geojson" + #: Compressed data format. + ZIP = "zip" + #: ZIP package containing DWG file. + DWGZIPPACKAGE = "dwgzippackage" diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py new file mode 100644 index 000000000000..65267f308b9c --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py @@ -0,0 +1,2601 @@ +# 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 AliasesCreateResponse(msrest.serialization.Model): + """The response model for the Alias Create API for the case when the alias was successfully created. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasesCreateResponse, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListItem(msrest.serialization.Model): + """Detailed information for the alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListItem, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListResponse(msrest.serialization.Model): + """The response model for the List API. Returns a list of all the previously created aliases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar aliases: A list of all the previously created aliases. + :vartype aliases: list[~azure.maps.creator.models.AliasListItem] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'aliases': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'aliases': {'key': 'aliases', 'type': '[AliasListItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListResponse, self).__init__(**kwargs) + self.aliases = None + self.next_link = None + + +class BooleanRuleObject(msrest.serialization.Model): + """The boolean rule. The color is selected based on the logic value of the key. + + :param true: The color when value is true. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type true: str + :param false: The color when value is false. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type false: str + """ + + _attribute_map = { + 'true': {'key': 'true', 'type': 'str'}, + 'false': {'key': 'false', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BooleanRuleObject, self).__init__(**kwargs) + self.true = kwargs.get('true', None) + self.false = kwargs.get('false', None) + + +class StyleObject(msrest.serialization.Model): + """The stateset style model. The style rule could be a numeric type style rule or a boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject definitions `here `_. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BooleanTypeStyleRule, NumberTypeStyleRule, StringTypeStyleRule. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'boolean': 'BooleanTypeStyleRule', 'number': 'NumberTypeStyleRule', 'string': 'StringTypeStyleRule'} + } + + def __init__( + self, + **kwargs + ): + super(StyleObject, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.type = None # type: Optional[str] + + +class BooleanTypeStyleRule(StyleObject): + """The boolean type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Boolean style rules. + :type rules: list[~azure.maps.creator.models.BooleanRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[BooleanRuleObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(BooleanTypeStyleRule, self).__init__(**kwargs) + self.type = 'boolean' # type: str + self.rules = kwargs['rules'] + + +class BufferRequestBody(msrest.serialization.Model): + """An object with a FeatureCollection and a list of distances. All the feature's properties should contain ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + + :param geometries: A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 + `_ for details. + :type geometries: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param distances: List of the distances to compute the buffer for, one-to-one per Feature in + the collection, or one for all Features in the collection. + :type distances: list[float] + """ + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': 'GeoJsonFeatureCollection'}, + 'distances': {'key': 'distances', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferRequestBody, self).__init__(**kwargs) + self.geometries = kwargs.get('geometries', None) + self.distances = kwargs.get('distances', None) + + +class BufferResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Buffer call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary of the call. + :vartype summary: ~azure.maps.creator.models.BufferResponseSummary + :param result: The FeatureCollection of buffers for the input. + :type result: ~azure.maps.creator.models.GeoJsonFeatureCollection + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BufferResponseSummary'}, + 'result': {'key': 'result', 'type': 'GeoJsonFeatureCollection'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class BufferResponseSummary(msrest.serialization.Model): + """Summary of the call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The udid for the user data if one exists. + :vartype udid: str + :ivar information: The information about what happened during the call. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResponseSummary, self).__init__(**kwargs) + self.udid = None + self.information = None + + +class ClosestPointResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Closest Point call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Closest Point Summary object. + :vartype summary: ~azure.maps.creator.models.ClosestPointSummary + :param result: Closest Point Result Array. + :type result: list[~azure.maps.creator.models.ClosestPointResultEntry] + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ClosestPointSummary'}, + 'result': {'key': 'result', 'type': '[ClosestPointResultEntry]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class ClosestPointResultEntry(msrest.serialization.Model): + """Closest Point Result Entry Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The distance in meters from the source point to the closest point. + :vartype distance_in_meters: float + :param position: A location represented as a latitude and longitude. + :type position: ~azure.maps.creator.models.SpatialCoordinate + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + 'geometry_id': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + 'position': {'key': 'position', 'type': 'SpatialCoordinate'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointResultEntry, self).__init__(**kwargs) + self.distance_in_meters = None + self.position = kwargs.get('position', None) + self.geometry_id = None + + +class ClosestPointSummary(msrest.serialization.Model): + """Closest Point Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.udid = None + self.information = None + + +class CollectionDefinitionResponse(msrest.serialization.Model): + """collection of GeoJSON features. + + 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 description: describes the collection. + :type description: str + :param id_prefix: Required. prefix of the collection used. + :type id_prefix: str + :param name: Required. identifier of the collection used, for example, in URIs. + :type name: str + :param title: title of collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param geometry_type: Required. type of geometry returned. Possible values include: "Point", + "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection". + :type geometry_type: str or ~azure.maps.creator.models.GeoJsonGeometryType + :param feature_types: Required. type of features returned. + :type feature_types: list[str] + :param properties: attributes of the collection used. + :type properties: list[~azure.maps.creator.models.DefinitionProperties] + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'id_prefix': {'required': True}, + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'geometry_type': {'required': True}, + 'feature_types': {'required': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'id_prefix': {'key': 'idPrefix', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'geometry_type': {'key': 'geometryType', 'type': 'str'}, + 'feature_types': {'key': 'featureTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '[DefinitionProperties]'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionDefinitionResponse, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.id_prefix = kwargs['id_prefix'] + self.name = kwargs['name'] + self.title = kwargs.get('title', None) + self.ontology = None + self.geometry_type = kwargs['geometry_type'] + self.feature_types = kwargs['feature_types'] + self.properties = kwargs.get('properties', None) + self.links = kwargs.get('links', None) + + +class CollectionInfo(msrest.serialization.Model): + """CollectionInfo. + + 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. identifier of the collection used, for example, in URIs. + :type name: str + :param title: human readable title of the collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param description: a description of the features in the collection. + :type description: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionInfo, self).__init__(**kwargs) + self.name = kwargs['name'] + self.title = kwargs.get('title', None) + self.ontology = None + self.description = kwargs.get('description', None) + self.links = kwargs['links'] + + +class CollectionsResponse(msrest.serialization.Model): + """CollectionsResponse. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param collections: Required. All the collections in a given dataset. + :type collections: list[~azure.maps.creator.models.CollectionInfo] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + 'collections': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'collections': {'key': 'collections', 'type': '[CollectionInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionsResponse, self).__init__(**kwargs) + self.ontology = None + self.links = kwargs['links'] + self.collections = kwargs['collections'] + + +class ConformanceResponse(msrest.serialization.Model): + """ConformanceResponse. + + All required parameters must be populated in order to send to Azure. + + :param conforms_to: Required. List of requirements classes that the server conforms to. + :type conforms_to: list[str] + """ + + _validation = { + 'conforms_to': {'required': True}, + } + + _attribute_map = { + 'conforms_to': {'key': 'conformsTo', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ConformanceResponse, self).__init__(**kwargs) + self.conforms_to = kwargs['conforms_to'] + + +class ConversionListDetailInfo(msrest.serialization.Model): + """Detail information for the conversion requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_id: A unique id that represents the artifact of a *successfully* completed + conversion process. + :vartype conversion_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar udid: The unique id of the content provided to create this conversion. + :vartype udid: str + :ivar created: The date and time of this conversion. + :vartype created: str + :ivar description: User provided description of the content being converted. + :vartype description: str + :ivar feature_counts: A summary of feature counts in this conversion. + :vartype feature_counts: any + """ + + _validation = { + 'conversion_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'udid': {'readonly': True}, + 'created': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'conversion_id': {'key': 'conversionId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListDetailInfo, self).__init__(**kwargs) + self.conversion_id = None + self.ontology = None + self.udid = None + self.created = None + self.description = None + self.feature_counts = None + + +class ConversionListResponse(msrest.serialization.Model): + """The response model for the Conversion List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversions: A list of all the previously submitted conversion requests. + :vartype conversions: list[~azure.maps.creator.models.ConversionListDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'conversions': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'conversions': {'key': 'conversions', 'type': '[ConversionListDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListResponse, self).__init__(**kwargs) + self.conversions = None + self.next_link = None + + +class DatasetDetailInfo(msrest.serialization.Model): + """Detail information for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: The created timestamp for the dataset. + :vartype created: str + :ivar dataset_id: The id for the dataset. + :vartype dataset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar description: The description for the dataset. + :vartype description: str + :param dataset_sources: Information about the details of the create request for the dataset. + :type dataset_sources: ~azure.maps.creator.models.DatasetSources + :ivar feature_counts: The feature counts for the dataset. + :vartype feature_counts: any + """ + + _validation = { + 'created': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_sources': {'key': 'datasetSources', 'type': 'DatasetSources'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetDetailInfo, self).__init__(**kwargs) + self.created = None + self.dataset_id = None + self.ontology = None + self.description = None + self.dataset_sources = kwargs.get('dataset_sources', None) + self.feature_counts = None + + +class DatasetListResponse(msrest.serialization.Model): + """The response model for the Dataset List API. The response body will contain a list of all the previously created datasets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar datasets: A list of all the previously created datasets. + :vartype datasets: list[~azure.maps.creator.models.DatasetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'datasets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'datasets': {'key': 'datasets', 'type': '[DatasetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetListResponse, self).__init__(**kwargs) + self.datasets = None + self.next_link = None + + +class DatasetSources(msrest.serialization.Model): + """Information about the details of the create request for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_ids: The list of ``conversionId`` that were used to create the dataset. + :vartype conversion_ids: list[str] + :ivar append_dataset_id: The dataset that was appended to to create the current dataset. + :vartype append_dataset_id: str + """ + + _validation = { + 'conversion_ids': {'readonly': True}, + 'append_dataset_id': {'readonly': True}, + } + + _attribute_map = { + 'conversion_ids': {'key': 'conversionIds', 'type': '[str]'}, + 'append_dataset_id': {'key': 'appendDatasetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetSources, self).__init__(**kwargs) + self.conversion_ids = None + self.append_dataset_id = None + + +class DefinitionProperties(msrest.serialization.Model): + """DefinitionProperties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. name of attribute. + :type name: str + :param required: Required. is attribute required. + :type required: bool + :param type: Required. type of attribute. + :type type: any + """ + + _validation = { + 'name': {'required': True}, + 'required': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DefinitionProperties, self).__init__(**kwargs) + self.name = kwargs['name'] + self.required = kwargs['required'] + self.type = kwargs['type'] + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + 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 error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.maps.creator.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.creator.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.maps.creator.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ExtendedGeoJsonFeatureCollectionData(msrest.serialization.Model): + """ExtendedGeoJsonFeatureCollectionData. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.ontology = None + self.number_returned = kwargs.get('number_returned', None) + self.links = kwargs.get('links', None) + + +class GeoJsonFeatureCollectionData(msrest.serialization.Model): + """GeoJsonFeatureCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + """ + + _validation = { + 'features': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.features = kwargs['features'] + + +class GeoJsonObject(msrest.serialization.Model): + """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonObject, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ExtendedGeoJsonFeatureCollection. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FeatureCollection': 'ExtendedGeoJsonFeatureCollection'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(**kwargs) + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # type: str + + +class ExtendedGeoJsonFeatureCollection(GeoJsonFeatureCollection, ExtendedGeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type extended with numberReturned and links array. Please refer to `RFC 7946 `_ for details. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'ontology': {'readonly': True}, + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollection, self).__init__(**kwargs) + self.ontology = None + self.number_returned = kwargs.get('number_returned', None) + self.links = kwargs.get('links', None) + self.type = 'FeatureCollection' # type: str + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + + +class FeatureResponse(msrest.serialization.Model): + """FeatureResponse. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param feature: Required. A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 + `_ for details. + :type feature: ~azure.maps.creator.models.GeoJsonFeature + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'feature': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'feature': {'key': 'feature', 'type': 'GeoJsonFeature'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureResponse, self).__init__(**kwargs) + self.ontology = None + self.feature = kwargs['feature'] + self.links = kwargs.get('links', None) + + +class FeatureStateObject(msrest.serialization.Model): + """Single feature state model. + + :param key_name: Feature state Keyname. Maximum length allowed is 1000. + :type key_name: str + :param value: Value for the feature state. Type should comply with the style definition + attached to the featurestate. Maximum length allowed for string type is 1024. + :type value: str + :param event_timestamp: Valid Timestamp when the feature state was captured. + :type event_timestamp: str + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureStateObject, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', None) + self.value = kwargs.get('value', None) + self.event_timestamp = kwargs.get('event_timestamp', None) + + +class FeatureStatesStructure(msrest.serialization.Model): + """The feature states model for a feature. + + :param states: The feature states array. + :type states: list[~azure.maps.creator.models.FeatureStateObject] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[FeatureStateObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureStatesStructure, self).__init__(**kwargs) + self.states = kwargs.get('states', None) + + +class GeofenceGeometry(msrest.serialization.Model): + """The geofencing geometry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_id: ID of the device. + :vartype device_id: str + :ivar ud_id: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :vartype ud_id: str + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + :ivar distance: Distance from the coordinate to the closest border of the geofence. Positive + means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, + but more than the value of searchBuffer away from the closest geofence border, then the value + is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside + the polygon, but more than the value of searchBuffer away from the closest geofencing border, + then the value is -999. A value of 999 means that there is great confidence the coordinate is + well outside the geofence. A value of -999 means that there is great confidence the coordinate + is well within the geofence. + :vartype distance: float + :ivar nearest_lat: Latitude of the nearest point of the geometry. + :vartype nearest_lat: float + :ivar nearest_lon: Longitude of the nearest point of the geometry. + :vartype nearest_lon: float + :ivar nearest_z: Sea level in meter of the nearest point on the 2D extrusion geometry. This + will only be presented in response when value is provided for 'zInMeter' in the request. + :vartype nearest_z: float + """ + + _validation = { + 'device_id': {'readonly': True}, + 'ud_id': {'readonly': True}, + 'geometry_id': {'readonly': True}, + 'distance': {'readonly': True}, + 'nearest_lat': {'readonly': True}, + 'nearest_lon': {'readonly': True}, + 'nearest_z': {'readonly': True}, + } + + _attribute_map = { + 'device_id': {'key': 'deviceId', 'type': 'str'}, + 'ud_id': {'key': 'udId', 'type': 'str'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + 'distance': {'key': 'distance', 'type': 'float'}, + 'nearest_lat': {'key': 'nearestLat', 'type': 'float'}, + 'nearest_lon': {'key': 'nearestLon', 'type': 'float'}, + 'nearest_z': {'key': 'nearestZ', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceGeometry, self).__init__(**kwargs) + self.device_id = None + self.ud_id = None + self.geometry_id = None + self.distance = None + self.nearest_lat = None + self.nearest_lon = None + self.nearest_z = None + + +class GeofenceResponse(msrest.serialization.Model): + """This object is returned from a geofence proximity call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar geometries: Lists the fence geometries that contain the coordinate position or overlap + the searchBuffer around the position. + :vartype geometries: list[~azure.maps.creator.models.GeofenceGeometry] + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. This will only + be presented in response when 'isAsync' query parameter is set to true. + :vartype is_event_published: bool + """ + + _validation = { + 'geometries': {'readonly': True}, + 'expired_geofence_geometry_id': {'readonly': True}, + 'invalid_period_geofence_geometry_id': {'readonly': True}, + 'is_event_published': {'readonly': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeofenceGeometry]'}, + 'expired_geofence_geometry_id': {'key': 'expiredGeofenceGeometryId', 'type': '[str]'}, + 'invalid_period_geofence_geometry_id': {'key': 'invalidPeriodGeofenceGeometryId', 'type': '[str]'}, + 'is_event_published': {'key': 'isEventPublished', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceResponse, self).__init__(**kwargs) + self.geometries = None + self.expired_geofence_geometry_id = None + self.invalid_period_geofence_geometry_id = None + self.is_event_published = None + + +class GeoJsonFeatureData(msrest.serialization.Model): + """GeoJsonFeatureData. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + """ + + _validation = { + 'geometry': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureData, self).__init__(**kwargs) + self.geometry = kwargs['geometry'] + self.properties = kwargs.get('properties', None) + self.id = kwargs.get('id', None) + self.feature_type = kwargs.get('feature_type', None) + + +class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): + """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometry': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeature, self).__init__(**kwargs) + self.geometry = kwargs['geometry'] + self.properties = kwargs.get('properties', None) + self.id = kwargs.get('id', None) + self.feature_type = kwargs.get('feature_type', None) + self.type = 'Feature' # type: str + self.type = 'Feature' # type: str + + +class GeoJsonGeometry(GeoJsonObject): + """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometry, self).__init__(**kwargs) + self.type = 'GeoJsonGeometry' # type: str + + +class GeoJsonGeometryCollectionData(msrest.serialization.Model): + """GeoJsonGeometryCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + """ + + _validation = { + 'geometries': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) + self.geometries = kwargs['geometries'] + + +class GeoJsonGeometryCollection(GeoJsonGeometry, GeoJsonGeometryCollectionData): + """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometries': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometryCollection, self).__init__(**kwargs) + self.geometries = kwargs['geometries'] + self.type = 'GeometryCollection' # type: str + self.type = 'GeometryCollection' # type: str + + +class GeoJsonLineStringData(msrest.serialization.Model): + """GeoJsonLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonLineStringData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonLineString(GeoJsonGeometry, GeoJsonLineStringData): + """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonLineString, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'LineString' # type: str + self.type = 'LineString' # type: str + + +class GeoJsonMultiLineStringData(msrest.serialization.Model): + """GeoJsonMultiLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiLineStringData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiLineString(GeoJsonGeometry, GeoJsonMultiLineStringData): + """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiLineString, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiLineString' # type: str + self.type = 'MultiLineString' # type: str + + +class GeoJsonMultiPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson MultiPoint``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPointData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiPoint(GeoJsonGeometry, GeoJsonMultiPointData): + """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPoint, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiPoint' # type: str + self.type = 'MultiPoint' # type: str + + +class GeoJsonMultiPolygonData(msrest.serialization.Model): + """GeoJsonMultiPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPolygonData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiPolygon(GeoJsonGeometry, GeoJsonMultiPolygonData): + """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPolygon, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiPolygon' # type: str + self.type = 'MultiPolygon' # type: str + + +class GeoJsonPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson Point``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPointData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonPoint(GeoJsonGeometry, GeoJsonPointData): + """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPoint, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'Point' # type: str + self.type = 'Point' # type: str + + +class GeoJsonPolygonData(msrest.serialization.Model): + """GeoJsonPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPolygonData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonPolygon(GeoJsonGeometry, GeoJsonPolygonData): + """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPolygon, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'Polygon' # type: str + self.type = 'Polygon' # type: str + + +class GreatCircleDistanceResponse(msrest.serialization.Model): + """This object is returned from a successful Great Circle Distance call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object. + :vartype summary: ~azure.maps.creator.models.GreatCircleDistanceResponseSummary + :ivar result: Result Object. + :vartype result: ~azure.maps.creator.models.GreatCircleDistanceResponseResult + """ + + _validation = { + 'summary': {'readonly': True}, + 'result': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'GreatCircleDistanceResponseSummary'}, + 'result': {'key': 'result', 'type': 'GreatCircleDistanceResponseResult'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponse, self).__init__(**kwargs) + self.summary = None + self.result = None + + +class GreatCircleDistanceResponseResult(msrest.serialization.Model): + """Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The great circle distance in meters from the source point to the + target point. + :vartype distance_in_meters: float + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponseResult, self).__init__(**kwargs) + self.distance_in_meters = None + + +class GreatCircleDistanceResponseSummary(msrest.serialization.Model): + """Summary object. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :param target_point: A location represented as a latitude and longitude. + :type target_point: ~azure.maps.creator.models.SpatialCoordinate + """ + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'target_point': {'key': 'targetPoint', 'type': 'SpatialCoordinate'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponseSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.target_point = kwargs.get('target_point', None) + + +class LandingPageResponse(msrest.serialization.Model): + """LandingPageResponse. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(LandingPageResponse, self).__init__(**kwargs) + self.ontology = None + self.links = kwargs['links'] + + +class LongRunningOperationResult(msrest.serialization.Model): + """The response model for a Long-Running Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param operation_id: The Id for this long-running operation. + :type operation_id: str + :ivar status: The status state of the request. Possible values include: "NotStarted", + "Running", "Failed", "Succeeded". + :vartype status: str or ~azure.maps.creator.models.LroStatus + :ivar created: The created timestamp. + :vartype created: str + :param error: The error detail. + :type error: ~azure.maps.creator.models.ErrorDetail + :param warning: The error detail. + :type warning: ~azure.maps.creator.models.ErrorDetail + """ + + _validation = { + 'status': {'readonly': True}, + 'created': {'readonly': True}, + } + + _attribute_map = { + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'warning': {'key': 'warning', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(LongRunningOperationResult, self).__init__(**kwargs) + self.operation_id = kwargs.get('operation_id', None) + self.status = None + self.created = None + self.error = kwargs.get('error', None) + self.warning = kwargs.get('warning', None) + + +class MapDataDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The unique data id for the data. + :vartype udid: str + :ivar location: The location of the data. Execute a HTTP ``GET`` on this location to download + the data. + :vartype location: str + :ivar size_in_bytes: The size of the content in bytes. + :vartype size_in_bytes: long + :ivar upload_status: The current upload status of the content. + :vartype upload_status: str + :ivar data_format: The current data format. + :vartype data_format: str + :ivar description: The current description. + :vartype description: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'location': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'upload_status': {'readonly': True}, + 'data_format': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'long'}, + 'upload_status': {'key': 'uploadStatus', 'type': 'str'}, + 'data_format': {'key': 'dataFormat', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataDetailInfo, self).__init__(**kwargs) + self.udid = None + self.location = None + self.size_in_bytes = None + self.upload_status = None + self.data_format = None + self.description = None + + +class MapDataListResponse(msrest.serialization.Model): + """The response model for the Data List API. Returns a list of all the previously uploaded data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar map_data_list: A list of all the previously uploaded data. + :vartype map_data_list: list[~azure.maps.creator.models.MapDataDetailInfo] + """ + + _validation = { + 'map_data_list': {'readonly': True}, + } + + _attribute_map = { + 'map_data_list': {'key': 'mapDataList', 'type': '[MapDataDetailInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataListResponse, self).__init__(**kwargs) + self.map_data_list = None + + +class NumberRuleObject(msrest.serialization.Model): + """The numeric rule. The color is selected from the first range it falls into. + + :param range: The numeric value range for this style rule. If the value is in the range, all + the conditions must hold true. + :type range: ~azure.maps.creator.models.RangeObject + :param color: The color when value is within the range. Color is a JSON string in a variety of + permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA + ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). + Predefined HTML colors names, like yellow and blue, are also permitted. + :type color: str + """ + + _attribute_map = { + 'range': {'key': 'range', 'type': 'RangeObject'}, + 'color': {'key': 'color', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NumberRuleObject, self).__init__(**kwargs) + self.range = kwargs.get('range', None) + self.color = kwargs.get('color', None) + + +class NumberTypeStyleRule(StyleObject): + """The numeric type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Numeric style rules. + :type rules: list[~azure.maps.creator.models.NumberRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[NumberRuleObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(NumberTypeStyleRule, self).__init__(**kwargs) + self.type = 'number' # type: str + self.rules = kwargs['rules'] + + +class PointInPolygonResponse(msrest.serialization.Model): + """Returns true if point is within the polygon, false otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Point In Polygon Summary object. + :vartype summary: ~azure.maps.creator.models.PointInPolygonSummary + :param result: Point In Polygon Result Object. + :type result: ~azure.maps.creator.models.PointInPolygonResult + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'PointInPolygonSummary'}, + 'result': {'key': 'result', 'type': 'PointInPolygonResult'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class PointInPolygonResult(msrest.serialization.Model): + """Point In Polygon Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar point_in_polygons: Point In Polygons Property. + :vartype point_in_polygons: bool + :ivar intersecting_geometries: Geometries array. + :vartype intersecting_geometries: list[str] + """ + + _validation = { + 'point_in_polygons': {'readonly': True}, + 'intersecting_geometries': {'readonly': True}, + } + + _attribute_map = { + 'point_in_polygons': {'key': 'pointInPolygons', 'type': 'bool'}, + 'intersecting_geometries': {'key': 'intersectingGeometries', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResult, self).__init__(**kwargs) + self.point_in_polygons = None + self.intersecting_geometries = None + + +class PointInPolygonSummary(msrest.serialization.Model): + """Point In Polygon Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. Udid is not applicable for POST + spatial operations(set to null). + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.udid = None + self.information = None + + +class RangeObject(msrest.serialization.Model): + """The numeric value range for this style rule. If the value is in the range, all the conditions must hold true. + + :param minimum: All the number x that x ≥ minimum. + :type minimum: float + :param maximum: All the number x that x ≤ maximum. + :type maximum: float + :param exclusive_minimum: All the number x that x > exclusiveMinimum. + :type exclusive_minimum: float + :param exclusive_maximum: All the number x that x < exclusiveMaximum. + :type exclusive_maximum: float + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'exclusive_minimum': {'key': 'exclusiveMinimum', 'type': 'float'}, + 'exclusive_maximum': {'key': 'exclusiveMaximum', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RangeObject, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.exclusive_minimum = kwargs.get('exclusive_minimum', None) + self.exclusive_maximum = kwargs.get('exclusive_maximum', None) + + +class SpatialCoordinate(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lat: Latitude property. + :vartype lat: float + :ivar lon: Longitude property. + :vartype lon: float + """ + + _validation = { + 'lat': {'readonly': True}, + 'lon': {'readonly': True}, + } + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SpatialCoordinate, self).__init__(**kwargs) + self.lat = None + self.lon = None + + +class StatesetCreatedResponse(msrest.serialization.Model): + """The response model for the successful Stateset Create API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stateset_id: The ID for the new stateset created. + :vartype stateset_id: str + """ + + _validation = { + 'stateset_id': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetCreatedResponse, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetGetResponse(msrest.serialization.Model): + """The response model for the successful Stateset Get API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetGetResponse, self).__init__(**kwargs) + self.description = None + self.dataset_ids = kwargs.get('dataset_ids', None) + self.stateset_style = kwargs.get('stateset_style', None) + + +class StatesetInfoObject(msrest.serialization.Model): + """The stateset information detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param stateset_id: The stateset ID of this stateset. + :type stateset_id: str + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetInfoObject, self).__init__(**kwargs) + self.stateset_id = kwargs.get('stateset_id', None) + self.description = None + self.dataset_ids = kwargs.get('dataset_ids', None) + self.stateset_style = kwargs.get('stateset_style', None) + + +class StatesetListResponse(msrest.serialization.Model): + """The response model for the successful Stateset List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param statesets: A list of statesets information. + :type statesets: list[~azure.maps.creator.models.StatesetInfoObject] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'statesets': {'key': 'statesets', 'type': '[StatesetInfoObject]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetListResponse, self).__init__(**kwargs) + self.statesets = kwargs.get('statesets', None) + self.next_link = None + + +class StringTypeStyleRule(StyleObject): + """The string type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. String style rules. + :type rules: list[dict[str, str]] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[{str}]'}, + } + + def __init__( + self, + **kwargs + ): + super(StringTypeStyleRule, self).__init__(**kwargs) + self.type = 'string' # type: str + self.rules = kwargs['rules'] + + +class StylesObject(msrest.serialization.Model): + """The styles model. + + :param styles: An array of stateset styles. The style rule could be a numeric or string or a + boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject + definitions `here `_. + :type styles: list[~azure.maps.creator.models.StyleObject] + """ + + _attribute_map = { + 'styles': {'key': 'styles', 'type': '[StyleObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(StylesObject, self).__init__(**kwargs) + self.styles = kwargs.get('styles', None) + + +class TilesetDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tileset_id: The unique tileset id for the tileset. + :vartype tileset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar dataset_id: The unique dataset Id used to create the tileset. + :vartype dataset_id: str + :ivar description: The description the caller provided when creating the tileset. Maximum + length 1024 characters. + :vartype description: str + :ivar min_zoom: The lowest tile zoom level tile generated for the tileset. + :vartype min_zoom: int + :ivar max_zoom: The highest tile zoom level tile generated for the tileset. + :vartype max_zoom: int + :ivar bbox: Bounding box which all features of the tileset lay within. Projection used - + EPSG:3857. Format : 'minLon, minLat, maxLon, maxLat'. + :vartype bbox: list[float] + """ + + _validation = { + 'tileset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'description': {'readonly': True}, + 'min_zoom': {'readonly': True}, + 'max_zoom': {'readonly': True}, + 'bbox': {'readonly': True}, + } + + _attribute_map = { + 'tileset_id': {'key': 'tilesetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'min_zoom': {'key': 'minZoom', 'type': 'int'}, + 'max_zoom': {'key': 'maxZoom', 'type': 'int'}, + 'bbox': {'key': 'bbox', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetDetailInfo, self).__init__(**kwargs) + self.tileset_id = None + self.ontology = None + self.dataset_id = None + self.description = None + self.min_zoom = None + self.max_zoom = None + self.bbox = None + + +class TilesetListResponse(msrest.serialization.Model): + """The response model for the Tileset List API. Returns a list of all tilesets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tilesets: A list of all tilesets. + :vartype tilesets: list[~azure.maps.creator.models.TilesetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'tilesets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'tilesets': {'key': 'tilesets', 'type': '[TilesetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetListResponse, self).__init__(**kwargs) + self.tilesets = None + self.next_link = None + + +class WfsEndpointLink(msrest.serialization.Model): + """Links to other WFS endpoints. + + All required parameters must be populated in order to send to Azure. + + :param href: Required. The link target. + :type href: str + :param rel: The relation type. + :type rel: str + :param type: A hint indicating what the media type of the result of dereferencing the link + should be. + :type type: str + :param hreflang: A hint indicating what the language of the result of dereferencing the link + should be. + :type hreflang: str + :param title: Used to label the destination of a link such that it can be used as a + human-readable identifier (e.g., a menu entry) in the language indicated by the + Content-Language header field (if present). + :type title: str + """ + + _validation = { + 'href': {'required': True}, + } + + _attribute_map = { + 'href': {'key': 'href', 'type': 'str'}, + 'rel': {'key': 'rel', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hreflang': {'key': 'hreflang', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WfsEndpointLink, self).__init__(**kwargs) + self.href = kwargs['href'] + self.rel = kwargs.get('rel', None) + self.type = kwargs.get('type', None) + self.hreflang = kwargs.get('hreflang', None) + self.title = kwargs.get('title', None) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py new file mode 100644 index 000000000000..2b00344899ed --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py @@ -0,0 +1,2753 @@ +# 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, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._creator_client_enums import * + + +class AliasesCreateResponse(msrest.serialization.Model): + """The response model for the Alias Create API for the case when the alias was successfully created. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasesCreateResponse, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListItem(msrest.serialization.Model): + """Detailed information for the alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListItem, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListResponse(msrest.serialization.Model): + """The response model for the List API. Returns a list of all the previously created aliases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar aliases: A list of all the previously created aliases. + :vartype aliases: list[~azure.maps.creator.models.AliasListItem] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'aliases': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'aliases': {'key': 'aliases', 'type': '[AliasListItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListResponse, self).__init__(**kwargs) + self.aliases = None + self.next_link = None + + +class BooleanRuleObject(msrest.serialization.Model): + """The boolean rule. The color is selected based on the logic value of the key. + + :param true: The color when value is true. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type true: str + :param false: The color when value is false. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type false: str + """ + + _attribute_map = { + 'true': {'key': 'true', 'type': 'str'}, + 'false': {'key': 'false', 'type': 'str'}, + } + + def __init__( + self, + *, + true: Optional[str] = None, + false: Optional[str] = None, + **kwargs + ): + super(BooleanRuleObject, self).__init__(**kwargs) + self.true = true + self.false = false + + +class StyleObject(msrest.serialization.Model): + """The stateset style model. The style rule could be a numeric type style rule or a boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject definitions `here `_. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BooleanTypeStyleRule, NumberTypeStyleRule, StringTypeStyleRule. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'boolean': 'BooleanTypeStyleRule', 'number': 'NumberTypeStyleRule', 'string': 'StringTypeStyleRule'} + } + + def __init__( + self, + *, + key_name: str, + **kwargs + ): + super(StyleObject, self).__init__(**kwargs) + self.key_name = key_name + self.type = None # type: Optional[str] + + +class BooleanTypeStyleRule(StyleObject): + """The boolean type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Boolean style rules. + :type rules: list[~azure.maps.creator.models.BooleanRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[BooleanRuleObject]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List["BooleanRuleObject"], + **kwargs + ): + super(BooleanTypeStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'boolean' # type: str + self.rules = rules + + +class BufferRequestBody(msrest.serialization.Model): + """An object with a FeatureCollection and a list of distances. All the feature's properties should contain ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + + :param geometries: A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 + `_ for details. + :type geometries: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param distances: List of the distances to compute the buffer for, one-to-one per Feature in + the collection, or one for all Features in the collection. + :type distances: list[float] + """ + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': 'GeoJsonFeatureCollection'}, + 'distances': {'key': 'distances', 'type': '[float]'}, + } + + def __init__( + self, + *, + geometries: Optional["GeoJsonFeatureCollection"] = None, + distances: Optional[List[float]] = None, + **kwargs + ): + super(BufferRequestBody, self).__init__(**kwargs) + self.geometries = geometries + self.distances = distances + + +class BufferResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Buffer call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary of the call. + :vartype summary: ~azure.maps.creator.models.BufferResponseSummary + :param result: The FeatureCollection of buffers for the input. + :type result: ~azure.maps.creator.models.GeoJsonFeatureCollection + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BufferResponseSummary'}, + 'result': {'key': 'result', 'type': 'GeoJsonFeatureCollection'}, + } + + def __init__( + self, + *, + result: Optional["GeoJsonFeatureCollection"] = None, + **kwargs + ): + super(BufferResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class BufferResponseSummary(msrest.serialization.Model): + """Summary of the call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The udid for the user data if one exists. + :vartype udid: str + :ivar information: The information about what happened during the call. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResponseSummary, self).__init__(**kwargs) + self.udid = None + self.information = None + + +class ClosestPointResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Closest Point call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Closest Point Summary object. + :vartype summary: ~azure.maps.creator.models.ClosestPointSummary + :param result: Closest Point Result Array. + :type result: list[~azure.maps.creator.models.ClosestPointResultEntry] + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ClosestPointSummary'}, + 'result': {'key': 'result', 'type': '[ClosestPointResultEntry]'}, + } + + def __init__( + self, + *, + result: Optional[List["ClosestPointResultEntry"]] = None, + **kwargs + ): + super(ClosestPointResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class ClosestPointResultEntry(msrest.serialization.Model): + """Closest Point Result Entry Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The distance in meters from the source point to the closest point. + :vartype distance_in_meters: float + :param position: A location represented as a latitude and longitude. + :type position: ~azure.maps.creator.models.SpatialCoordinate + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + 'geometry_id': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + 'position': {'key': 'position', 'type': 'SpatialCoordinate'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + } + + def __init__( + self, + *, + position: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(ClosestPointResultEntry, self).__init__(**kwargs) + self.distance_in_meters = None + self.position = position + self.geometry_id = None + + +class ClosestPointSummary(msrest.serialization.Model): + """Closest Point Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + *, + source_point: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(ClosestPointSummary, self).__init__(**kwargs) + self.source_point = source_point + self.udid = None + self.information = None + + +class CollectionDefinitionResponse(msrest.serialization.Model): + """collection of GeoJSON features. + + 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 description: describes the collection. + :type description: str + :param id_prefix: Required. prefix of the collection used. + :type id_prefix: str + :param name: Required. identifier of the collection used, for example, in URIs. + :type name: str + :param title: title of collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param geometry_type: Required. type of geometry returned. Possible values include: "Point", + "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection". + :type geometry_type: str or ~azure.maps.creator.models.GeoJsonGeometryType + :param feature_types: Required. type of features returned. + :type feature_types: list[str] + :param properties: attributes of the collection used. + :type properties: list[~azure.maps.creator.models.DefinitionProperties] + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'id_prefix': {'required': True}, + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'geometry_type': {'required': True}, + 'feature_types': {'required': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'id_prefix': {'key': 'idPrefix', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'geometry_type': {'key': 'geometryType', 'type': 'str'}, + 'feature_types': {'key': 'featureTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '[DefinitionProperties]'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + id_prefix: str, + name: str, + geometry_type: Union[str, "GeoJsonGeometryType"], + feature_types: List[str], + description: Optional[str] = None, + title: Optional[str] = None, + properties: Optional[List["DefinitionProperties"]] = None, + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(CollectionDefinitionResponse, self).__init__(**kwargs) + self.description = description + self.id_prefix = id_prefix + self.name = name + self.title = title + self.ontology = None + self.geometry_type = geometry_type + self.feature_types = feature_types + self.properties = properties + self.links = links + + +class CollectionInfo(msrest.serialization.Model): + """CollectionInfo. + + 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. identifier of the collection used, for example, in URIs. + :type name: str + :param title: human readable title of the collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param description: a description of the features in the collection. + :type description: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + name: str, + links: List["WfsEndpointLink"], + title: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(CollectionInfo, self).__init__(**kwargs) + self.name = name + self.title = title + self.ontology = None + self.description = description + self.links = links + + +class CollectionsResponse(msrest.serialization.Model): + """CollectionsResponse. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param collections: Required. All the collections in a given dataset. + :type collections: list[~azure.maps.creator.models.CollectionInfo] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + 'collections': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'collections': {'key': 'collections', 'type': '[CollectionInfo]'}, + } + + def __init__( + self, + *, + links: List["WfsEndpointLink"], + collections: List["CollectionInfo"], + **kwargs + ): + super(CollectionsResponse, self).__init__(**kwargs) + self.ontology = None + self.links = links + self.collections = collections + + +class ConformanceResponse(msrest.serialization.Model): + """ConformanceResponse. + + All required parameters must be populated in order to send to Azure. + + :param conforms_to: Required. List of requirements classes that the server conforms to. + :type conforms_to: list[str] + """ + + _validation = { + 'conforms_to': {'required': True}, + } + + _attribute_map = { + 'conforms_to': {'key': 'conformsTo', 'type': '[str]'}, + } + + def __init__( + self, + *, + conforms_to: List[str], + **kwargs + ): + super(ConformanceResponse, self).__init__(**kwargs) + self.conforms_to = conforms_to + + +class ConversionListDetailInfo(msrest.serialization.Model): + """Detail information for the conversion requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_id: A unique id that represents the artifact of a *successfully* completed + conversion process. + :vartype conversion_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar udid: The unique id of the content provided to create this conversion. + :vartype udid: str + :ivar created: The date and time of this conversion. + :vartype created: str + :ivar description: User provided description of the content being converted. + :vartype description: str + :ivar feature_counts: A summary of feature counts in this conversion. + :vartype feature_counts: any + """ + + _validation = { + 'conversion_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'udid': {'readonly': True}, + 'created': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'conversion_id': {'key': 'conversionId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListDetailInfo, self).__init__(**kwargs) + self.conversion_id = None + self.ontology = None + self.udid = None + self.created = None + self.description = None + self.feature_counts = None + + +class ConversionListResponse(msrest.serialization.Model): + """The response model for the Conversion List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversions: A list of all the previously submitted conversion requests. + :vartype conversions: list[~azure.maps.creator.models.ConversionListDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'conversions': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'conversions': {'key': 'conversions', 'type': '[ConversionListDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListResponse, self).__init__(**kwargs) + self.conversions = None + self.next_link = None + + +class DatasetDetailInfo(msrest.serialization.Model): + """Detail information for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: The created timestamp for the dataset. + :vartype created: str + :ivar dataset_id: The id for the dataset. + :vartype dataset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar description: The description for the dataset. + :vartype description: str + :param dataset_sources: Information about the details of the create request for the dataset. + :type dataset_sources: ~azure.maps.creator.models.DatasetSources + :ivar feature_counts: The feature counts for the dataset. + :vartype feature_counts: any + """ + + _validation = { + 'created': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_sources': {'key': 'datasetSources', 'type': 'DatasetSources'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + *, + dataset_sources: Optional["DatasetSources"] = None, + **kwargs + ): + super(DatasetDetailInfo, self).__init__(**kwargs) + self.created = None + self.dataset_id = None + self.ontology = None + self.description = None + self.dataset_sources = dataset_sources + self.feature_counts = None + + +class DatasetListResponse(msrest.serialization.Model): + """The response model for the Dataset List API. The response body will contain a list of all the previously created datasets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar datasets: A list of all the previously created datasets. + :vartype datasets: list[~azure.maps.creator.models.DatasetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'datasets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'datasets': {'key': 'datasets', 'type': '[DatasetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetListResponse, self).__init__(**kwargs) + self.datasets = None + self.next_link = None + + +class DatasetSources(msrest.serialization.Model): + """Information about the details of the create request for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_ids: The list of ``conversionId`` that were used to create the dataset. + :vartype conversion_ids: list[str] + :ivar append_dataset_id: The dataset that was appended to to create the current dataset. + :vartype append_dataset_id: str + """ + + _validation = { + 'conversion_ids': {'readonly': True}, + 'append_dataset_id': {'readonly': True}, + } + + _attribute_map = { + 'conversion_ids': {'key': 'conversionIds', 'type': '[str]'}, + 'append_dataset_id': {'key': 'appendDatasetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetSources, self).__init__(**kwargs) + self.conversion_ids = None + self.append_dataset_id = None + + +class DefinitionProperties(msrest.serialization.Model): + """DefinitionProperties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. name of attribute. + :type name: str + :param required: Required. is attribute required. + :type required: bool + :param type: Required. type of attribute. + :type type: any + """ + + _validation = { + 'name': {'required': True}, + 'required': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'object'}, + } + + def __init__( + self, + *, + name: str, + required: bool, + type: Any, + **kwargs + ): + super(DefinitionProperties, self).__init__(**kwargs) + self.name = name + self.required = required + self.type = type + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + 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 error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.maps.creator.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.creator.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.maps.creator.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ExtendedGeoJsonFeatureCollectionData(msrest.serialization.Model): + """ExtendedGeoJsonFeatureCollectionData. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + number_returned: Optional[int] = None, + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.ontology = None + self.number_returned = number_returned + self.links = links + + +class GeoJsonFeatureCollectionData(msrest.serialization.Model): + """GeoJsonFeatureCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + """ + + _validation = { + 'features': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + **kwargs + ): + super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.features = features + + +class GeoJsonObject(msrest.serialization.Model): + """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonObject, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ExtendedGeoJsonFeatureCollection. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FeatureCollection': 'ExtendedGeoJsonFeatureCollection'} + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(features=features, **kwargs) + self.features = features + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # type: str + + +class ExtendedGeoJsonFeatureCollection(GeoJsonFeatureCollection, ExtendedGeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type extended with numberReturned and links array. Please refer to `RFC 7946 `_ for details. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'ontology': {'readonly': True}, + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + number_returned: Optional[int] = None, + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollection, self).__init__(features=features, number_returned=number_returned, links=links, **kwargs) + self.ontology = None + self.number_returned = number_returned + self.links = links + self.type = 'FeatureCollection' # type: str + self.features = features + self.type = 'FeatureCollection' # type: str + + +class FeatureResponse(msrest.serialization.Model): + """FeatureResponse. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param feature: Required. A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 + `_ for details. + :type feature: ~azure.maps.creator.models.GeoJsonFeature + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'feature': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'feature': {'key': 'feature', 'type': 'GeoJsonFeature'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + feature: "GeoJsonFeature", + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(FeatureResponse, self).__init__(**kwargs) + self.ontology = None + self.feature = feature + self.links = links + + +class FeatureStateObject(msrest.serialization.Model): + """Single feature state model. + + :param key_name: Feature state Keyname. Maximum length allowed is 1000. + :type key_name: str + :param value: Value for the feature state. Type should comply with the style definition + attached to the featurestate. Maximum length allowed for string type is 1024. + :type value: str + :param event_timestamp: Valid Timestamp when the feature state was captured. + :type event_timestamp: str + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: Optional[str] = None, + value: Optional[str] = None, + event_timestamp: Optional[str] = None, + **kwargs + ): + super(FeatureStateObject, self).__init__(**kwargs) + self.key_name = key_name + self.value = value + self.event_timestamp = event_timestamp + + +class FeatureStatesStructure(msrest.serialization.Model): + """The feature states model for a feature. + + :param states: The feature states array. + :type states: list[~azure.maps.creator.models.FeatureStateObject] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[FeatureStateObject]'}, + } + + def __init__( + self, + *, + states: Optional[List["FeatureStateObject"]] = None, + **kwargs + ): + super(FeatureStatesStructure, self).__init__(**kwargs) + self.states = states + + +class GeofenceGeometry(msrest.serialization.Model): + """The geofencing geometry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_id: ID of the device. + :vartype device_id: str + :ivar ud_id: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :vartype ud_id: str + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + :ivar distance: Distance from the coordinate to the closest border of the geofence. Positive + means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, + but more than the value of searchBuffer away from the closest geofence border, then the value + is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside + the polygon, but more than the value of searchBuffer away from the closest geofencing border, + then the value is -999. A value of 999 means that there is great confidence the coordinate is + well outside the geofence. A value of -999 means that there is great confidence the coordinate + is well within the geofence. + :vartype distance: float + :ivar nearest_lat: Latitude of the nearest point of the geometry. + :vartype nearest_lat: float + :ivar nearest_lon: Longitude of the nearest point of the geometry. + :vartype nearest_lon: float + :ivar nearest_z: Sea level in meter of the nearest point on the 2D extrusion geometry. This + will only be presented in response when value is provided for 'zInMeter' in the request. + :vartype nearest_z: float + """ + + _validation = { + 'device_id': {'readonly': True}, + 'ud_id': {'readonly': True}, + 'geometry_id': {'readonly': True}, + 'distance': {'readonly': True}, + 'nearest_lat': {'readonly': True}, + 'nearest_lon': {'readonly': True}, + 'nearest_z': {'readonly': True}, + } + + _attribute_map = { + 'device_id': {'key': 'deviceId', 'type': 'str'}, + 'ud_id': {'key': 'udId', 'type': 'str'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + 'distance': {'key': 'distance', 'type': 'float'}, + 'nearest_lat': {'key': 'nearestLat', 'type': 'float'}, + 'nearest_lon': {'key': 'nearestLon', 'type': 'float'}, + 'nearest_z': {'key': 'nearestZ', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceGeometry, self).__init__(**kwargs) + self.device_id = None + self.ud_id = None + self.geometry_id = None + self.distance = None + self.nearest_lat = None + self.nearest_lon = None + self.nearest_z = None + + +class GeofenceResponse(msrest.serialization.Model): + """This object is returned from a geofence proximity call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar geometries: Lists the fence geometries that contain the coordinate position or overlap + the searchBuffer around the position. + :vartype geometries: list[~azure.maps.creator.models.GeofenceGeometry] + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. This will only + be presented in response when 'isAsync' query parameter is set to true. + :vartype is_event_published: bool + """ + + _validation = { + 'geometries': {'readonly': True}, + 'expired_geofence_geometry_id': {'readonly': True}, + 'invalid_period_geofence_geometry_id': {'readonly': True}, + 'is_event_published': {'readonly': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeofenceGeometry]'}, + 'expired_geofence_geometry_id': {'key': 'expiredGeofenceGeometryId', 'type': '[str]'}, + 'invalid_period_geofence_geometry_id': {'key': 'invalidPeriodGeofenceGeometryId', 'type': '[str]'}, + 'is_event_published': {'key': 'isEventPublished', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceResponse, self).__init__(**kwargs) + self.geometries = None + self.expired_geofence_geometry_id = None + self.invalid_period_geofence_geometry_id = None + self.is_event_published = None + + +class GeoJsonFeatureData(msrest.serialization.Model): + """GeoJsonFeatureData. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + """ + + _validation = { + 'geometry': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + } + + def __init__( + self, + *, + geometry: "GeoJsonGeometry", + properties: Optional[Any] = None, + id: Optional[str] = None, + feature_type: Optional[str] = None, + **kwargs + ): + super(GeoJsonFeatureData, self).__init__(**kwargs) + self.geometry = geometry + self.properties = properties + self.id = id + self.feature_type = feature_type + + +class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): + """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometry': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + geometry: "GeoJsonGeometry", + properties: Optional[Any] = None, + id: Optional[str] = None, + feature_type: Optional[str] = None, + **kwargs + ): + super(GeoJsonFeature, self).__init__(geometry=geometry, properties=properties, id=id, feature_type=feature_type, **kwargs) + self.geometry = geometry + self.properties = properties + self.id = id + self.feature_type = feature_type + self.type = 'Feature' # type: str + self.type = 'Feature' # type: str + + +class GeoJsonGeometry(GeoJsonObject): + """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometry, self).__init__(**kwargs) + self.type = 'GeoJsonGeometry' # type: str + + +class GeoJsonGeometryCollectionData(msrest.serialization.Model): + """GeoJsonGeometryCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + """ + + _validation = { + 'geometries': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + } + + def __init__( + self, + *, + geometries: List["GeoJsonGeometry"], + **kwargs + ): + super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) + self.geometries = geometries + + +class GeoJsonGeometryCollection(GeoJsonGeometry, GeoJsonGeometryCollectionData): + """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometries': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + geometries: List["GeoJsonGeometry"], + **kwargs + ): + super(GeoJsonGeometryCollection, self).__init__(geometries=geometries, **kwargs) + self.geometries = geometries + self.type = 'GeometryCollection' # type: str + self.type = 'GeometryCollection' # type: str + + +class GeoJsonLineStringData(msrest.serialization.Model): + """GeoJsonLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonLineStringData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonLineString(GeoJsonGeometry, GeoJsonLineStringData): + """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonLineString, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'LineString' # type: str + self.type = 'LineString' # type: str + + +class GeoJsonMultiLineStringData(msrest.serialization.Model): + """GeoJsonMultiLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonMultiLineStringData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiLineString(GeoJsonGeometry, GeoJsonMultiLineStringData): + """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonMultiLineString, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiLineString' # type: str + self.type = 'MultiLineString' # type: str + + +class GeoJsonMultiPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson MultiPoint``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonMultiPointData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiPoint(GeoJsonGeometry, GeoJsonMultiPointData): + """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonMultiPoint, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiPoint' # type: str + self.type = 'MultiPoint' # type: str + + +class GeoJsonMultiPolygonData(msrest.serialization.Model): + """GeoJsonMultiPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[List[float]]]], + **kwargs + ): + super(GeoJsonMultiPolygonData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiPolygon(GeoJsonGeometry, GeoJsonMultiPolygonData): + """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[List[float]]]], + **kwargs + ): + super(GeoJsonMultiPolygon, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiPolygon' # type: str + self.type = 'MultiPolygon' # type: str + + +class GeoJsonPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson Point``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + } + + def __init__( + self, + *, + coordinates: List[float], + **kwargs + ): + super(GeoJsonPointData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonPoint(GeoJsonGeometry, GeoJsonPointData): + """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[float], + **kwargs + ): + super(GeoJsonPoint, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'Point' # type: str + self.type = 'Point' # type: str + + +class GeoJsonPolygonData(msrest.serialization.Model): + """GeoJsonPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonPolygonData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonPolygon(GeoJsonGeometry, GeoJsonPolygonData): + """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonPolygon, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'Polygon' # type: str + self.type = 'Polygon' # type: str + + +class GreatCircleDistanceResponse(msrest.serialization.Model): + """This object is returned from a successful Great Circle Distance call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object. + :vartype summary: ~azure.maps.creator.models.GreatCircleDistanceResponseSummary + :ivar result: Result Object. + :vartype result: ~azure.maps.creator.models.GreatCircleDistanceResponseResult + """ + + _validation = { + 'summary': {'readonly': True}, + 'result': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'GreatCircleDistanceResponseSummary'}, + 'result': {'key': 'result', 'type': 'GreatCircleDistanceResponseResult'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponse, self).__init__(**kwargs) + self.summary = None + self.result = None + + +class GreatCircleDistanceResponseResult(msrest.serialization.Model): + """Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The great circle distance in meters from the source point to the + target point. + :vartype distance_in_meters: float + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponseResult, self).__init__(**kwargs) + self.distance_in_meters = None + + +class GreatCircleDistanceResponseSummary(msrest.serialization.Model): + """Summary object. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :param target_point: A location represented as a latitude and longitude. + :type target_point: ~azure.maps.creator.models.SpatialCoordinate + """ + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'target_point': {'key': 'targetPoint', 'type': 'SpatialCoordinate'}, + } + + def __init__( + self, + *, + source_point: Optional["SpatialCoordinate"] = None, + target_point: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(GreatCircleDistanceResponseSummary, self).__init__(**kwargs) + self.source_point = source_point + self.target_point = target_point + + +class LandingPageResponse(msrest.serialization.Model): + """LandingPageResponse. + + 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 ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + links: List["WfsEndpointLink"], + **kwargs + ): + super(LandingPageResponse, self).__init__(**kwargs) + self.ontology = None + self.links = links + + +class LongRunningOperationResult(msrest.serialization.Model): + """The response model for a Long-Running Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param operation_id: The Id for this long-running operation. + :type operation_id: str + :ivar status: The status state of the request. Possible values include: "NotStarted", + "Running", "Failed", "Succeeded". + :vartype status: str or ~azure.maps.creator.models.LroStatus + :ivar created: The created timestamp. + :vartype created: str + :param error: The error detail. + :type error: ~azure.maps.creator.models.ErrorDetail + :param warning: The error detail. + :type warning: ~azure.maps.creator.models.ErrorDetail + """ + + _validation = { + 'status': {'readonly': True}, + 'created': {'readonly': True}, + } + + _attribute_map = { + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'warning': {'key': 'warning', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + operation_id: Optional[str] = None, + error: Optional["ErrorDetail"] = None, + warning: Optional["ErrorDetail"] = None, + **kwargs + ): + super(LongRunningOperationResult, self).__init__(**kwargs) + self.operation_id = operation_id + self.status = None + self.created = None + self.error = error + self.warning = warning + + +class MapDataDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The unique data id for the data. + :vartype udid: str + :ivar location: The location of the data. Execute a HTTP ``GET`` on this location to download + the data. + :vartype location: str + :ivar size_in_bytes: The size of the content in bytes. + :vartype size_in_bytes: long + :ivar upload_status: The current upload status of the content. + :vartype upload_status: str + :ivar data_format: The current data format. + :vartype data_format: str + :ivar description: The current description. + :vartype description: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'location': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'upload_status': {'readonly': True}, + 'data_format': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'long'}, + 'upload_status': {'key': 'uploadStatus', 'type': 'str'}, + 'data_format': {'key': 'dataFormat', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataDetailInfo, self).__init__(**kwargs) + self.udid = None + self.location = None + self.size_in_bytes = None + self.upload_status = None + self.data_format = None + self.description = None + + +class MapDataListResponse(msrest.serialization.Model): + """The response model for the Data List API. Returns a list of all the previously uploaded data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar map_data_list: A list of all the previously uploaded data. + :vartype map_data_list: list[~azure.maps.creator.models.MapDataDetailInfo] + """ + + _validation = { + 'map_data_list': {'readonly': True}, + } + + _attribute_map = { + 'map_data_list': {'key': 'mapDataList', 'type': '[MapDataDetailInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataListResponse, self).__init__(**kwargs) + self.map_data_list = None + + +class NumberRuleObject(msrest.serialization.Model): + """The numeric rule. The color is selected from the first range it falls into. + + :param range: The numeric value range for this style rule. If the value is in the range, all + the conditions must hold true. + :type range: ~azure.maps.creator.models.RangeObject + :param color: The color when value is within the range. Color is a JSON string in a variety of + permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA + ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). + Predefined HTML colors names, like yellow and blue, are also permitted. + :type color: str + """ + + _attribute_map = { + 'range': {'key': 'range', 'type': 'RangeObject'}, + 'color': {'key': 'color', 'type': 'str'}, + } + + def __init__( + self, + *, + range: Optional["RangeObject"] = None, + color: Optional[str] = None, + **kwargs + ): + super(NumberRuleObject, self).__init__(**kwargs) + self.range = range + self.color = color + + +class NumberTypeStyleRule(StyleObject): + """The numeric type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Numeric style rules. + :type rules: list[~azure.maps.creator.models.NumberRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[NumberRuleObject]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List["NumberRuleObject"], + **kwargs + ): + super(NumberTypeStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'number' # type: str + self.rules = rules + + +class PointInPolygonResponse(msrest.serialization.Model): + """Returns true if point is within the polygon, false otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Point In Polygon Summary object. + :vartype summary: ~azure.maps.creator.models.PointInPolygonSummary + :param result: Point In Polygon Result Object. + :type result: ~azure.maps.creator.models.PointInPolygonResult + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'PointInPolygonSummary'}, + 'result': {'key': 'result', 'type': 'PointInPolygonResult'}, + } + + def __init__( + self, + *, + result: Optional["PointInPolygonResult"] = None, + **kwargs + ): + super(PointInPolygonResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class PointInPolygonResult(msrest.serialization.Model): + """Point In Polygon Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar point_in_polygons: Point In Polygons Property. + :vartype point_in_polygons: bool + :ivar intersecting_geometries: Geometries array. + :vartype intersecting_geometries: list[str] + """ + + _validation = { + 'point_in_polygons': {'readonly': True}, + 'intersecting_geometries': {'readonly': True}, + } + + _attribute_map = { + 'point_in_polygons': {'key': 'pointInPolygons', 'type': 'bool'}, + 'intersecting_geometries': {'key': 'intersectingGeometries', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResult, self).__init__(**kwargs) + self.point_in_polygons = None + self.intersecting_geometries = None + + +class PointInPolygonSummary(msrest.serialization.Model): + """Point In Polygon Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. Udid is not applicable for POST + spatial operations(set to null). + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + *, + source_point: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(PointInPolygonSummary, self).__init__(**kwargs) + self.source_point = source_point + self.udid = None + self.information = None + + +class RangeObject(msrest.serialization.Model): + """The numeric value range for this style rule. If the value is in the range, all the conditions must hold true. + + :param minimum: All the number x that x ≥ minimum. + :type minimum: float + :param maximum: All the number x that x ≤ maximum. + :type maximum: float + :param exclusive_minimum: All the number x that x > exclusiveMinimum. + :type exclusive_minimum: float + :param exclusive_maximum: All the number x that x < exclusiveMaximum. + :type exclusive_maximum: float + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'exclusive_minimum': {'key': 'exclusiveMinimum', 'type': 'float'}, + 'exclusive_maximum': {'key': 'exclusiveMaximum', 'type': 'float'}, + } + + def __init__( + self, + *, + minimum: Optional[float] = None, + maximum: Optional[float] = None, + exclusive_minimum: Optional[float] = None, + exclusive_maximum: Optional[float] = None, + **kwargs + ): + super(RangeObject, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.exclusive_minimum = exclusive_minimum + self.exclusive_maximum = exclusive_maximum + + +class SpatialCoordinate(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lat: Latitude property. + :vartype lat: float + :ivar lon: Longitude property. + :vartype lon: float + """ + + _validation = { + 'lat': {'readonly': True}, + 'lon': {'readonly': True}, + } + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SpatialCoordinate, self).__init__(**kwargs) + self.lat = None + self.lon = None + + +class StatesetCreatedResponse(msrest.serialization.Model): + """The response model for the successful Stateset Create API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stateset_id: The ID for the new stateset created. + :vartype stateset_id: str + """ + + _validation = { + 'stateset_id': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetCreatedResponse, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetGetResponse(msrest.serialization.Model): + """The response model for the successful Stateset Get API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + *, + dataset_ids: Optional[List[str]] = None, + stateset_style: Optional["StylesObject"] = None, + **kwargs + ): + super(StatesetGetResponse, self).__init__(**kwargs) + self.description = None + self.dataset_ids = dataset_ids + self.stateset_style = stateset_style + + +class StatesetInfoObject(msrest.serialization.Model): + """The stateset information detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param stateset_id: The stateset ID of this stateset. + :type stateset_id: str + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + *, + stateset_id: Optional[str] = None, + dataset_ids: Optional[List[str]] = None, + stateset_style: Optional["StylesObject"] = None, + **kwargs + ): + super(StatesetInfoObject, self).__init__(**kwargs) + self.stateset_id = stateset_id + self.description = None + self.dataset_ids = dataset_ids + self.stateset_style = stateset_style + + +class StatesetListResponse(msrest.serialization.Model): + """The response model for the successful Stateset List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param statesets: A list of statesets information. + :type statesets: list[~azure.maps.creator.models.StatesetInfoObject] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'statesets': {'key': 'statesets', 'type': '[StatesetInfoObject]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + statesets: Optional[List["StatesetInfoObject"]] = None, + **kwargs + ): + super(StatesetListResponse, self).__init__(**kwargs) + self.statesets = statesets + self.next_link = None + + +class StringTypeStyleRule(StyleObject): + """The string type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. String style rules. + :type rules: list[dict[str, str]] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[{str}]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List[Dict[str, str]], + **kwargs + ): + super(StringTypeStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'string' # type: str + self.rules = rules + + +class StylesObject(msrest.serialization.Model): + """The styles model. + + :param styles: An array of stateset styles. The style rule could be a numeric or string or a + boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject + definitions `here `_. + :type styles: list[~azure.maps.creator.models.StyleObject] + """ + + _attribute_map = { + 'styles': {'key': 'styles', 'type': '[StyleObject]'}, + } + + def __init__( + self, + *, + styles: Optional[List["StyleObject"]] = None, + **kwargs + ): + super(StylesObject, self).__init__(**kwargs) + self.styles = styles + + +class TilesetDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tileset_id: The unique tileset id for the tileset. + :vartype tileset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar dataset_id: The unique dataset Id used to create the tileset. + :vartype dataset_id: str + :ivar description: The description the caller provided when creating the tileset. Maximum + length 1024 characters. + :vartype description: str + :ivar min_zoom: The lowest tile zoom level tile generated for the tileset. + :vartype min_zoom: int + :ivar max_zoom: The highest tile zoom level tile generated for the tileset. + :vartype max_zoom: int + :ivar bbox: Bounding box which all features of the tileset lay within. Projection used - + EPSG:3857. Format : 'minLon, minLat, maxLon, maxLat'. + :vartype bbox: list[float] + """ + + _validation = { + 'tileset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'description': {'readonly': True}, + 'min_zoom': {'readonly': True}, + 'max_zoom': {'readonly': True}, + 'bbox': {'readonly': True}, + } + + _attribute_map = { + 'tileset_id': {'key': 'tilesetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'min_zoom': {'key': 'minZoom', 'type': 'int'}, + 'max_zoom': {'key': 'maxZoom', 'type': 'int'}, + 'bbox': {'key': 'bbox', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetDetailInfo, self).__init__(**kwargs) + self.tileset_id = None + self.ontology = None + self.dataset_id = None + self.description = None + self.min_zoom = None + self.max_zoom = None + self.bbox = None + + +class TilesetListResponse(msrest.serialization.Model): + """The response model for the Tileset List API. Returns a list of all tilesets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tilesets: A list of all tilesets. + :vartype tilesets: list[~azure.maps.creator.models.TilesetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'tilesets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'tilesets': {'key': 'tilesets', 'type': '[TilesetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetListResponse, self).__init__(**kwargs) + self.tilesets = None + self.next_link = None + + +class WfsEndpointLink(msrest.serialization.Model): + """Links to other WFS endpoints. + + All required parameters must be populated in order to send to Azure. + + :param href: Required. The link target. + :type href: str + :param rel: The relation type. + :type rel: str + :param type: A hint indicating what the media type of the result of dereferencing the link + should be. + :type type: str + :param hreflang: A hint indicating what the language of the result of dereferencing the link + should be. + :type hreflang: str + :param title: Used to label the destination of a link such that it can be used as a + human-readable identifier (e.g., a menu entry) in the language indicated by the + Content-Language header field (if present). + :type title: str + """ + + _validation = { + 'href': {'required': True}, + } + + _attribute_map = { + 'href': {'key': 'href', 'type': 'str'}, + 'rel': {'key': 'rel', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hreflang': {'key': 'hreflang', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + } + + def __init__( + self, + *, + href: str, + rel: Optional[str] = None, + type: Optional[str] = None, + hreflang: Optional[str] = None, + title: Optional[str] = None, + **kwargs + ): + super(WfsEndpointLink, self).__init__(**kwargs) + self.href = href + self.rel = rel + self.type = type + self.hreflang = hreflang + self.title = title diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py new file mode 100644 index 000000000000..caac2ed53e58 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._alias_operations import AliasOperations +from ._data_operations import DataOperations +from ._dataset_operations import DatasetOperations +from ._conversion_operations import ConversionOperations +from ._feature_state_operations import FeatureStateOperations +from ._spatial_operations import SpatialOperations +from ._tileset_operations import TilesetOperations +from ._wfs_operations import WFSOperations + +__all__ = [ + 'AliasOperations', + 'DataOperations', + 'DatasetOperations', + 'ConversionOperations', + 'FeatureStateOperations', + 'SpatialOperations', + 'TilesetOperations', + 'WFSOperations', +] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py new file mode 100644 index 000000000000..308a2fc42056 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py @@ -0,0 +1,513 @@ +# 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 .. 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 AliasOperations(object): + """AliasOperations 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.maps.creator.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 create( + self, + creator_data_item_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AliasesCreateResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create an alias. You can also assign the alias during the create + request. An alias can reference an ID generated by a creator service, but cannot reference + another alias ID. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your alias, you will use a ``POST`` request. If you would like to assign the alias + during the creation, you will pass the ``resourceId`` query parameter. + + Create Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Create API returns a HTTP ``201 Created`` response with the alias resource in the body. + + A sample response from creating an alias: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasesCreateResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasesCreateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasesCreateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + if creator_data_item_id is not None: + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, '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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Access-Control-Expose-Headers']=self._deserialize('str', response.headers.get('Access-Control-Expose-Headers')) + deserialized = self._deserialize('AliasesCreateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/aliases'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AliasListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created aliases. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your aliases, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all aliases in ``json`` format. The response contains + the following details for each alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + yyyy-MM-ddTHH:mm:ss.sssZ + + + A sample response returning 2 alias resources: + + .. code-block:: json + + { + "aliases": [ + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }, + { + "createdTimestamp": "2020-02-18T19:53:33.123Z", + "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + "creatorDataItemId": null, + "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AliasListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.AliasListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AliasListResponse', pipeline_response) + list_of_elem = deserialized.aliases + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/aliases'} # type: ignore + + def assign( + self, + alias_id, # type: str + creator_data_item_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AliasListItem" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to assign an alias to reference a resource. + + Submit Assign Request + ^^^^^^^^^^^^^^^^^^^^^ + + To assign your alias to a resource, you will use a ``PUT`` request with the ``aliasId`` in the + path and the ``creatorDataItemId`` passed as a query parameter. + + Assign Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Assign API returns a HTTP ``200 OK`` response with the updated alias resource in the body, + if the alias was assigned successfully. A sample of the assign response is + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.assign.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_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') + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + assign.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + def delete( + self, + alias_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a previously created alias. You can also use this API to + delete old/unused aliases to create space for new content.This API does not delete the + references resource, only the alias referencing the resource. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your alias you will issue a ``DELETE`` request where the path will contain the + ``aliasId`` of the alias to delete. + + Delete Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Delete API returns a HTTP ``204 No Content`` response with an empty body, if the alias was + deleted successfully. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + def get_details( + self, + alias_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AliasListItem" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch the details of a previously created alias. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details of your alias, you will issue a ``GET`` request with the ``aliasId`` in the + path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the previously created alias in ``json`` format. The response + contains the following details for the alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. + + + Here's a sample response: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_details.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_details.metadata = {'url': '/aliases/{aliasId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py new file mode 100644 index 000000000000..2ea6834b323d --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py @@ -0,0 +1,582 @@ +# 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.core.polling.base_polling import LROBasePolling + +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 ConversionOperations(object): + """ConversionOperations 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.maps.creator.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 _convert_initial( + self, + udid, # type: str + output_ontology, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._convert_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['outputOntology'] = self._serialize.query("output_ontology", output_ontology, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _convert_initial.metadata = {'url': '/conversions'} # type: ignore + + def begin_convert( + self, + udid, # type: str + output_ontology, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Conversion API lets the caller import a set of DWG design files as a zipped `Drawing + Package `_ into Azure Maps. The `Drawing Package + `_ should first be uploaded using the `Azure Maps Data + Service `_. Once uploaded, use the ``udid`` + returned by the `Data Upload API + `_ to call this Conversion API. + + Convert DWG package + ------------------- + + The Conversion API performs a `long-running request `_. + + Debug DWG package issues + ------------------------ + + During the Conversion process, if there are any issues with the DWG package `errors and + warnings `_ are provided in the response along with a + *diagnostic package* to visualize and diagnose these issues. In case any issues are encountered + with your DWG package, the Conversion operation status process as detailed `here + `_ returns the location of the *diagnostic package* that can + be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + package* location can be found in the properties section of the conversion operation status + response and looks like the following: + + .. code-block:: json + + { + "properties": { + "diagnosticPackageLocation": + "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + } + } + + The *diagnostic package* can be downloaded by executing a ``HTTP GET`` request on the + ``diagnosticPackageLocation``. + For more details on how to use the tool to visualize and diagnose all the errors and warnings + see `Drawing Error Visualizer `_. :code:`
` + + A conversion operation will be marked as *success* if there are zero or more warnings but will + be marked as *failed* if any errors are encountered. + + :param udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: str + :param output_ontology: Output ontology version. "facility-2.0" is the only supported value at + this time. Please refer to this `article + `_ for more + information about Azure Maps Creator ontologies. + :type output_ontology: str + :param description: User provided description of the content being converted. + :type description: 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 LROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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._convert_initial( + udid=udid, + output_ontology=output_ontology, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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_convert.metadata = {'url': '/conversions'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConversionListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all successful data conversions submitted + previously using the `Conversion API + `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all successful conversions you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Conversion List API returns the complete list of all conversion details in ``json`` + format.:code:`
` + + Here is a sample response returning the details of two successful conversion requests: + + :code:`
` + + .. code-block:: json + + { + "conversions": + [ + { + "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + "udid": "31838736-8b84-11ea-bc55-0242ac130003", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + }, + { + "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + } + ] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConversionListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.ConversionListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConversionListResponse', pipeline_response) + list_of_elem = deserialized.conversions + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/conversions'} # type: ignore + + def get( + self, + conversion_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConversionListDetailInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a successful data conversion submitted previously using the + `Conversion API `_. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConversionListDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConversionListDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConversionListDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + def delete( + self, + conversion_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete any data conversions created previously using the + `Conversion API `_. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your conversion data you will issue a ``DELETE`` request where the path will contain + the ``conversionId`` of the data to delete. + + Conversion Delete Response + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Conversion Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + converted data resources were deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if no resource associated with the + passed-in ``conversionId`` is found. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + def get_operation( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This path will be obtained from a call to POST /conversions. While in progress, an http200 + will be returned with no extra headers - followed by an http200 with Resource-Location header + once successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/conversions/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py new file mode 100644 index 000000000000..2152e18b8e85 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py @@ -0,0 +1,846 @@ +# 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.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataOperations(object): + """DataOperations 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.maps.creator.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 _upload_preview_initial( + self, + upload_data_format, # type: Union[str, "_models.UploadDataFormat"] + upload_content, # type: Union[IO, Any] + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/octet-stream") + accept = "application/json" + + # Construct URL + url = self._upload_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + query_parameters['dataFormat'] = self._serialize.query("upload_data_format", upload_data_format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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] + if header_parameters['Content-Type'].split(";")[0] in ['application/octet-stream']: + body_content_kwargs['stream_content'] = upload_content + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + body_content = self._serialize.body(upload_content, 'object') + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/octet-stream', 'application/json']".format(header_parameters['Content-Type']) + ) + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _upload_preview_initial.metadata = {'url': '/mapData'} # type: ignore + + def begin_upload_preview( + self, + upload_data_format, # type: Union[str, "_models.UploadDataFormat"] + upload_content, # type: Union[IO, Any] + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + The Data Upload API allows the caller to upload data content to the Azure Maps service. + You can use this API in a scenario like uploading a collection of Geofences in ``GeoJSON`` + format, for use in our `Azure Maps Geofencing Service + `_. + + Submit Upload Request + --------------------- + + To upload your content you will use a ``POST`` request. The request body will contain the data + to upload. The + ``dataFormat`` query parameter will contain the format for the data, the ``dataSharingLevel`` + query parameter + can contain the sharing level for the data. The ``Content-Type`` header will be set to the + content type of the + data. + + For example, to upload a collection of geofences in ``GeoJSON`` format, set the request body + to the geofence + content. Set the ``dataFormat`` query parameter to *geojson*\ , and set the ``Content-Type`` + header to either one + of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for uploading a simple Geofence represented as a circle geometry + using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The Data Upload API performs a + `long-running request `_. + + Data Upload Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param upload_data_format: Data format of the content being uploaded. + :type upload_data_format: str or ~azure.maps.creator.models.UploadDataFormat + :param upload_content: The content to upload. + :type upload_content: IO or any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: str + :keyword str content_type: Media type of the body sent to the API. Default value is "application/octet-stream". + Allowed values are: "application/octet-stream", "application/json". + :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 LROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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._upload_preview_initial( + upload_data_format=upload_data_format, + upload_content=upload_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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_upload_preview.metadata = {'url': '/mapData'} # type: ignore + + def list_preview( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.MapDataListResponse" + """**Applies to:** see pricing `tiers `_. + + This API allows the caller to fetch a list of all content uploaded previously using the `Data + Upload API `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your map data content you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Data List API returns the complete list of all data in ``json`` format. The response + contains the following details for each data resource: + + .. + + udid - The unique data id for the data resource. + + location - The location of the data resource. Execute a HTTP ``GET`` on this location to + download the data. + + + Here's a sample response returning the ``udid`` and ``location`` of 3 data resources: + + :code:`
` + + .. code-block:: json + + { + "mapDataList": + [ + { + "udid": "9a1288fa-1858-4a3b-b68d-13a8j5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/9a1288fa-1858-4a3b-b68d-13a8j5af7d7c?api-version=1.0", + "sizeInBytes": 29920, + "uploadStatus": "Completed" + }, + { + "udid": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/8b1288fa-1958-4a2b-b68e-13a7i5af7d7c?api-version=1.0", + "sizeInBytes": 1339, + "uploadStatus": "Completed" + }, + { + "udid": "7c1288fa-2058-4a1b-b68f-13a6h5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/7c1288fa-2058-4a1b-b68f-13a6h5af7d7c?api-version=1.0", + "sizeInBytes": 1650, + "uploadStatus": "Pending" + }] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapDataListResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.MapDataListResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapDataListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.list_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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 self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('MapDataListResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_preview.metadata = {'url': '/mapData'} # type: ignore + + def _update_preview_initial( + self, + unique_data_id, # type: str + update_content, # type: Any + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_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') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(update_content, 'object') + 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_preview_initial.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def begin_update_preview( + self, + unique_data_id, # type: str + update_content, # type: Any + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + The Data Update API allows the caller to update a previously uploaded data content. + + You can use this API in a scenario like adding or removing geofences to or from an existing + collection of geofences. + Geofences are uploaded using the `Data Upload API + `_\ , for + use in the `Azure Maps Geofencing Service `_. + + Please note that the Update API will *replace* and *override* the existing data content. + + Submit Update Request + --------------------- + + To update your content you will use a ``PUT`` request. The request body will contain the new + data that will replace + the existing data. The ``Content-Type`` header will be set to the content type of the data, and + the path will contain + the ``udid`` of the data to be update. + + For example, to update a collection of geofences that were previously uploaded using the Upload + API, place the new + geofence content in the request body. Set the ``udid`` parameter in the path to the ``udid`` of + the data received + previously in the upload API response. And set the ``Content-Type`` header to one of the + following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for updating a simple Geofence. It's represented as a circle + geometry using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The previously uploaded geofence had a radius of 100m. The above request will update it to + 500m. + + The Data Update API performs a + `long-running request `_. + + Data Update Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :param update_content: The new content that will update/replace the previously uploaded + content. + :type update_content: any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: 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 LROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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_preview_initial( + unique_data_id=unique_data_id, + update_content=update_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def download_preview( + self, + unique_data_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> IO + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to download a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like downloading an existing collection of geofences + uploaded previously using the `Data Upload API + `_ for use in our + `Azure Maps Geofencing Service `_. + + Submit Download Request + ^^^^^^^^^^^^^^^^^^^^^^^ + + To download your content you will use a ``GET`` request where the path will contain the + ``udid`` of the data to download. Optionally, you can also pass in an ``Accept`` header to + specify a preference for the ``Content-Type`` of the data response. :code:`
` + For example, to download a collection of geofences previously uploaded using the Upload API, + set the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response and set the ``Accept`` header to either one of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Download Data Response + ^^^^^^^^^^^^^^^^^^^^^^ + + The Download API will return a HTTP ``200 OK`` response if the data resource with the passed-in + ``udid`` is found, where the response body will contain the content of the data + resource.:code:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found.:code:`
` + + Here's a sample response body for a simple geofence represented in ``GeoJSON`` uploaded + previously using the Upload API: + :code:`
` + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + }. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json, application/vnd.geo+json, application/octet-stream" + + # Construct URL + url = self.download_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + download_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def delete_preview( + self, + unique_data_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to delete a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like removing geofences previously uploaded using the `Data + Upload API `_ for use + in our `Azure Maps Geofencing Service + `_. You can also use this API to delete + old/unused uploaded content and create space for new content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``udid`` of the data to delete.:code:`
`\ :raw-html-m2r:`
` + For example, to delete a collection of geofences previously uploaded using the Upload API, set + the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response. + + Delete Data Response + ^^^^^^^^^^^^^^^^^^^^ + + The Data Delete API returns a HTTP ``204 No Content`` response with an empty body, if the data + resource was deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def get_operation_preview( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This path will be obtained from a call to POST /mapData. While in progress, an http200 will be + returned with no extra headers - followed by an http200 with Resource-Location header once + completed. + + :param operation_id: The ID to query the status for the data upload request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation_preview.metadata = {'url': '/mapData/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py new file mode 100644 index 000000000000..0f094e759bc5 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py @@ -0,0 +1,637 @@ +# 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.core.polling.base_polling import LROBasePolling + +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 DatasetOperations(object): + """DatasetOperations 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.maps.creator.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 _create_initial( + self, + conversion_id, # type: str + dataset_id=None, # type: Optional[str] + description_dataset=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['conversionId'] = self._serialize.query("conversion_id", conversion_id, 'str') + if dataset_id is not None: + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description_dataset is not None: + query_parameters['description'] = self._serialize.query("description_dataset", description_dataset, '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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/datasets'} # type: ignore + + def begin_create( + self, + conversion_id, # type: str + dataset_id=None, # type: Optional[str] + description_dataset=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create a dataset from data that was uploaded to the Azure Maps + Data Service and converted using the Azure Maps Conversion Service. + + You can use this API in a scenario like uploading a DWG zip package for a building, converting + the zip package using the Azure Maps Conversion Service, and creating a dataset from the + converted zip package. The created dataset can be used to create tilesets using the Azure Maps + Tileset Service and can be queried via the Azure Maps WFS Service. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your dataset, you will use a ``POST`` request where the ``conversionId`` query + parameter is an ID that represents the converted DWG zip package, the ``datasetId`` parameter + will be the ID of a previously created dataset to append with the current dataset and, + optionally, the ``description`` query parameter will contain a description (if description is + not provided a default description will be given). + + The Create API is a `long-running request `_. + + :param conversion_id: The unique ID used to create the dataset. The ``conversionId`` must have + been obtained from a successful call to the Conversion Service Convert API and may be provided + with multiple query parameters with same name (if more than one is provided). + :type conversion_id: str + :param dataset_id: The ID for the dataset to append with. The dataset must originate from a + previous dataset creation call that matches the datasetId. + :type dataset_id: str + :param description_dataset: The description to be given to the dataset. + :type description_dataset: 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 LROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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_initial( + conversion_id=conversion_id, + dataset_id=dataset_id, + description_dataset=description_dataset, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.metadata = {'url': '/datasets'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatasetListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created datasets. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your datasets, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all datasets in ``json`` format. The response + contains the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of 3 dataset resources: + + .. code-block:: json + + { + "datasets": [ + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }, + { + "timestamp": "2020-01-01T22:57:53.123Z", + "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + "datasetSources": { + "conversionIds": [ + "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + ], + "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatasetListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.DatasetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatasetListResponse', pipeline_response) + list_of_elem = deserialized.datasets + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/datasets'} # type: ignore + + def get( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DatasetDetailInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a previously successfully created dataset. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details for a previously created dataset, you will issue a ``GET`` request with the + ``datasetId`` in the path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the details for a dataset in ``json`` format. The response contains + the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of a dataset resource: + + .. code-block:: json + + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.DatasetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DatasetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + def delete( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + You can also use this API to delete old/unused datasets to create space for new Creator + content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``datasetId`` of the dataset to delete. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + def get_operation( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This API allows the caller to view the current progress of a dataset operation and the path is + obtained from a call to the Create API. + + Submit Operations Request + ^^^^^^^^^^^^^^^^^^^^^^^^^ + + To view the current progress of a dataset operation, you will use a ``GET`` request where the + ``operationId`` given the path is the ID that represents the operation. + + Operation Response + ^^^^^^^^^^^^^^^^^^ + + While in progress, a ``200-OK`` http status code will be returned with no extra headers. If the + operation succeeds, a ``200-OK`` http status code with Resource-Location header will be + returned. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/datasets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py new file mode 100644 index 000000000000..81e74510163d --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py @@ -0,0 +1,632 @@ +# 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 .. 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 FeatureStateOperations(object): + """FeatureStateOperations 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.maps.creator.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 create_stateset( + self, + dataset_id, # type: str + stateset_create_request_body, # type: "_models.StylesObject" + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.StatesetCreatedResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This POST API allows the user to create a new Stateset and define stateset style using request + body. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. The Feature State API is part of Creator. + + The Feature State service allows the user to update the states of a feature and query them to + be used in other services. The dynamic properties of a feature that don't belong to the dataset + are referred to as *states* here. + + This Feature State service pivot on the Stateset. Like Tileset, Stateset encapsulates the + storage mechanism for feature states for a dataset. + + Once the stateset is created, users can use that statesetId to post feature state updates and + retrieve the current feature states. A feature can have only one state at a given point in + time. + + Feature state is defined by the key name, value and the timestamp. When a feature state update + is posted to Azure Maps, the state value gets updated only if the provided state’s timestamp is + later than the stored timestamp. + + Azure Maps MapControl provides a way to use these feature states to style the features. Please + refer to the State Tile documentation for more information. + + :param dataset_id: The datasetId must have been obtained from a successful `Dataset Create API + `_ call. + :type dataset_id: str + :param stateset_create_request_body: The stateset style JSON data. + :type stateset_create_request_body: ~azure.maps.creator.models.StylesObject + :param description: Description for the stateset. Max length allowed is 1000. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetCreatedResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetCreatedResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetCreatedResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, '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(stateset_create_request_body, 'StylesObject') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetCreatedResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def list_stateset( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StatesetListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created statesets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StatesetListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.StatesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + 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_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('StatesetListResponse', pipeline_response) + list_of_elem = deserialized.statesets + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def put_stateset( + self, + stateset_id, # type: str + stateset_style_update_request_body, # type: "_models.StylesObject" + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the stateset style rules. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param stateset_style_update_request_body: The stateset style JSON data. Only style rules are + allowed to be updated, update on keyname and type is not allowed. + :type stateset_style_update_request_body: ~azure.maps.creator.models.StylesObject + :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 = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_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(stateset_style_update_request_body, 'StylesObject') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + put_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def delete_stateset( + self, + stateset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This DELETE API allows the user to delete the stateset and the associated data. + + :param stateset_id: The stateset id that was created. + :type stateset_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def get_stateset( + self, + stateset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.StatesetGetResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This GET API allows the user to get the stateset Information. + + The stateset Information includes the datasetId associated to the stateset, and the styles of + that stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetGetResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetGetResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetGetResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetGetResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def update_states( + self, + stateset_id, # type: str + feature_id, # type: str + feature_state_update_request_body, # type: "_models.FeatureStatesStructure" + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the state of the given feature in the given stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given dataset. If the featureId is not present in + the dataset, Bad Request response will be returned. + :type feature_id: str + :param feature_state_update_request_body: The feature state JSON data. A feature can have only + one state at a given point in time. The specified state keyname must have been defined during + the stateset creation. + :type feature_state_update_request_body: ~azure.maps.creator.models.FeatureStatesStructure + :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 = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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(feature_state_update_request_body, 'FeatureStatesStructure') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + update_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + def delete_state( + self, + stateset_id, # type: str + feature_id, # type: str + state_key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API deletes the state information identified by the StateKeyName parameter for the + feature identified by the FeatureId parameter in the the stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :param state_key_name: The Name of the state to be deleted. + :type state_key_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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_state.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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') + query_parameters['stateKeyName'] = self._serialize.query("state_key_name", state_key_name, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_state.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + def get_states( + self, + stateset_id, # type: str + feature_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.FeatureStatesStructure" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API returns the current state information associated with the given feature in the given + stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureStatesStructure, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureStatesStructure + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureStatesStructure"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureStatesStructure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py new file mode 100644 index 000000000000..afd332d5b304 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py @@ -0,0 +1,957 @@ +# 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 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 .. 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 SpatialOperations(object): + """SpatialOperations 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.maps.creator.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_geofence( + self, + format, # type: Union[str, "_models.ResponseFormat"] + device_id, # type: str + udid, # type: str + latitude, # type: float + longitude, # type: float + z=None, # type: Optional[float] + user_time=None, # type: Optional[datetime.datetime] + search_buffer=None, # type: Optional[float] + is_async=None, # type: Optional[bool] + mode=None, # type: Optional[Union[str, "_models.GeofenceMode"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GeofenceResponse" + """**Search Geofence Get API** + + **Applies to:** S1 Pricing tier. + + The Geofence Get API allows you to retrieve the proximity of a coordinate to a + geofence that has been uploaded to the Data service. You can use the + `Data Upload API `_ to + upload + a geofence or set of fences. See `Geofencing GeoJSON data + `_ + for more details on the geofence data format. To query the proximity of a coordinate, you + supply the location of the object you are tracking as well + as the ID for the fence or set of fences, and the response will contain information about + the distance from the outer edge of the geofence. A negative value signifies that the + coordinate is inside of the fence while a positive value means that it is outside of the + fence.:code:`
`:code:`
`This API can be used for a variety of scenarios that include + things like asset + tracking, fleet management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + To test this API, you can upload the sample data from Post Geofence API examples(Request Body) + via Data Upload API and replace the [udid] from the sample request below with the udid returned + by Data Upload API. + + Geofencing InnerError code + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + In geofencing response error contract, ``innererror`` is an object containing service specific + information about the error. ``code`` is a property in ``innererror`` which can map to a + specific geofencing error type. The table belows shows the code mapping between all the known + client error type to the corresponding geofencing error ``message``. + + .. list-table:: + :header-rows: 1 + + * - innererror.code + - error.message + * - NullDeviceId + - Device Id should not be null. + * - NullUdid + - Udid should not be null. + * - UdidWrongFormat + - Udid should be acquired from user data ingestion API. + * - InvalidUserTime + - Usertime is invalid. + * - InvalidSearchBuffer + - Searchbuffer is invalid. + * - InvalidSearchRange + - The value range of searchbuffer should be from 0 to 500 meters. + * - InvalidLatLon + - Lat and/or lon parameters are invalid. + * - InvalidIsAsyncValue + - The IsAsync parameter is invalid. + * - InvalidModeValue + - The mode parameter invalid. + * - InvalidJson + - Geofencing data is not a valid json file. + * - NotSupportedGeoJson + - Geofencing data can't be read as a Feature or FeatureCollections. + * - InvalidGeoJson + - Geofencing data is invalid. + * - NoUserDataWithAccountOrSubscription + - Can't find user geofencing data with provided account-id and/or subscription-id. + * - NoUserDataWithUdid + - Can't find user geofencing data with provided udid. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion is used. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.Now. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + def post_geofence( + self, + format, # type: Union[str, "_models.ResponseFormat"] + device_id, # type: str + latitude, # type: float + longitude, # type: float + search_geofence_request_body, # type: "_models.GeoJsonFeatureCollection" + z=None, # type: Optional[float] + user_time=None, # type: Optional[datetime.datetime] + search_buffer=None, # type: Optional[float] + is_async=None, # type: Optional[bool] + mode=None, # type: Optional[Union[str, "_models.GeofenceMode"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GeofenceResponse" + """**Search Geofence Post API** + **Applies to:** S1 Pricing tier. + The Geofence Post API allows you to retrieve the proximity of a coordinate to a provided + geofence or set of fences. With POST call, you do not have to upload the fence data in advance, + instead you supply the location of the object you are tracking in query parameters as well as + the fence or set of fences data in post request body. See `Geofencing GeoJSON data + `_ for more details on the + geofence data format. The response will contain information about the distance from the outer + edge of the geofence. A negative value signifies that the coordinate is inside of the fence + while a positive value means that it is outside of the fence.:code:`
`:code:`
`This API + can be used for a variety of scenarios that include things like asset tracking, fleet + management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param search_geofence_request_body: The geofencing GeoJSON data. + :type search_geofence_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion geofencing is applied. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.UtcNow. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(search_geofence_request_body, 'GeoJsonFeatureCollection') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + post_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + def post_buffer( + self, + format, # type: Union[str, "_models.ResponseFormat"] + buffer_request_body, # type: "_models.BufferRequestBody" + **kwargs # type: Any + ): + # type: (...) -> "_models.BufferResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input may contain a collection of Point, MultiPoint, Polygon, + MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if provided. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param buffer_request_body: The FeatureCollection and the list of distances (one per feature or + one for all features). + :type buffer_request_body: ~azure.maps.creator.models.BufferRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(buffer_request_body, 'BufferRequestBody') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + def get_buffer( + self, + format, # type: Union[str, "_models.ResponseFormat"] + udid, # type: str + distances, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BufferResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input features are provided by a GeoJSON file which is uploaded + via `Data Upload API `_ and + referenced by a unique udid. The GeoJSON file may contain a collection of Point, MultiPoint, + Polygon, MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if + provided. + + To test this API, you can upload the sample data from `Post Buffer API + `_ examples(Request + Body without distances array) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the udid + returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param distances: The list of distances (one per feature or one for all features), delimited by + semicolons. For example, 12.34;-56.78. Positive distance will generate a buffer outside of the + feature, whereas negative distance will generate a buffer inside of the feature. If the + negative distance larger than the geometry itself, an empty polygon will be returned. + :type distances: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['distances'] = self._serialize.query("distances", distances, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + def post_closest_point( + self, + format, # type: Union[str, "_models.ResponseFormat"] + latitude, # type: float + longitude, # type: float + closest_point_request_body, # type: "_models.GeoJsonFeatureCollection" + number_of_closest_points=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.ClosestPointResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of target points. The + set of target points is provided by user data in post request body. The user data may only + contain a collection of Point geometry. MultiPoint or other geometries will be ignored if + provided. The algorithm does not take into account routing or traffic. The maximum number of + points accepted is 100,000. Information returned includes closest point latitude, longitude, + and distance in meters from the closest point. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param closest_point_request_body: The FeatureCollection of Point geometries from which closest + point to source point should be determined. All the feature's properties should contain + ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + :type closest_point_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(closest_point_request_body, 'GeoJsonFeatureCollection') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + def get_closest_point( + self, + format, # type: Union[str, "_models.ResponseFormat"] + udid, # type: str + latitude, # type: float + longitude, # type: float + number_of_closest_points=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.ClosestPointResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of points in the user + uploaded data set identified by udid. The set of target points is provided by a GeoJSON file + which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may only contain a collection of Point geometry. MultiPoint or + other geometries will be ignored if provided. The maximum number of points accepted is 100,000. + The algorithm does not take into account routing or traffic. Information returned includes + closest point latitude, longitude, and distance in meters from the closest point. + + To test this API, you can upload the sample data from `Post Closest Point API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + def post_point_in_polygon( + self, + format, # type: Union[str, "_models.ResponseFormat"] + latitude, # type: float + longitude, # type: float + point_in_polygon_request_body, # type: "_models.GeoJsonFeatureCollection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PointInPolygonResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + user data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if + provided. If the point is inside or on the boundary of one of these polygons, the value + returned is true. In all other cases, the value returned is false. When the point is inside + multiple polygons, the result will give intersecting geometries section to show all valid + geometries (referenced by geometryId) in user data. The maximum number of vertices accepted to + form a Polygon is 10,000. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param point_in_polygon_request_body: A FeatureCollection with a set of Polygon/MultiPolygon + geometries. The maximum number of vertices accepted to form a Polygon is 10,000. All the + feature's properties should contain ``geometryId``\ , which is used for identifying the + geometry and is case-sensitive. + :type point_in_polygon_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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(point_in_polygon_request_body, 'GeoJsonFeatureCollection') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + def get_point_in_polygon( + self, + format, # type: Union[str, "_models.ResponseFormat"] + udid, # type: str + latitude, # type: float + longitude, # type: float + **kwargs # type: Any + ): + # type: (...) -> "_models.PointInPolygonResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + set of polygons is provided by a GeoJSON file which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries + will be ignored if provided. If the point is inside or on the boundary of one of these + polygons, the value returned is true. In all other cases, the value returned is false. When the + point is inside multiple polygons, the result will give intersecting geometries section to show + all valid geometries(referenced by geometryId) in user data. The maximum number of vertices + accepted to form a Polygon is 10,000. + + To test this API, you can upload the sample data from `Post Point In Polygon API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + def get_great_circle_distance( + self, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GreatCircleDistanceResponse" + """**Applies to**\ : S1 pricing tier. + + This API will return the great-circle or shortest distance between two points on the surface of + a sphere, measured along the surface of the sphere. This differs from calculating a straight + line through the sphere's interior. This method is helpful for estimating travel distances for + airplanes by calculating the shortest distance between airports. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param query: The Coordinates through which the distance is calculated, delimited by a colon. + Two coordinates are required. The first one is the source point coordinate and the last is the + target point coordinate. For example, 47.622942,122.316456:57.673988,127.121513. + :type query: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GreatCircleDistanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GreatCircleDistanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GreatCircleDistanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_great_circle_distance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GreatCircleDistanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_great_circle_distance.metadata = {'url': '/spatial/greatCircleDistance/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py new file mode 100644 index 000000000000..48d47c345824 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py @@ -0,0 +1,511 @@ +# 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.core.polling.base_polling import LROBasePolling + +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 TilesetOperations(object): + """TilesetOperations 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.maps.creator.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 _create_initial( + self, + dataset_id, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/tilesets'} # type: ignore + + def begin_create( + self, + dataset_id, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. + + The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains + a set of tiles that can be consumed + from the `Get Map Tile `_ to retrieve custom tiles. To make a + dataset, use the + `DataSet Create API `_. + + Submit Create Request + --------------------- + + To create your tileset you will make a ``POST`` request with an empty body. The ``datasetId`` + query parameter will be + used as the source of the tileset data. + + The Create Tileset API is a + `long-running request `_. + + :param dataset_id: The unique ``datasetId`` that the tileset create API uses to retrieve + features to generate tiles. The ``datasetId`` must have been obtained from a successful + `Dataset Create API `_ call. + :type dataset_id: str + :param description: User provided description of the tileset. + :type description: 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 LROBasePolling. + 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 LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + 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_initial( + dataset_id=dataset_id, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, 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.metadata = {'url': '/tilesets'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TilesetListResponse"] + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all tilesets created.\ :raw-html-m2r:`
` + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TilesetListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.TilesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, '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] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TilesetListResponse', pipeline_response) + list_of_elem = deserialized.tilesets + 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.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/tilesets'} # type: ignore + + def get( + self, + tileset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TilesetDetailInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a tileset. + + :param tileset_id: The Tileset Id. + :type tileset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TilesetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.TilesetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TilesetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + def delete( + self, + tileset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a created tileset.:code:`
`\ :raw-html-m2r:`
` + You can use this API if a tileset is no longer needed. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``tilesetId`` of the tileset to delete.:code:`
` + + Delete request "Successful" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The Tileset Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + tileset was deleted successfully.:code:`
` + + Delete request "Failed" + ~~~~~~~~~~~~~~~~~~~~~~~ + + A HTTP ``400 Bad Request`` error response will be returned if the tileset with the passed-in + ``tilesetId`` is not found. + + Here is a sample error response: + + :code:`
` + + .. code-block:: json + + { + "error": { + "code": "400 BadRequest", + "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce does not + exist." + } + }. + + :param tileset_id: The Tileset Id. + :type tileset_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, '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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + def get_operation( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This path will be obtained from a call to /tilesets/create. While in progress, an http200 will + be returned with no extra headers - followed by an http200 with Resource-Location header once + successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/tilesets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py new file mode 100644 index 000000000000..f467b93d3446 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py @@ -0,0 +1,684 @@ +# 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 .. 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 WFSOperations(object): + """WFSOperations 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.maps.creator.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_landing_page( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LandingPageResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Landing Page API provides links to the API definition, the Conformance statements and + the metadata about the feature data in this dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LandingPageResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LandingPageResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LandingPageResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_landing_page.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LandingPageResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_landing_page.metadata = {'url': '/wfs/datasets/{datasetId}/'} # type: ignore + + def get_conformance( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConformanceResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Requirements Classes lists all requirements classes specified in the standard that the + server conforms to. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConformanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConformanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConformanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_conformance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConformanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_conformance.metadata = {'url': '/wfs/datasets/{datasetId}/conformance'} # type: ignore + + def get_collections( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CollectionsResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Collections Description API provides descriptions of all the collections in a given + dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collections.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collections.metadata = {'url': '/wfs/datasets/{datasetId}/collections'} # type: ignore + + def get_collection( + self, + dataset_id, # type: str + collection_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CollectionInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Description API provides the description of a given collection. It includes the + links to the operations that can be performed on the collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}'} # type: ignore + + def get_collection_definition( + self, + dataset_id, # type: str + collection_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CollectionDefinitionResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. WFS API follows the `Open + Geospatial Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Definition API provides the detailed data model of a given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionDefinitionResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionDefinitionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionDefinitionResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection_definition.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_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] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionDefinitionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection_definition.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/definition'} # type: ignore + + def get_features( + self, + dataset_id, # type: str + collection_id, # type: str + limit=None, # type: Optional[int] + bbox=None, # type: Optional[str] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.ExtendedGeoJsonFeatureCollection" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Features API returns the list of features in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param limit: The optional limit parameter limits the number of features that are presented in + the response document. + Only features that are on the first level of the collection in the response document are + counted. Nested objects contained within the explicitly requested features shall not be + counted. + + + * Minimum = 1 * Maximum = 500 * Default = 10. + :type limit: int + :param bbox: Only features that have a geometry that intersects the supplied bounding box are + selected. + + + * Lower left corner, coordinate axis 1 * Lower left corner, coordinate axis 2 * Upper right + corner, coordinate axis 1 * Upper right corner, coordinate axis 2 + The coordinate reference system of the values is WGS84 longitude/latitude + (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system + is specified in the parameter ``bbox-crs``. + For WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, + minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans + the antimeridian the first value (west-most box edge) is larger than the third value (east-most + box edge). + :type bbox: str + :param filter: Filter expression to search for features with specific property values in a + given collection. Only feature properties of scalar type and equals operator are supported. + This is a special parameter where the parameter name is a case sensitive property name. The + scheme for this parameter is {property name}={property value}. Unless "filter" is one of the + property names in the collection, "filter" should not be used as a parameter name. To search + for features with "name" property value "21N13", use "name=21N13". + Multiple filters are supported and should be represented as multiple query parameters. E.g., + :code:``=:code:``&:code:``=:code:`` String values are + case sensitive. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedGeoJsonFeatureCollection, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ExtendedGeoJsonFeatureCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedGeoJsonFeatureCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_features.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_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') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=500, minimum=1) + if bbox is not None: + query_parameters['bbox'] = self._serialize.query("bbox", bbox, 'str') + if filter is not None: + query_parameters['filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ExtendedGeoJsonFeatureCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_features.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items'} # type: ignore + + def get_feature( + self, + dataset_id, # type: str + collection_id, # type: str + feature_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.FeatureResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Feature API returns the feature identified by the provided id in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore + + def delete_feature( + self, + dataset_id, # type: str + collection_id, # type: str + feature_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Delete Feature API deletes the feature identified by the provided id in the given + collection. At this point this API supports only facility features. Deleting a facility feature + deletes all the child features of that facility recursively. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: 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 = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_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.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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/py.typed b/sdk/maps/azure-maps-creator/azure/maps/creator/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-creator/sdk_packaging.toml b/sdk/maps/azure-maps-creator/sdk_packaging.toml new file mode 100644 index 000000000000..7bbde0642f6c --- /dev/null +++ b/sdk/maps/azure-maps-creator/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-creator" +package_nspkg = "azure-maps-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/maps/azure-maps-creator/setup.cfg b/sdk/maps/azure-maps-creator/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-creator/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-creator/setup.py b/sdk/maps/azure-maps-creator/setup.py new file mode 100644 index 000000000000..9183eab24758 --- /dev/null +++ b/sdk/maps/azure-maps-creator/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-creator" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +)