From 888471bf5e4dc87bad464db7fd285ee12b6a6c71 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 12 Nov 2021 20:26:49 +0000 Subject: [PATCH] CodeGen from PR 16626 in Azure/azure-rest-api-specs [Hub Generated] Review request for Common to add version preview/1.0 (#16626) * corrects security definitions and adds SAS * pr feedback --- sdk/maps/azure-maps-creator/CHANGELOG.md | 5 + sdk/maps/azure-maps-creator/LICENSE.txt | 21 + 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 | 514 ++ .../aio/operations/_conversion_operations.py | 573 ++ .../aio/operations/_data_operations.py | 834 +++ .../aio/operations/_dataset_operations.py | 638 ++ .../operations/_feature_state_operations.py | 638 ++ .../aio/operations/_spatial_operations.py | 962 +++ .../aio/operations/_tileset_operations.py | 501 ++ .../creator/aio/operations/_wfs_operations.py | 672 +++ .../azure/maps/creator/models/__init__.py | 263 + .../creator/models/_creator_client_enums.py | 150 + .../azure/maps/creator/models/_models.py | 2576 ++++++++ .../azure/maps/creator/models/_models_py3.py | 2736 +++++++++ .../azure/maps/creator/operations/__init__.py | 27 + .../creator/operations/_alias_operations.py | 523 ++ .../operations/_conversion_operations.py | 583 ++ .../creator/operations/_data_operations.py | 846 +++ .../creator/operations/_dataset_operations.py | 648 ++ .../operations/_feature_state_operations.py | 650 ++ .../creator/operations/_spatial_operations.py | 975 +++ .../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 | 90 + sdk/maps/azure-maps-elevation/CHANGELOG.md | 5 + sdk/maps/azure-maps-elevation/LICENSE.txt | 21 + sdk/maps/azure-maps-elevation/MANIFEST.in | 6 + sdk/maps/azure-maps-elevation/README.md | 27 + sdk/maps/azure-maps-elevation/_meta.json | 11 + .../azure-maps-elevation/azure/__init__.py | 1 + .../azure/maps/__init__.py | 1 + .../azure/maps/elevation/__init__.py | 19 + .../azure/maps/elevation/_configuration.py | 68 + .../azure/maps/elevation/_elevation_client.py | 85 + .../azure/maps/elevation/_metadata.json | 103 + .../azure/maps/elevation/_version.py | 9 + .../azure/maps/elevation/aio/__init__.py | 10 + .../maps/elevation/aio/_configuration.py | 64 + .../maps/elevation/aio/_elevation_client.py | 78 + .../maps/elevation/aio/operations/__init__.py | 13 + .../aio/operations/_elevation_operations.py | 462 ++ .../azure/maps/elevation/models/__init__.py | 39 + .../models/_elevation_client_enums.py | 33 + .../azure/maps/elevation/models/_models.py | 205 + .../maps/elevation/models/_models_py3.py | 217 + .../maps/elevation/operations/__init__.py | 13 + .../operations/_elevation_operations.py | 471 ++ .../azure/maps/elevation/py.typed | 1 + .../azure-maps-elevation/sdk_packaging.toml | 9 + sdk/maps/azure-maps-elevation/setup.cfg | 2 + sdk/maps/azure-maps-elevation/setup.py | 90 + sdk/maps/azure-maps-geolocation/CHANGELOG.md | 5 + sdk/maps/azure-maps-geolocation/LICENSE.txt | 21 + sdk/maps/azure-maps-geolocation/MANIFEST.in | 6 + sdk/maps/azure-maps-geolocation/README.md | 27 + sdk/maps/azure-maps-geolocation/_meta.json | 11 + .../azure-maps-geolocation/azure/__init__.py | 1 + .../azure/maps/__init__.py | 1 + .../azure/maps/geolocation/__init__.py | 19 + .../azure/maps/geolocation/_configuration.py | 68 + .../maps/geolocation/_geolocation_client.py | 85 + .../azure/maps/geolocation/_metadata.json | 103 + .../azure/maps/geolocation/_version.py | 9 + .../azure/maps/geolocation/aio/__init__.py | 10 + .../maps/geolocation/aio/_configuration.py | 64 + .../geolocation/aio/_geolocation_client.py | 78 + .../geolocation/aio/operations/__init__.py | 13 + .../aio/operations/_geolocation_operations.py | 104 + .../azure/maps/geolocation/models/__init__.py | 33 + .../models/_geolocation_client_enums.py | 33 + .../azure/maps/geolocation/models/_models.py | 161 + .../maps/geolocation/models/_models_py3.py | 165 + .../maps/geolocation/operations/__init__.py | 13 + .../operations/_geolocation_operations.py | 109 + .../azure/maps/geolocation/py.typed | 1 + .../azure-maps-geolocation/sdk_packaging.toml | 9 + sdk/maps/azure-maps-geolocation/setup.cfg | 2 + sdk/maps/azure-maps-geolocation/setup.py | 90 + sdk/maps/azure-maps-render/CHANGELOG.md | 5 + sdk/maps/azure-maps-render/LICENSE.txt | 21 + sdk/maps/azure-maps-render/MANIFEST.in | 6 + sdk/maps/azure-maps-render/README.md | 27 + sdk/maps/azure-maps-render/_meta.json | 11 + sdk/maps/azure-maps-render/azure/__init__.py | 1 + .../azure-maps-render/azure/maps/__init__.py | 1 + .../azure/maps/render/__init__.py | 19 + .../azure/maps/render/_configuration.py | 68 + .../azure/maps/render/_metadata.json | 103 + .../azure/maps/render/_render_client.py | 85 + .../azure/maps/render/_version.py | 9 + .../azure/maps/render/aio/__init__.py | 10 + .../azure/maps/render/aio/_configuration.py | 64 + .../azure/maps/render/aio/_render_client.py | 78 + .../maps/render/aio/operations/__init__.py | 13 + .../aio/operations/_render_v2_operations.py | 1247 ++++ .../azure/maps/render/models/__init__.py | 65 + .../azure/maps/render/models/_models.py | 426 ++ .../azure/maps/render/models/_models_py3.py | 455 ++ .../render/models/_render_client_enums.py | 225 + .../azure/maps/render/operations/__init__.py | 13 + .../operations/_render_v2_operations.py | 1260 ++++ .../azure/maps/render/py.typed | 1 + sdk/maps/azure-maps-render/sdk_packaging.toml | 9 + sdk/maps/azure-maps-render/setup.cfg | 2 + sdk/maps/azure-maps-render/setup.py | 90 + sdk/maps/azure-maps-route/CHANGELOG.md | 5 + sdk/maps/azure-maps-route/LICENSE.txt | 21 + sdk/maps/azure-maps-route/MANIFEST.in | 6 + sdk/maps/azure-maps-route/README.md | 27 + sdk/maps/azure-maps-route/_meta.json | 11 + sdk/maps/azure-maps-route/azure/__init__.py | 1 + .../azure-maps-route/azure/maps/__init__.py | 1 + .../azure/maps/route/__init__.py | 19 + .../azure/maps/route/_configuration.py | 68 + .../azure/maps/route/_metadata.json | 103 + .../azure/maps/route/_route_client.py | 86 + .../azure/maps/route/_version.py | 9 + .../azure/maps/route/aio/__init__.py | 10 + .../azure/maps/route/aio/_configuration.py | 64 + .../azure/maps/route/aio/_route_client.py | 79 + .../maps/route/aio/operations/__init__.py | 13 + .../route/aio/operations/_route_operations.py | 3225 ++++++++++ .../azure/maps/route/models/__init__.py | 226 + .../azure/maps/route/models/_models.py | 2015 +++++++ .../azure/maps/route/models/_models_py3.py | 2095 +++++++ .../maps/route/models/_route_client_enums.py | 445 ++ .../azure/maps/route/operations/__init__.py | 13 + .../route/operations/_route_operations.py | 3242 ++++++++++ .../azure/maps/route/py.typed | 1 + sdk/maps/azure-maps-route/sdk_packaging.toml | 9 + sdk/maps/azure-maps-route/setup.cfg | 2 + sdk/maps/azure-maps-route/setup.py | 90 + sdk/maps/azure-maps-search/CHANGELOG.md | 5 + sdk/maps/azure-maps-search/LICENSE.txt | 21 + sdk/maps/azure-maps-search/MANIFEST.in | 6 + sdk/maps/azure-maps-search/README.md | 27 + sdk/maps/azure-maps-search/_meta.json | 11 + sdk/maps/azure-maps-search/azure/__init__.py | 1 + .../azure-maps-search/azure/maps/__init__.py | 1 + .../azure/maps/search/__init__.py | 19 + .../azure/maps/search/_configuration.py | 68 + .../azure/maps/search/_metadata.json | 103 + .../azure/maps/search/_search_client.py | 86 + .../azure/maps/search/_version.py | 9 + .../azure/maps/search/aio/__init__.py | 10 + .../azure/maps/search/aio/_configuration.py | 64 + .../azure/maps/search/aio/_search_client.py | 79 + .../maps/search/aio/operations/__init__.py | 13 + .../aio/operations/_search_operations.py | 5256 ++++++++++++++++ .../azure/maps/search/models/__init__.py | 233 + .../azure/maps/search/models/_models.py | 2154 +++++++ .../azure/maps/search/models/_models_py3.py | 2242 +++++++ .../search/models/_search_client_enums.py | 242 + .../azure/maps/search/operations/__init__.py | 13 + .../search/operations/_search_operations.py | 5287 +++++++++++++++++ .../azure/maps/search/py.typed | 1 + sdk/maps/azure-maps-search/sdk_packaging.toml | 9 + sdk/maps/azure-maps-search/setup.cfg | 2 + sdk/maps/azure-maps-search/setup.py | 90 + sdk/maps/azure-maps-timezone/CHANGELOG.md | 5 + sdk/maps/azure-maps-timezone/LICENSE.txt | 21 + sdk/maps/azure-maps-timezone/MANIFEST.in | 6 + sdk/maps/azure-maps-timezone/README.md | 27 + sdk/maps/azure-maps-timezone/_meta.json | 11 + .../azure-maps-timezone/azure/__init__.py | 1 + .../azure/maps/__init__.py | 1 + .../azure/maps/timezone/__init__.py | 19 + .../azure/maps/timezone/_configuration.py | 68 + .../azure/maps/timezone/_metadata.json | 103 + .../azure/maps/timezone/_timezone_client.py | 85 + .../azure/maps/timezone/_version.py | 9 + .../azure/maps/timezone/aio/__init__.py | 10 + .../azure/maps/timezone/aio/_configuration.py | 64 + .../maps/timezone/aio/_timezone_client.py | 78 + .../maps/timezone/aio/operations/__init__.py | 13 + .../aio/operations/_timezone_operations.py | 495 ++ .../azure/maps/timezone/models/__init__.py | 59 + .../azure/maps/timezone/models/_models.py | 507 ++ .../azure/maps/timezone/models/_models_py3.py | 515 ++ .../timezone/models/_timezone_client_enums.py | 45 + .../maps/timezone/operations/__init__.py | 13 + .../operations/_timezone_operations.py | 505 ++ .../azure/maps/timezone/py.typed | 1 + .../azure-maps-timezone/sdk_packaging.toml | 9 + sdk/maps/azure-maps-timezone/setup.cfg | 2 + sdk/maps/azure-maps-timezone/setup.py | 90 + sdk/maps/azure-maps-traffic/CHANGELOG.md | 5 + sdk/maps/azure-maps-traffic/LICENSE.txt | 21 + sdk/maps/azure-maps-traffic/MANIFEST.in | 6 + sdk/maps/azure-maps-traffic/README.md | 27 + sdk/maps/azure-maps-traffic/_meta.json | 11 + sdk/maps/azure-maps-traffic/azure/__init__.py | 1 + .../azure-maps-traffic/azure/maps/__init__.py | 1 + .../azure/maps/traffic/__init__.py | 19 + .../azure/maps/traffic/_configuration.py | 68 + .../azure/maps/traffic/_metadata.json | 103 + .../azure/maps/traffic/_traffic_client.py | 85 + .../azure/maps/traffic/_version.py | 9 + .../azure/maps/traffic/aio/__init__.py | 10 + .../azure/maps/traffic/aio/_configuration.py | 64 + .../azure/maps/traffic/aio/_traffic_client.py | 78 + .../maps/traffic/aio/operations/__init__.py | 13 + .../aio/operations/_traffic_operations.py | 574 ++ .../azure/maps/traffic/models/__init__.py | 83 + .../azure/maps/traffic/models/_models.py | 598 ++ .../azure/maps/traffic/models/_models_py3.py | 610 ++ .../traffic/models/_traffic_client_enums.py | 161 + .../azure/maps/traffic/operations/__init__.py | 13 + .../traffic/operations/_traffic_operations.py | 583 ++ .../azure/maps/traffic/py.typed | 1 + .../azure-maps-traffic/sdk_packaging.toml | 9 + sdk/maps/azure-maps-traffic/setup.cfg | 2 + sdk/maps/azure-maps-traffic/setup.py | 90 + sdk/maps/azure-maps-weather/CHANGELOG.md | 5 + sdk/maps/azure-maps-weather/LICENSE.txt | 21 + sdk/maps/azure-maps-weather/MANIFEST.in | 6 + sdk/maps/azure-maps-weather/README.md | 27 + sdk/maps/azure-maps-weather/_meta.json | 11 + sdk/maps/azure-maps-weather/azure/__init__.py | 1 + .../azure-maps-weather/azure/maps/__init__.py | 1 + .../azure/maps/weather/__init__.py | 19 + .../azure/maps/weather/_configuration.py | 68 + .../azure/maps/weather/_metadata.json | 103 + .../azure/maps/weather/_version.py | 9 + .../azure/maps/weather/_weather_client.py | 85 + .../azure/maps/weather/aio/__init__.py | 10 + .../azure/maps/weather/aio/_configuration.py | 64 + .../azure/maps/weather/aio/_weather_client.py | 78 + .../maps/weather/aio/operations/__init__.py | 13 + .../aio/operations/_weather_operations.py | 854 +++ .../azure/maps/weather/models/__init__.py | 167 + .../azure/maps/weather/models/_models.py | 1969 ++++++ .../azure/maps/weather/models/_models_py3.py | 2242 +++++++ .../weather/models/_weather_client_enums.py | 253 + .../azure/maps/weather/operations/__init__.py | 13 + .../weather/operations/_weather_operations.py | 866 +++ .../azure/maps/weather/py.typed | 1 + .../azure-maps-weather/sdk_packaging.toml | 9 + sdk/maps/azure-maps-weather/setup.cfg | 2 + sdk/maps/azure-maps-weather/setup.py | 90 + 257 files changed, 65786 insertions(+) create mode 100644 sdk/maps/azure-maps-creator/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-creator/LICENSE.txt 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 create mode 100644 sdk/maps/azure-maps-elevation/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-elevation/LICENSE.txt create mode 100644 sdk/maps/azure-maps-elevation/MANIFEST.in create mode 100644 sdk/maps/azure-maps-elevation/README.md create mode 100644 sdk/maps/azure-maps-elevation/_meta.json create mode 100644 sdk/maps/azure-maps-elevation/azure/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/_configuration.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/_elevation_client.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/_metadata.json create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/_version.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_elevation_client.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/_elevation_operations.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/models/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_elevation_client_enums.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/__init__.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/_elevation_operations.py create mode 100644 sdk/maps/azure-maps-elevation/azure/maps/elevation/py.typed create mode 100644 sdk/maps/azure-maps-elevation/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-elevation/setup.cfg create mode 100644 sdk/maps/azure-maps-elevation/setup.py create mode 100644 sdk/maps/azure-maps-geolocation/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-geolocation/LICENSE.txt create mode 100644 sdk/maps/azure-maps-geolocation/MANIFEST.in create mode 100644 sdk/maps/azure-maps-geolocation/README.md create mode 100644 sdk/maps/azure-maps-geolocation/_meta.json create mode 100644 sdk/maps/azure-maps-geolocation/azure/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_configuration.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_geolocation_client.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_metadata.json create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_version.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_geolocation_client.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/_geolocation_operations.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_geolocation_client_enums.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/__init__.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/_geolocation_operations.py create mode 100644 sdk/maps/azure-maps-geolocation/azure/maps/geolocation/py.typed create mode 100644 sdk/maps/azure-maps-geolocation/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-geolocation/setup.cfg create mode 100644 sdk/maps/azure-maps-geolocation/setup.py create mode 100644 sdk/maps/azure-maps-render/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-render/LICENSE.txt create mode 100644 sdk/maps/azure-maps-render/MANIFEST.in create mode 100644 sdk/maps/azure-maps-render/README.md create mode 100644 sdk/maps/azure-maps-render/_meta.json create mode 100644 sdk/maps/azure-maps-render/azure/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/_configuration.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/_metadata.json create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/_render_client.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/_version.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/aio/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/aio/_render_client.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_v2_operations.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/models/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/models/_models.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/models/_render_client_enums.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/operations/__init__.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/operations/_render_v2_operations.py create mode 100644 sdk/maps/azure-maps-render/azure/maps/render/py.typed create mode 100644 sdk/maps/azure-maps-render/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-render/setup.cfg create mode 100644 sdk/maps/azure-maps-render/setup.py create mode 100644 sdk/maps/azure-maps-route/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-route/LICENSE.txt create mode 100644 sdk/maps/azure-maps-route/MANIFEST.in create mode 100644 sdk/maps/azure-maps-route/README.md create mode 100644 sdk/maps/azure-maps-route/_meta.json create mode 100644 sdk/maps/azure-maps-route/azure/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/_configuration.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/_metadata.json create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/_route_client.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/_version.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/aio/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/aio/operations/_route_operations.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/models/_models.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/models/_route_client_enums.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/operations/__init__.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/operations/_route_operations.py create mode 100644 sdk/maps/azure-maps-route/azure/maps/route/py.typed create mode 100644 sdk/maps/azure-maps-route/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-route/setup.cfg create mode 100644 sdk/maps/azure-maps-route/setup.py create mode 100644 sdk/maps/azure-maps-search/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-search/LICENSE.txt create mode 100644 sdk/maps/azure-maps-search/MANIFEST.in create mode 100644 sdk/maps/azure-maps-search/README.md create mode 100644 sdk/maps/azure-maps-search/_meta.json create mode 100644 sdk/maps/azure-maps-search/azure/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/_configuration.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/_metadata.json create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/_search_client.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/_version.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/models/_models.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py create mode 100644 sdk/maps/azure-maps-search/azure/maps/search/py.typed create mode 100644 sdk/maps/azure-maps-search/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-search/setup.cfg create mode 100644 sdk/maps/azure-maps-search/setup.py create mode 100644 sdk/maps/azure-maps-timezone/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-timezone/LICENSE.txt create mode 100644 sdk/maps/azure-maps-timezone/MANIFEST.in create mode 100644 sdk/maps/azure-maps-timezone/README.md create mode 100644 sdk/maps/azure-maps-timezone/_meta.json create mode 100644 sdk/maps/azure-maps-timezone/azure/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/_configuration.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/_metadata.json create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/_timezone_client.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/_version.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_timezone_client.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/_timezone_operations.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/models/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_timezone_client_enums.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/__init__.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/_timezone_operations.py create mode 100644 sdk/maps/azure-maps-timezone/azure/maps/timezone/py.typed create mode 100644 sdk/maps/azure-maps-timezone/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-timezone/setup.cfg create mode 100644 sdk/maps/azure-maps-timezone/setup.py create mode 100644 sdk/maps/azure-maps-traffic/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-traffic/LICENSE.txt create mode 100644 sdk/maps/azure-maps-traffic/MANIFEST.in create mode 100644 sdk/maps/azure-maps-traffic/README.md create mode 100644 sdk/maps/azure-maps-traffic/_meta.json create mode 100644 sdk/maps/azure-maps-traffic/azure/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/_configuration.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/_metadata.json create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/_traffic_client.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/_version.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_traffic_client.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/_traffic_operations.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/models/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_traffic_client_enums.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/__init__.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/_traffic_operations.py create mode 100644 sdk/maps/azure-maps-traffic/azure/maps/traffic/py.typed create mode 100644 sdk/maps/azure-maps-traffic/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-traffic/setup.cfg create mode 100644 sdk/maps/azure-maps-traffic/setup.py create mode 100644 sdk/maps/azure-maps-weather/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-weather/LICENSE.txt create mode 100644 sdk/maps/azure-maps-weather/MANIFEST.in create mode 100644 sdk/maps/azure-maps-weather/README.md create mode 100644 sdk/maps/azure-maps-weather/_meta.json create mode 100644 sdk/maps/azure-maps-weather/azure/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/_configuration.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/_metadata.json create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/_version.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/_weather_client.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/aio/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/aio/_weather_client.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/_weather_operations.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/models/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/models/_models.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/models/_weather_client_enums.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/operations/__init__.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/operations/_weather_operations.py create mode 100644 sdk/maps/azure-maps-weather/azure/maps/weather/py.typed create mode 100644 sdk/maps/azure-maps-weather/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-weather/setup.cfg create mode 100644 sdk/maps/azure-maps-weather/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/LICENSE.txt b/sdk/maps/azure-maps-creator/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-creator/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-creator/MANIFEST.in b/sdk/maps/azure-maps-creator/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-creator/README.md b/sdk/maps/azure-maps-creator/README.md new file mode 100644 index 000000000000..81eb8e1a77ec --- /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.6+. +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..42281021905b --- /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": "5d66051664eaf014195185293278d3907699b5e1", + "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..5d87e3177eac --- /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 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 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" + 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.client_id = 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..d27dabec40b3 --- /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 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 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" + 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, 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..b08de84b3727 --- /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 + }, + "client_id": { + "signature": "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 + }, + "client_id": { + "signature": "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, 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..792477d3ae4a --- /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 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 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", + 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.client_id = 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..864c0e6a6ff3 --- /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 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 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", + 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, 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..941d0f8474fa --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py @@ -0,0 +1,514 @@ +# 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.Alias": + """**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: Alias, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Alias + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alias"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 [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('Alias', 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.AliasListResult"]: + """**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 AliasListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.AliasListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('AliasListResult', 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.Alias": + """**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: Alias, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Alias + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alias"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + 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('Alias', 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/aliases/{aliasId}'} # type: ignore + + async def get( + self, + alias_id: str, + **kwargs: Any + ) -> "_models.Alias": + """**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: Alias, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Alias + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alias"] + 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'), + '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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Alias', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.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..297a0066c15e --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py @@ -0,0 +1,573 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.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: Union[str, "_models.OutputOntology"] = "facility-2.0", + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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: Union[str, "_models.OutputOntology"] = "facility-2.0", + 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 or ~azure.maps.creator.models.OutputOntology + :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.ConversionListResult"]: + """**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 ConversionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.ConversionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ConversionListResult', 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.Conversion": + """**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: Conversion, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Conversion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Conversion"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Conversion', 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 Conversion 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..b995239c0280 --- /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_initial( + self, + data_format: Union[str, "_models.DataFormat"], + upload_content: Union[IO, Any], + 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_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 description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + query_parameters['dataFormat'] = self._serialize.query("data_format", data_format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_initial.metadata = {'url': '/mapData'} # type: ignore + + async def begin_upload( + self, + data_format: Union[str, "_models.DataFormat"], + upload_content: Union[IO, Any], + 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 data_format: Data format of the content being uploaded. + :type data_format: str or ~azure.maps.creator.models.DataFormat + :param upload_content: The content to upload. + :type upload_content: IO or any + :param description: The description to be given to the upload. + :type 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_initial( + data_format=data_format, + upload_content=upload_content, + 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_upload.metadata = {'url': '/mapData'} # type: ignore + + async def list( + self, + **kwargs: Any + ) -> "_models.MapDataListResult": + """**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: MapDataListResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.MapDataListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapDataListResult"] + 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.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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MapDataListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/mapData'} # type: ignore + + async def _update_initial( + self, + udid: str, + update_content: Any, + 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_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("udid", udid, '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 description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_initial.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def begin_update( + self, + udid: str, + update_content: Any, + 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 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 update_content: The new content that will update/replace the previously uploaded + content. + :type update_content: any + :param description: The description to be given to the upload. + :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._update_initial( + udid=udid, + update_content=update_content, + 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'), + 'udid': self._serialize.url("udid", udid, '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.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def download( + self, + udid: 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 udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: 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.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("udid", udid, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def delete( + self, + udid: 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 udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: 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'), + 'udid': self._serialize.url("udid", udid, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/mapData/{udid}'} # type: ignore + + async def get_operation( + 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.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': '/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..be0692ff1d5a --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py @@ -0,0 +1,638 @@ +# 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: 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 is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/datasets'} # type: ignore + + async def begin_create( + self, + conversion_id: str, + dataset_id: Optional[str] = None, + 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 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: The description to be given to the dataset. + :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( + conversion_id=conversion_id, + 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': '/datasets'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DatasetListResult"]: + """**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" + ], }, + "": "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 DatasetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.DatasetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('DatasetListResult', 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.Dataset": + """**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: Dataset, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Dataset', 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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['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..aedbb7e85e35 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py @@ -0,0 +1,638 @@ +# 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, + style_rules: "_models.StyleRules", + description: Optional[str] = None, + **kwargs: Any + ) -> "_models.StatesetCreatedResult": + """**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 style_rules: The stateset style JSON data. + :type style_rules: ~azure.maps.creator.models.StyleRules + :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: StatesetCreatedResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetCreatedResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetCreatedResult"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(style_rules, 'StyleRules') + 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('StatesetCreatedResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def list_statesets( + self, + **kwargs: Any + ) -> AsyncIterable["_models.StatesetListResult"]: + """**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 StatesetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.StatesetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_statesets.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('StatesetListResult', 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_statesets.metadata = {'url': '/featureStateSets'} # type: ignore + + async def update_stateset( + self, + stateset_id: str, + style_rules: "_models.StyleRules", + **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 style_rules: The stateset style JSON data. Only style rules are allowed to be updated, + update on keyname and type is not allowed. + :type style_rules: ~azure.maps.creator.models.StyleRules + :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_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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(style_rules, 'StyleRules') + 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_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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def get_stateset( + self, + stateset_id: str, + **kwargs: Any + ) -> "_models.Stateset": + """**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: Stateset, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Stateset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Stateset"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Stateset', 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_states: "_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_states: 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_states: ~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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(feature_states, '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, + 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 key_name: The Name of the state to be deleted. + :type 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("key_name", key_name, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_state.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + async def list_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.list_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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('FeatureStatesStructure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_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..da9a5f01fcd8 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py @@ -0,0 +1,962 @@ +# 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, + device_id: str, + udid: str, + position: "_models.Position", + format: Union[str, "_models.JsonFormat"] = "json", + altitude: Optional[float] = None, + user_time: Optional[datetime.datetime] = None, + search_buffer_in_meters: Optional[float] = None, + is_async: Optional[bool] = None, + mode: Optional[Union[str, "_models.GeofenceMode"]] = None, + **kwargs: Any + ) -> "_models.Geofence": + """**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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :param altitude: The sea level in meter of the location being passed. If this parameter is + presented, 2D extrusion is used. Example: 200. + :type altitude: 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_in_meters: 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_in_meters: 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: Geofence, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Geofence + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Geofence"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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 altitude is not None: + query_parameters['z'] = self._serialize.query("altitude", altitude, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer_in_meters is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer_in_meters", search_buffer_in_meters, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Geofence', 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, + device_id: str, + search_geofence_request_body: "_models.GeoJsonFeatureCollection", + position: "_models.Position", + format: Union[str, "_models.JsonFormat"] = "json", + altitude: 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.Geofence": + """**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 device_id: ID of the device. + :type device_id: str + :param search_geofence_request_body: The geofencing GeoJSON data. + :type search_geofence_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :param altitude: The sea level in meter of the location being passed. If this parameter is + presented, 2D extrusion geofencing is applied. Example: 200. + :type altitude: 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: Geofence, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Geofence + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Geofence"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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 altitude is not None: + query_parameters['z'] = self._serialize.query("altitude", altitude, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Geofence', 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, + buffer_request_body: "_models.BufferRequestBody", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.BufferResult": + """**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 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 + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('BufferResult', 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, + udid: str, + distances: str, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.BufferResult": + """**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 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 + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('BufferResult', 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, + closest_point_request_body: "_models.GeoJsonFeatureCollection", + position: "_models.Position", + format: Union[str, "_models.JsonFormat"] = "json", + 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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :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', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, + udid: str, + position: "_models.Position", + format: Union[str, "_models.JsonFormat"] = "json", + 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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :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', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, + point_in_polygon_request_body: "_models.GeoJsonFeatureCollection", + position: "_models.Position", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.PointInPolygonResult": + """**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 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 + :param position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PointInPolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + async def evaluate_point_in_polygon( + self, + udid: str, + position: "_models.Position", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.PointInPolygonResult": + """**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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.evaluate_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PointInPolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + evaluate_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + async def get_great_circle_distance( + self, + query: str, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.GreatCircleDistanceResult": + """**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 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 + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GreatCircleDistanceResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GreatCircleDistanceResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GreatCircleDistanceResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('GreatCircleDistanceResult', 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..f4f69679fa1e --- /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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.TilesetListResult"]: + """.. 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 TilesetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.TilesetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TilesetListResult', 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.Tileset": + """**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: Tileset, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Tileset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Tileset"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Tileset', 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 tileset 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..1a470c9159b1 --- /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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... 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.LandingPageResult": + """**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: LandingPageResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LandingPageResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LandingPageResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('LandingPageResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_landing_page.metadata = {'url': '/wfs/datasets/{datasetId}/'} # type: ignore + + async def list_conformance( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.ConformanceResult": + """**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: ConformanceResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConformanceResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConformanceResult"] + 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_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ConformanceResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.Collection": + """**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: Collection, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Collection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Collection"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Collection', 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.CollectionDefinition": + """**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: CollectionDefinition, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionDefinition"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('CollectionDefinition', 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, + bounding_box: Optional[List[float]] = 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 bounding_box: 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 bounding_box: list[float] + :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 bounding_box is not None: + query_parameters['bbox'] = self._serialize.query("bounding_box", bounding_box, '[float]', div=',') + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.FeatureResult": + """**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: FeatureResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] + 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('FeatureResult', 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..0608b2ff0a39 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py @@ -0,0 +1,263 @@ +# 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 Alias + from ._models_py3 import AliasListResult + from ._models_py3 import BooleanRule + from ._models_py3 import BooleanStyleRule + from ._models_py3 import BufferRequestBody + from ._models_py3 import BufferResult + from ._models_py3 import BufferSummary + from ._models_py3 import ClosestPoint + from ._models_py3 import ClosestPointResponse + from ._models_py3 import ClosestPointSummary + from ._models_py3 import Collection + from ._models_py3 import CollectionDefinition + from ._models_py3 import CollectionsResponse + from ._models_py3 import ConformanceResult + from ._models_py3 import Conversion + from ._models_py3 import ConversionListResult + from ._models_py3 import Dataset + from ._models_py3 import DatasetListResult + from ._models_py3 import DatasetSources + from ._models_py3 import DefinitionProperty + 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 FeatureResult + from ._models_py3 import FeatureState + 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 Geofence + from ._models_py3 import GeofenceGeometry + from ._models_py3 import GreatCircleDistanceResult + from ._models_py3 import GreatCircleDistanceResultResult + from ._models_py3 import GreatCircleDistanceSummary + from ._models_py3 import LandingPageResult + from ._models_py3 import LatLongPairAbbreviated + from ._models_py3 import LongRunningOperationResult + from ._models_py3 import MapData + from ._models_py3 import MapDataListResult + from ._models_py3 import NumberRule + from ._models_py3 import NumberStyleRule + from ._models_py3 import PointInPolygonResult + from ._models_py3 import PointInPolygonResultResult + from ._models_py3 import PointInPolygonSummary + from ._models_py3 import Position + from ._models_py3 import Range + from ._models_py3 import Stateset + from ._models_py3 import StatesetCreatedResult + from ._models_py3 import StatesetInfo + from ._models_py3 import StatesetListResult + from ._models_py3 import StringStyleRule + from ._models_py3 import StyleRule + from ._models_py3 import StyleRules + from ._models_py3 import Tileset + from ._models_py3 import TilesetListResult + from ._models_py3 import WFSEndpointLink +except (SyntaxError, ImportError): + from ._models import Alias # type: ignore + from ._models import AliasListResult # type: ignore + from ._models import BooleanRule # type: ignore + from ._models import BooleanStyleRule # type: ignore + from ._models import BufferRequestBody # type: ignore + from ._models import BufferResult # type: ignore + from ._models import BufferSummary # type: ignore + from ._models import ClosestPoint # type: ignore + from ._models import ClosestPointResponse # type: ignore + from ._models import ClosestPointSummary # type: ignore + from ._models import Collection # type: ignore + from ._models import CollectionDefinition # type: ignore + from ._models import CollectionsResponse # type: ignore + from ._models import ConformanceResult # type: ignore + from ._models import Conversion # type: ignore + from ._models import ConversionListResult # type: ignore + from ._models import Dataset # type: ignore + from ._models import DatasetListResult # type: ignore + from ._models import DatasetSources # type: ignore + from ._models import DefinitionProperty # 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 FeatureResult # type: ignore + from ._models import FeatureState # 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 Geofence # type: ignore + from ._models import GeofenceGeometry # type: ignore + from ._models import GreatCircleDistanceResult # type: ignore + from ._models import GreatCircleDistanceResultResult # type: ignore + from ._models import GreatCircleDistanceSummary # type: ignore + from ._models import LandingPageResult # type: ignore + from ._models import LatLongPairAbbreviated # type: ignore + from ._models import LongRunningOperationResult # type: ignore + from ._models import MapData # type: ignore + from ._models import MapDataListResult # type: ignore + from ._models import NumberRule # type: ignore + from ._models import NumberStyleRule # type: ignore + from ._models import PointInPolygonResult # type: ignore + from ._models import PointInPolygonResultResult # type: ignore + from ._models import PointInPolygonSummary # type: ignore + from ._models import Position # type: ignore + from ._models import Range # type: ignore + from ._models import Stateset # type: ignore + from ._models import StatesetCreatedResult # type: ignore + from ._models import StatesetInfo # type: ignore + from ._models import StatesetListResult # type: ignore + from ._models import StringStyleRule # type: ignore + from ._models import StyleRule # type: ignore + from ._models import StyleRules # type: ignore + from ._models import Tileset # type: ignore + from ._models import TilesetListResult # type: ignore + from ._models import WFSEndpointLink # type: ignore + +from ._creator_client_enums import ( + DataFormat, + GeoJsonGeometryType, + GeoJsonObjectType, + GeofenceMode, + GeographicResourceLocation, + Geography, + JsonFormat, + LroStatus, + OutputOntology, + StyleRuleType, + UploadStatus, +) + +__all__ = [ + 'Alias', + 'AliasListResult', + 'BooleanRule', + 'BooleanStyleRule', + 'BufferRequestBody', + 'BufferResult', + 'BufferSummary', + 'ClosestPoint', + 'ClosestPointResponse', + 'ClosestPointSummary', + 'Collection', + 'CollectionDefinition', + 'CollectionsResponse', + 'ConformanceResult', + 'Conversion', + 'ConversionListResult', + 'Dataset', + 'DatasetListResult', + 'DatasetSources', + 'DefinitionProperty', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExtendedGeoJsonFeatureCollection', + 'ExtendedGeoJsonFeatureCollectionData', + 'FeatureResult', + 'FeatureState', + 'FeatureStatesStructure', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'Geofence', + 'GeofenceGeometry', + 'GreatCircleDistanceResult', + 'GreatCircleDistanceResultResult', + 'GreatCircleDistanceSummary', + 'LandingPageResult', + 'LatLongPairAbbreviated', + 'LongRunningOperationResult', + 'MapData', + 'MapDataListResult', + 'NumberRule', + 'NumberStyleRule', + 'PointInPolygonResult', + 'PointInPolygonResultResult', + 'PointInPolygonSummary', + 'Position', + 'Range', + 'Stateset', + 'StatesetCreatedResult', + 'StatesetInfo', + 'StatesetListResult', + 'StringStyleRule', + 'StyleRule', + 'StyleRules', + 'Tileset', + 'TilesetListResult', + 'WFSEndpointLink', + 'DataFormat', + 'GeoJsonGeometryType', + 'GeoJsonObjectType', + 'GeofenceMode', + 'GeographicResourceLocation', + 'Geography', + 'JsonFormat', + 'LroStatus', + 'OutputOntology', + 'StyleRuleType', + 'UploadStatus', +] 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..a25ad5242e16 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py @@ -0,0 +1,150 @@ +# 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 DataFormat(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. + DWG_ZIP_PACKAGE = "dwgzippackage" + +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 JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +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 OutputOntology(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Facility ontology defines how Azure Maps Creator internally stores facility data in a Creator + #: dataset. + FACILITY2_0 = "facility-2.0" + +class StyleRuleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of stateset style. + """ + + #: Boolean type of stateset style. + BOOLEAN = "boolean" + #: Number type of stateset style. + NUMBER = "number" + #: String type of stateset style. + STRING = "string" + +class UploadStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current upload status of the content. + """ + + #: Upload is processing. + PENDING = "Pending" + #: Upload validation and processing completed. + COMPLETED = "Completed" + #: Upload validation and/or processing failure. + FAILED = "Failed" 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..f3501c87dedd --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py @@ -0,0 +1,2576 @@ +# 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 Alias(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: ~datetime.datetime + :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: ~datetime.datetime + """ + + _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': 'iso-8601'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListResult(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.Alias] + :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': '[Alias]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListResult, self).__init__(**kwargs) + self.aliases = None + self.next_link = None + + +class BooleanRule(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(BooleanRule, self).__init__(**kwargs) + self.true = kwargs.get('true', None) + self.false = kwargs.get('false', None) + + +class StyleRule(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 NumberRule, StringRuleObject and BooleanRule definitions `here `_. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BooleanStyleRule, NumberStyleRule, StringStyleRule. + + 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.StyleRuleType + """ + + _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': 'BooleanStyleRule', 'number': 'NumberStyleRule', 'string': 'StringStyleRule'} + } + + def __init__( + self, + **kwargs + ): + super(StyleRule, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.type = None # type: Optional[str] + + +class BooleanStyleRule(StyleRule): + """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.StyleRuleType + :param rules: Required. Boolean style rules. + :type rules: list[~azure.maps.creator.models.BooleanRule] + """ + + _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': '[BooleanRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(BooleanStyleRule, 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 BufferResult(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: + :vartype summary: ~azure.maps.creator.models.BufferSummary + :param features: The FeatureCollection of buffers for the input. + :type features: ~azure.maps.creator.models.GeoJsonFeatureCollection + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BufferSummary'}, + 'features': {'key': 'result', 'type': 'GeoJsonFeatureCollection'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResult, self).__init__(**kwargs) + self.summary = None + self.features = kwargs.get('features', None) + + +class BufferSummary(msrest.serialization.Model): + """BufferSummary. + + 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(BufferSummary, self).__init__(**kwargs) + self.udid = None + self.information = None + + +class ClosestPoint(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 using short names 'lat' & + 'lon'. + :type position: ~azure.maps.creator.models.LatLongPairAbbreviated + :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': 'LatLongPairAbbreviated'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPoint, self).__init__(**kwargs) + self.distance_in_meters = None + self.position = kwargs.get('position', None) + self.geometry_id = 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.ClosestPoint] + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ClosestPointSummary'}, + 'result': {'key': 'result', 'type': '[ClosestPoint]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', 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 using short names 'lat' + & 'lon'. + :type source_point: ~azure.maps.creator.models.LatLongPairAbbreviated + :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': 'LatLongPairAbbreviated'}, + '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 Collection(msrest.serialization.Model): + """Collection. + + 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(Collection, 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 CollectionDefinition(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.DefinitionProperty] + :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': '[DefinitionProperty]'}, + 'links': {'key': 'links', 'type': '[WFSEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionDefinition, 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 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.Collection] + """ + + _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': '[Collection]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionsResponse, self).__init__(**kwargs) + self.ontology = None + self.links = kwargs['links'] + self.collections = kwargs['collections'] + + +class ConformanceResult(msrest.serialization.Model): + """ConformanceResult. + + 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(ConformanceResult, self).__init__(**kwargs) + self.conforms_to = kwargs['conforms_to'] + + +class Conversion(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: dict[str, long] + """ + + _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': '{long}'}, + } + + def __init__( + self, + **kwargs + ): + super(Conversion, self).__init__(**kwargs) + self.conversion_id = None + self.ontology = None + self.udid = None + self.created = None + self.description = None + self.feature_counts = None + + +class ConversionListResult(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.Conversion] + :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': '[Conversion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListResult, self).__init__(**kwargs) + self.conversions = None + self.next_link = None + + +class Dataset(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: ~datetime.datetime + :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': 'iso-8601'}, + '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(Dataset, 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 DatasetListResult(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.Dataset] + :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': '[Dataset]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetListResult, 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 DefinitionProperty(msrest.serialization.Model): + """DefinitionProperty. + + 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(DefinitionProperty, 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 ExtendedGeoJsonFeatureCollection(GeoJsonFeatureCollectionData, 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: Specifies the ``GeoJSON`` type: FeatureCollection. 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}, + } + + _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 = kwargs.get('type', None) + self.features = kwargs['features'] + self.type = kwargs.get('type', None) + + +class FeatureResult(msrest.serialization.Model): + """FeatureResult. + + 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(FeatureResult, self).__init__(**kwargs) + self.ontology = None + self.feature = kwargs['feature'] + self.links = kwargs.get('links', None) + + +class FeatureState(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(FeatureState, 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.FeatureState] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[FeatureState]'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureStatesStructure, self).__init__(**kwargs) + self.states = kwargs.get('states', None) + + +class Geofence(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(Geofence, 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 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 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. + :vartype udid: 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 (in meters + except when special values -999/999 are used). 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_elevation: 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_elevation: float + """ + + _validation = { + 'device_id': {'readonly': True}, + 'udid': {'readonly': True}, + 'geometry_id': {'readonly': True}, + 'distance': {'readonly': True}, + 'nearest_lat': {'readonly': True}, + 'nearest_lon': {'readonly': True}, + 'nearest_elevation': {'readonly': True}, + } + + _attribute_map = { + 'device_id': {'key': 'deviceId', 'type': 'str'}, + 'udid': {'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_elevation': {'key': 'nearestZ', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceGeometry, self).__init__(**kwargs) + self.device_id = None + self.udid = None + self.geometry_id = None + self.distance = None + self.nearest_lat = None + self.nearest_lon = None + self.nearest_elevation = 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 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 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 GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + 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'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(**kwargs) + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # 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 GreatCircleDistanceResult(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.GreatCircleDistanceSummary + :ivar result: Result Object. + :vartype result: ~azure.maps.creator.models.GreatCircleDistanceResultResult + """ + + _validation = { + 'summary': {'readonly': True}, + 'result': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'GreatCircleDistanceSummary'}, + 'result': {'key': 'result', 'type': 'GreatCircleDistanceResultResult'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResult, self).__init__(**kwargs) + self.summary = None + self.result = None + + +class GreatCircleDistanceResultResult(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(GreatCircleDistanceResultResult, self).__init__(**kwargs) + self.distance_in_meters = None + + +class GreatCircleDistanceSummary(msrest.serialization.Model): + """Summary object. + + :param source_point: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type source_point: ~azure.maps.creator.models.LatLongPairAbbreviated + :param target_point: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type target_point: ~azure.maps.creator.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'LatLongPairAbbreviated'}, + 'target_point': {'key': 'targetPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.target_point = kwargs.get('target_point', None) + + +class LandingPageResult(msrest.serialization.Model): + """LandingPageResult. + + 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(LandingPageResult, self).__init__(**kwargs) + self.ontology = None + self.links = kwargs['links'] + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = kwargs.get('lat', None) + self.lon = kwargs.get('lon', None) + + +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: ~datetime.datetime + :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': 'iso-8601'}, + '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 MapData(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_url: The location of the data. Execute a HTTP ``GET`` on this location to + download the data. + :vartype location_url: 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. Possible values include: + "Pending", "Completed", "Failed". + :vartype upload_status: str or ~azure.maps.creator.models.UploadStatus + :param data_format: Possible values include: "geojson", "zip", "dwgzippackage". + :type data_format: str or ~azure.maps.creator.models.DataFormat + :ivar description: The current description. + :vartype description: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'location_url': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'upload_status': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'location_url': {'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(MapData, self).__init__(**kwargs) + self.udid = None + self.location_url = None + self.size_in_bytes = None + self.upload_status = None + self.data_format = kwargs.get('data_format', None) + self.description = None + + +class MapDataListResult(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.MapData] + """ + + _validation = { + 'map_data_list': {'readonly': True}, + } + + _attribute_map = { + 'map_data_list': {'key': 'mapDataList', 'type': '[MapData]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataListResult, self).__init__(**kwargs) + self.map_data_list = None + + +class NumberRule(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.Range + :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': 'Range'}, + 'color': {'key': 'color', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NumberRule, self).__init__(**kwargs) + self.range = kwargs.get('range', None) + self.color = kwargs.get('color', None) + + +class NumberStyleRule(StyleRule): + """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.StyleRuleType + :param rules: Required. Numeric style rules. + :type rules: list[~azure.maps.creator.models.NumberRule] + """ + + _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': '[NumberRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NumberStyleRule, self).__init__(**kwargs) + self.type = 'number' # type: str + self.rules = kwargs['rules'] + + +class PointInPolygonResult(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.PointInPolygonResultResult + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'PointInPolygonSummary'}, + 'result': {'key': 'result', 'type': 'PointInPolygonResultResult'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResult, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class PointInPolygonResultResult(msrest.serialization.Model): + """Point In Polygon Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_point_in_polygons: Point In Polygons Property. + :vartype is_point_in_polygons: bool + :ivar intersecting_geometries: Geometries array. + :vartype intersecting_geometries: list[str] + """ + + _validation = { + 'is_point_in_polygons': {'readonly': True}, + 'intersecting_geometries': {'readonly': True}, + } + + _attribute_map = { + 'is_point_in_polygons': {'key': 'pointInPolygons', 'type': 'bool'}, + 'intersecting_geometries': {'key': 'intersectingGeometries', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResultResult, self).__init__(**kwargs) + self.is_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 using short names 'lat' + & 'lon'. + :type source_point: ~azure.maps.creator.models.LatLongPairAbbreviated + :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': 'LatLongPairAbbreviated'}, + '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 Position(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param latitude: Required. The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: Required. The longitude of the location being passed. Example: -124.63. + :type longitude: float + """ + + _validation = { + 'latitude': {'required': True}, + 'longitude': {'required': True}, + } + + _attribute_map = { + 'latitude': {'key': 'Latitude', 'type': 'float'}, + 'longitude': {'key': 'Longitude', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(Position, self).__init__(**kwargs) + self.latitude = kwargs['latitude'] + self.longitude = kwargs['longitude'] + + +class Range(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: str + :param maximum: All the number x that x ≤ maximum. + :type maximum: str + :param exclusive_minimum: All the number x that x > exclusiveMinimum. + :type exclusive_minimum: str + :param exclusive_maximum: All the number x that x < exclusiveMaximum. + :type exclusive_maximum: str + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'str'}, + 'maximum': {'key': 'maximum', 'type': 'str'}, + 'exclusive_minimum': {'key': 'exclusiveMinimum', 'type': 'str'}, + 'exclusive_maximum': {'key': 'exclusiveMaximum', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Range, 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 Stateset(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 style_rules: The styles model. + :type style_rules: ~azure.maps.creator.models.StyleRules + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'style_rules': {'key': 'statesetStyle', 'type': 'StyleRules'}, + } + + def __init__( + self, + **kwargs + ): + super(Stateset, self).__init__(**kwargs) + self.description = None + self.dataset_ids = kwargs.get('dataset_ids', None) + self.style_rules = kwargs.get('style_rules', None) + + +class StatesetCreatedResult(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(StatesetCreatedResult, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetInfo(Stateset): + """The stateset information detail. + + 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 style_rules: The styles model. + :type style_rules: ~azure.maps.creator.models.StyleRules + :ivar stateset_id: The stateset ID of this stateset. + :vartype stateset_id: str + """ + + _validation = { + 'description': {'readonly': True}, + 'stateset_id': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'style_rules': {'key': 'statesetStyle', 'type': 'StyleRules'}, + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetInfo, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetListResult(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.StatesetInfo] + :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': '[StatesetInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetListResult, self).__init__(**kwargs) + self.statesets = kwargs.get('statesets', None) + self.next_link = None + + +class StringStyleRule(StyleRule): + """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.StyleRuleType + :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(StringStyleRule, self).__init__(**kwargs) + self.type = 'string' # type: str + self.rules = kwargs['rules'] + + +class StyleRules(msrest.serialization.Model): + """The styles model. + + :param style_rules: An array of stateset style rules. The style rule could be a numeric or + string or a boolean type style rule. Refer to NumberRule, StringRule and BooleanRule + definitions `here `_. + :type style_rules: list[~azure.maps.creator.models.StyleRule] + """ + + _attribute_map = { + 'style_rules': {'key': 'styles', 'type': '[StyleRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(StyleRules, self).__init__(**kwargs) + self.style_rules = kwargs.get('style_rules', None) + + +class Tileset(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(Tileset, 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 TilesetListResult(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.Tileset] + :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': '[Tileset]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetListResult, 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 href_lang: A hint indicating what the language of the result of dereferencing the link + should be. + :type href_lang: 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'}, + 'href_lang': {'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.href_lang = kwargs.get('href_lang', 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..32ffcfcd4f9f --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py @@ -0,0 +1,2736 @@ +# 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 Alias(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: ~datetime.datetime + :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: ~datetime.datetime + """ + + _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': 'iso-8601'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(Alias, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListResult(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.Alias] + :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': '[Alias]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListResult, self).__init__(**kwargs) + self.aliases = None + self.next_link = None + + +class BooleanRule(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(BooleanRule, self).__init__(**kwargs) + self.true = true + self.false = false + + +class StyleRule(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 NumberRule, StringRuleObject and BooleanRule definitions `here `_. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BooleanStyleRule, NumberStyleRule, StringStyleRule. + + 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.StyleRuleType + """ + + _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': 'BooleanStyleRule', 'number': 'NumberStyleRule', 'string': 'StringStyleRule'} + } + + def __init__( + self, + *, + key_name: str, + **kwargs + ): + super(StyleRule, self).__init__(**kwargs) + self.key_name = key_name + self.type = None # type: Optional[str] + + +class BooleanStyleRule(StyleRule): + """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.StyleRuleType + :param rules: Required. Boolean style rules. + :type rules: list[~azure.maps.creator.models.BooleanRule] + """ + + _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': '[BooleanRule]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List["BooleanRule"], + **kwargs + ): + super(BooleanStyleRule, 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 BufferResult(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: + :vartype summary: ~azure.maps.creator.models.BufferSummary + :param features: The FeatureCollection of buffers for the input. + :type features: ~azure.maps.creator.models.GeoJsonFeatureCollection + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BufferSummary'}, + 'features': {'key': 'result', 'type': 'GeoJsonFeatureCollection'}, + } + + def __init__( + self, + *, + features: Optional["GeoJsonFeatureCollection"] = None, + **kwargs + ): + super(BufferResult, self).__init__(**kwargs) + self.summary = None + self.features = features + + +class BufferSummary(msrest.serialization.Model): + """BufferSummary. + + 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(BufferSummary, self).__init__(**kwargs) + self.udid = None + self.information = None + + +class ClosestPoint(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 using short names 'lat' & + 'lon'. + :type position: ~azure.maps.creator.models.LatLongPairAbbreviated + :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': 'LatLongPairAbbreviated'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + } + + def __init__( + self, + *, + position: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(ClosestPoint, self).__init__(**kwargs) + self.distance_in_meters = None + self.position = position + self.geometry_id = 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.ClosestPoint] + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ClosestPointSummary'}, + 'result': {'key': 'result', 'type': '[ClosestPoint]'}, + } + + def __init__( + self, + *, + result: Optional[List["ClosestPoint"]] = None, + **kwargs + ): + super(ClosestPointResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +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 using short names 'lat' + & 'lon'. + :type source_point: ~azure.maps.creator.models.LatLongPairAbbreviated + :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': 'LatLongPairAbbreviated'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + *, + source_point: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(ClosestPointSummary, self).__init__(**kwargs) + self.source_point = source_point + self.udid = None + self.information = None + + +class Collection(msrest.serialization.Model): + """Collection. + + 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(Collection, self).__init__(**kwargs) + self.name = name + self.title = title + self.ontology = None + self.description = description + self.links = links + + +class CollectionDefinition(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.DefinitionProperty] + :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': '[DefinitionProperty]'}, + '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["DefinitionProperty"]] = None, + links: Optional[List["WFSEndpointLink"]] = None, + **kwargs + ): + super(CollectionDefinition, 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 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.Collection] + """ + + _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': '[Collection]'}, + } + + def __init__( + self, + *, + links: List["WFSEndpointLink"], + collections: List["Collection"], + **kwargs + ): + super(CollectionsResponse, self).__init__(**kwargs) + self.ontology = None + self.links = links + self.collections = collections + + +class ConformanceResult(msrest.serialization.Model): + """ConformanceResult. + + 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(ConformanceResult, self).__init__(**kwargs) + self.conforms_to = conforms_to + + +class Conversion(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: dict[str, long] + """ + + _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': '{long}'}, + } + + def __init__( + self, + **kwargs + ): + super(Conversion, self).__init__(**kwargs) + self.conversion_id = None + self.ontology = None + self.udid = None + self.created = None + self.description = None + self.feature_counts = None + + +class ConversionListResult(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.Conversion] + :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': '[Conversion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListResult, self).__init__(**kwargs) + self.conversions = None + self.next_link = None + + +class Dataset(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: ~datetime.datetime + :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': 'iso-8601'}, + '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(Dataset, 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 DatasetListResult(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.Dataset] + :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': '[Dataset]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetListResult, 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 DefinitionProperty(msrest.serialization.Model): + """DefinitionProperty. + + 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(DefinitionProperty, 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 ExtendedGeoJsonFeatureCollection(GeoJsonFeatureCollectionData, 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: Specifies the ``GeoJSON`` type: FeatureCollection. 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}, + } + + _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, + type: Optional[Union[str, "GeoJsonObjectType"]] = 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 = type + self.features = features + self.type = type + + +class FeatureResult(msrest.serialization.Model): + """FeatureResult. + + 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(FeatureResult, self).__init__(**kwargs) + self.ontology = None + self.feature = feature + self.links = links + + +class FeatureState(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(FeatureState, 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.FeatureState] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[FeatureState]'}, + } + + def __init__( + self, + *, + states: Optional[List["FeatureState"]] = None, + **kwargs + ): + super(FeatureStatesStructure, self).__init__(**kwargs) + self.states = states + + +class Geofence(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(Geofence, 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 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 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. + :vartype udid: 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 (in meters + except when special values -999/999 are used). 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_elevation: 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_elevation: float + """ + + _validation = { + 'device_id': {'readonly': True}, + 'udid': {'readonly': True}, + 'geometry_id': {'readonly': True}, + 'distance': {'readonly': True}, + 'nearest_lat': {'readonly': True}, + 'nearest_lon': {'readonly': True}, + 'nearest_elevation': {'readonly': True}, + } + + _attribute_map = { + 'device_id': {'key': 'deviceId', 'type': 'str'}, + 'udid': {'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_elevation': {'key': 'nearestZ', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceGeometry, self).__init__(**kwargs) + self.device_id = None + self.udid = None + self.geometry_id = None + self.distance = None + self.nearest_lat = None + self.nearest_lon = None + self.nearest_elevation = 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 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 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 GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + 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'}, + } + + 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 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 GreatCircleDistanceResult(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.GreatCircleDistanceSummary + :ivar result: Result Object. + :vartype result: ~azure.maps.creator.models.GreatCircleDistanceResultResult + """ + + _validation = { + 'summary': {'readonly': True}, + 'result': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'GreatCircleDistanceSummary'}, + 'result': {'key': 'result', 'type': 'GreatCircleDistanceResultResult'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResult, self).__init__(**kwargs) + self.summary = None + self.result = None + + +class GreatCircleDistanceResultResult(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(GreatCircleDistanceResultResult, self).__init__(**kwargs) + self.distance_in_meters = None + + +class GreatCircleDistanceSummary(msrest.serialization.Model): + """Summary object. + + :param source_point: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type source_point: ~azure.maps.creator.models.LatLongPairAbbreviated + :param target_point: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type target_point: ~azure.maps.creator.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'LatLongPairAbbreviated'}, + 'target_point': {'key': 'targetPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + source_point: Optional["LatLongPairAbbreviated"] = None, + target_point: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(GreatCircleDistanceSummary, self).__init__(**kwargs) + self.source_point = source_point + self.target_point = target_point + + +class LandingPageResult(msrest.serialization.Model): + """LandingPageResult. + + 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(LandingPageResult, self).__init__(**kwargs) + self.ontology = None + self.links = links + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + *, + lat: Optional[float] = None, + lon: Optional[float] = None, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = lat + self.lon = lon + + +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: ~datetime.datetime + :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': 'iso-8601'}, + '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 MapData(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_url: The location of the data. Execute a HTTP ``GET`` on this location to + download the data. + :vartype location_url: 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. Possible values include: + "Pending", "Completed", "Failed". + :vartype upload_status: str or ~azure.maps.creator.models.UploadStatus + :param data_format: Possible values include: "geojson", "zip", "dwgzippackage". + :type data_format: str or ~azure.maps.creator.models.DataFormat + :ivar description: The current description. + :vartype description: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'location_url': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'upload_status': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'location_url': {'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, + *, + data_format: Optional[Union[str, "DataFormat"]] = None, + **kwargs + ): + super(MapData, self).__init__(**kwargs) + self.udid = None + self.location_url = None + self.size_in_bytes = None + self.upload_status = None + self.data_format = data_format + self.description = None + + +class MapDataListResult(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.MapData] + """ + + _validation = { + 'map_data_list': {'readonly': True}, + } + + _attribute_map = { + 'map_data_list': {'key': 'mapDataList', 'type': '[MapData]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataListResult, self).__init__(**kwargs) + self.map_data_list = None + + +class NumberRule(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.Range + :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': 'Range'}, + 'color': {'key': 'color', 'type': 'str'}, + } + + def __init__( + self, + *, + range: Optional["Range"] = None, + color: Optional[str] = None, + **kwargs + ): + super(NumberRule, self).__init__(**kwargs) + self.range = range + self.color = color + + +class NumberStyleRule(StyleRule): + """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.StyleRuleType + :param rules: Required. Numeric style rules. + :type rules: list[~azure.maps.creator.models.NumberRule] + """ + + _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': '[NumberRule]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List["NumberRule"], + **kwargs + ): + super(NumberStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'number' # type: str + self.rules = rules + + +class PointInPolygonResult(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.PointInPolygonResultResult + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'PointInPolygonSummary'}, + 'result': {'key': 'result', 'type': 'PointInPolygonResultResult'}, + } + + def __init__( + self, + *, + result: Optional["PointInPolygonResultResult"] = None, + **kwargs + ): + super(PointInPolygonResult, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class PointInPolygonResultResult(msrest.serialization.Model): + """Point In Polygon Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_point_in_polygons: Point In Polygons Property. + :vartype is_point_in_polygons: bool + :ivar intersecting_geometries: Geometries array. + :vartype intersecting_geometries: list[str] + """ + + _validation = { + 'is_point_in_polygons': {'readonly': True}, + 'intersecting_geometries': {'readonly': True}, + } + + _attribute_map = { + 'is_point_in_polygons': {'key': 'pointInPolygons', 'type': 'bool'}, + 'intersecting_geometries': {'key': 'intersectingGeometries', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResultResult, self).__init__(**kwargs) + self.is_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 using short names 'lat' + & 'lon'. + :type source_point: ~azure.maps.creator.models.LatLongPairAbbreviated + :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': 'LatLongPairAbbreviated'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + *, + source_point: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(PointInPolygonSummary, self).__init__(**kwargs) + self.source_point = source_point + self.udid = None + self.information = None + + +class Position(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param latitude: Required. The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: Required. The longitude of the location being passed. Example: -124.63. + :type longitude: float + """ + + _validation = { + 'latitude': {'required': True}, + 'longitude': {'required': True}, + } + + _attribute_map = { + 'latitude': {'key': 'Latitude', 'type': 'float'}, + 'longitude': {'key': 'Longitude', 'type': 'float'}, + } + + def __init__( + self, + *, + latitude: float, + longitude: float, + **kwargs + ): + super(Position, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +class Range(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: str + :param maximum: All the number x that x ≤ maximum. + :type maximum: str + :param exclusive_minimum: All the number x that x > exclusiveMinimum. + :type exclusive_minimum: str + :param exclusive_maximum: All the number x that x < exclusiveMaximum. + :type exclusive_maximum: str + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'str'}, + 'maximum': {'key': 'maximum', 'type': 'str'}, + 'exclusive_minimum': {'key': 'exclusiveMinimum', 'type': 'str'}, + 'exclusive_maximum': {'key': 'exclusiveMaximum', 'type': 'str'}, + } + + def __init__( + self, + *, + minimum: Optional[str] = None, + maximum: Optional[str] = None, + exclusive_minimum: Optional[str] = None, + exclusive_maximum: Optional[str] = None, + **kwargs + ): + super(Range, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.exclusive_minimum = exclusive_minimum + self.exclusive_maximum = exclusive_maximum + + +class Stateset(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 style_rules: The styles model. + :type style_rules: ~azure.maps.creator.models.StyleRules + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'style_rules': {'key': 'statesetStyle', 'type': 'StyleRules'}, + } + + def __init__( + self, + *, + dataset_ids: Optional[List[str]] = None, + style_rules: Optional["StyleRules"] = None, + **kwargs + ): + super(Stateset, self).__init__(**kwargs) + self.description = None + self.dataset_ids = dataset_ids + self.style_rules = style_rules + + +class StatesetCreatedResult(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(StatesetCreatedResult, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetInfo(Stateset): + """The stateset information detail. + + 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 style_rules: The styles model. + :type style_rules: ~azure.maps.creator.models.StyleRules + :ivar stateset_id: The stateset ID of this stateset. + :vartype stateset_id: str + """ + + _validation = { + 'description': {'readonly': True}, + 'stateset_id': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'style_rules': {'key': 'statesetStyle', 'type': 'StyleRules'}, + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + } + + def __init__( + self, + *, + dataset_ids: Optional[List[str]] = None, + style_rules: Optional["StyleRules"] = None, + **kwargs + ): + super(StatesetInfo, self).__init__(dataset_ids=dataset_ids, style_rules=style_rules, **kwargs) + self.stateset_id = None + + +class StatesetListResult(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.StatesetInfo] + :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': '[StatesetInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + statesets: Optional[List["StatesetInfo"]] = None, + **kwargs + ): + super(StatesetListResult, self).__init__(**kwargs) + self.statesets = statesets + self.next_link = None + + +class StringStyleRule(StyleRule): + """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.StyleRuleType + :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(StringStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'string' # type: str + self.rules = rules + + +class StyleRules(msrest.serialization.Model): + """The styles model. + + :param style_rules: An array of stateset style rules. The style rule could be a numeric or + string or a boolean type style rule. Refer to NumberRule, StringRule and BooleanRule + definitions `here `_. + :type style_rules: list[~azure.maps.creator.models.StyleRule] + """ + + _attribute_map = { + 'style_rules': {'key': 'styles', 'type': '[StyleRule]'}, + } + + def __init__( + self, + *, + style_rules: Optional[List["StyleRule"]] = None, + **kwargs + ): + super(StyleRules, self).__init__(**kwargs) + self.style_rules = style_rules + + +class Tileset(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(Tileset, 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 TilesetListResult(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.Tileset] + :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': '[Tileset]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetListResult, 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 href_lang: A hint indicating what the language of the result of dereferencing the link + should be. + :type href_lang: 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'}, + 'href_lang': {'key': 'hreflang', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + } + + def __init__( + self, + *, + href: str, + rel: Optional[str] = None, + type: Optional[str] = None, + href_lang: Optional[str] = None, + title: Optional[str] = None, + **kwargs + ): + super(WFSEndpointLink, self).__init__(**kwargs) + self.href = href + self.rel = rel + self.type = type + self.href_lang = href_lang + 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..4dddebcd1656 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py @@ -0,0 +1,523 @@ +# 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.Alias" + """**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: Alias, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Alias + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alias"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 [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('Alias', 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.AliasListResult"] + """**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 AliasListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.AliasListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('AliasListResult', 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.Alias" + """**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: Alias, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Alias + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alias"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + 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('Alias', 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/aliases/{aliasId}'} # type: ignore + + def get( + self, + alias_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Alias" + """**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: Alias, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Alias + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Alias"] + 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'), + '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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Alias', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.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..287b9b0e8cbb --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py @@ -0,0 +1,583 @@ +# 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="facility-2.0", # type: Union[str, "_models.OutputOntology"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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="facility-2.0", # type: Union[str, "_models.OutputOntology"] + 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 or ~azure.maps.creator.models.OutputOntology + :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.ConversionListResult"] + """**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 ConversionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.ConversionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ConversionListResult', 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.Conversion" + """**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: Conversion, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Conversion + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Conversion"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Conversion', 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 Conversion 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..2ff27de30804 --- /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_initial( + self, + data_format, # type: Union[str, "_models.DataFormat"] + upload_content, # type: Union[IO, Any] + 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_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 description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + query_parameters['dataFormat'] = self._serialize.query("data_format", data_format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_initial.metadata = {'url': '/mapData'} # type: ignore + + def begin_upload( + self, + data_format, # type: Union[str, "_models.DataFormat"] + upload_content, # type: Union[IO, Any] + 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 data_format: Data format of the content being uploaded. + :type data_format: str or ~azure.maps.creator.models.DataFormat + :param upload_content: The content to upload. + :type upload_content: IO or any + :param description: The description to be given to the upload. + :type 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_initial( + data_format=data_format, + upload_content=upload_content, + 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_upload.metadata = {'url': '/mapData'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.MapDataListResult" + """**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: MapDataListResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.MapDataListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapDataListResult"] + 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.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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MapDataListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/mapData'} # type: ignore + + def _update_initial( + self, + udid, # type: str + update_content, # type: Any + 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_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("udid", udid, '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 description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_initial.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def begin_update( + self, + udid, # type: str + update_content, # type: Any + 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 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 update_content: The new content that will update/replace the previously uploaded + content. + :type update_content: any + :param description: The description to be given to the upload. + :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._update_initial( + udid=udid, + update_content=update_content, + 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'), + 'udid': self._serialize.url("udid", udid, '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.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def download( + self, + udid, # 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 udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: 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.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("udid", udid, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def delete( + self, + udid, # 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 udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: 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'), + 'udid': self._serialize.url("udid", udid, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/mapData/{udid}'} # 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 /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.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': '/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..874f56327fc2 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py @@ -0,0 +1,648 @@ +# 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=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 is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/datasets'} # type: ignore + + def begin_create( + self, + conversion_id, # type: str + dataset_id=None, # type: Optional[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 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: The description to be given to the dataset. + :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( + conversion_id=conversion_id, + 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': '/datasets'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatasetListResult"] + """**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" + ], }, + "": "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 DatasetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.DatasetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('DatasetListResult', 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.Dataset" + """**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: Dataset, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Dataset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Dataset"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Dataset', 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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': '/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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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['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..e02bbb70ce90 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py @@ -0,0 +1,650 @@ +# 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 + style_rules, # type: "_models.StyleRules" + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.StatesetCreatedResult" + """**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 style_rules: The stateset style JSON data. + :type style_rules: ~azure.maps.creator.models.StyleRules + :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: StatesetCreatedResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetCreatedResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetCreatedResult"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(style_rules, 'StyleRules') + 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('StatesetCreatedResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def list_statesets( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StatesetListResult"] + """**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 StatesetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.StatesetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_statesets.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('StatesetListResult', 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_statesets.metadata = {'url': '/featureStateSets'} # type: ignore + + def update_stateset( + self, + stateset_id, # type: str + style_rules, # type: "_models.StyleRules" + **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 style_rules: The stateset style JSON data. Only style rules are allowed to be updated, + update on keyname and type is not allowed. + :type style_rules: ~azure.maps.creator.models.StyleRules + :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_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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(style_rules, 'StyleRules') + 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_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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def get_stateset( + self, + stateset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Stateset" + """**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: Stateset, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Stateset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Stateset"] + 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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Stateset', 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_states, # 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_states: 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_states: ~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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(feature_states, '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 + 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 key_name: The Name of the state to be deleted. + :type 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("key_name", key_name, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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_state.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + def list_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.list_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] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('FeatureStatesStructure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_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..4eb98aab2c71 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py @@ -0,0 +1,975 @@ +# 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, + device_id, # type: str + udid, # type: str + position, # type: "_models.Position" + format="json", # type: Union[str, "_models.JsonFormat"] + altitude=None, # type: Optional[float] + user_time=None, # type: Optional[datetime.datetime] + search_buffer_in_meters=None, # type: Optional[float] + is_async=None, # type: Optional[bool] + mode=None, # type: Optional[Union[str, "_models.GeofenceMode"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Geofence" + """**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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :param altitude: The sea level in meter of the location being passed. If this parameter is + presented, 2D extrusion is used. Example: 200. + :type altitude: 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_in_meters: 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_in_meters: 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: Geofence, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Geofence + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Geofence"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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 altitude is not None: + query_parameters['z'] = self._serialize.query("altitude", altitude, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer_in_meters is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer_in_meters", search_buffer_in_meters, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Geofence', 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, + device_id, # type: str + search_geofence_request_body, # type: "_models.GeoJsonFeatureCollection" + position, # type: "_models.Position" + format="json", # type: Union[str, "_models.JsonFormat"] + altitude=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.Geofence" + """**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 device_id: ID of the device. + :type device_id: str + :param search_geofence_request_body: The geofencing GeoJSON data. + :type search_geofence_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :param altitude: The sea level in meter of the location being passed. If this parameter is + presented, 2D extrusion geofencing is applied. Example: 200. + :type altitude: 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: Geofence, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Geofence + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Geofence"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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 altitude is not None: + query_parameters['z'] = self._serialize.query("altitude", altitude, '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Geofence', 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, + buffer_request_body, # type: "_models.BufferRequestBody" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BufferResult" + """**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 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 + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('BufferResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + def get_buffer( + self, + udid, # type: str + distances, # type: str + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.BufferResult" + """**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 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 + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('BufferResult', 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, + closest_point_request_body, # type: "_models.GeoJsonFeatureCollection" + position, # type: "_models.Position" + format="json", # type: Union[str, "_models.JsonFormat"] + 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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :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', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, + udid, # type: str + position, # type: "_models.Position" + format="json", # type: Union[str, "_models.JsonFormat"] + 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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :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', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, + point_in_polygon_request_body, # type: "_models.GeoJsonFeatureCollection" + position, # type: "_models.Position" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PointInPolygonResult" + """**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 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 + :param position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PointInPolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + def evaluate_point_in_polygon( + self, + udid, # type: str + position, # type: "_models.Position" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PointInPolygonResult" + """**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 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 position: Parameter group. + :type position: ~azure.maps.creator.models.Position + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _latitude = None + _longitude = None + if position is not None: + _latitude = position.latitude + _longitude = position.longitude + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.evaluate_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PointInPolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + evaluate_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + def get_great_circle_distance( + self, + query, # type: str + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.GreatCircleDistanceResult" + """**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 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 + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GreatCircleDistanceResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GreatCircleDistanceResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GreatCircleDistanceResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('GreatCircleDistanceResult', 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..a5eb4d0aa4ea --- /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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.TilesetListResult"] + """.. 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 TilesetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.TilesetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetListResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TilesetListResult', 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.Tileset" + """**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: Tileset, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Tileset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Tileset"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Tileset', 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 tileset 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..8f419b420eda --- /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, List, 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.LandingPageResult" + """**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: LandingPageResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LandingPageResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LandingPageResult"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('LandingPageResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_landing_page.metadata = {'url': '/wfs/datasets/{datasetId}/'} # type: ignore + + def list_conformance( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConformanceResult" + """**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: ConformanceResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConformanceResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConformanceResult"] + 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_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ConformanceResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.Collection" + """**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: Collection, or the result of cls(response) + :rtype: ~azure.maps.creator.models.Collection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Collection"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Collection', 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.CollectionDefinition" + """**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: CollectionDefinition, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionDefinition"] + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('CollectionDefinition', 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] + bounding_box=None, # type: Optional[List[float]] + 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 bounding_box: 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 bounding_box: list[float] + :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 bounding_box is not None: + query_parameters['bbox'] = self._serialize.query("bounding_box", bounding_box, '[float]', div=',') + 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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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.FeatureResult" + """**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: FeatureResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResult"] + 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('FeatureResult', 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..069a2fea0e93 --- /dev/null +++ b/sdk/maps/azure-maps-creator/setup.py @@ -0,0 +1,90 @@ +#!/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.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'], + } +) diff --git a/sdk/maps/azure-maps-elevation/CHANGELOG.md b/sdk/maps/azure-maps-elevation/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-elevation/LICENSE.txt b/sdk/maps/azure-maps-elevation/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-elevation/MANIFEST.in b/sdk/maps/azure-maps-elevation/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-elevation/README.md b/sdk/maps/azure-maps-elevation/README.md new file mode 100644 index 000000000000..6d1d1d5b8c70 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/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.6+. +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-elevation%2FREADME.png) diff --git a/sdk/maps/azure-maps-elevation/_meta.json b/sdk/maps/azure-maps-elevation/_meta.json new file mode 100644 index 000000000000..15992ba9d561 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/DEM/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/DEM/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-elevation/azure/__init__.py b/sdk/maps/azure-maps-elevation/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-elevation/azure/maps/__init__.py b/sdk/maps/azure-maps-elevation/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/__init__.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/__init__.py new file mode 100644 index 000000000000..f22a326f8b3a --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/__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 ._elevation_client import ElevationClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ElevationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/_configuration.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_configuration.py new file mode 100644 index 000000000000..fbeb08b2d299 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class ElevationClientConfiguration(Configuration): + """Configuration for ElevationClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(ElevationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-elevation/{}'.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-elevation/azure/maps/elevation/_elevation_client.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_elevation_client.py new file mode 100644 index 000000000000..1b312914bbd9 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_elevation_client.py @@ -0,0 +1,85 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import ElevationClientConfiguration +from .operations import ElevationOperations +from . import models + + +class ElevationClient(object): + """The Azure Maps Elevation API provides an HTTP interface to query elevation data on the surface of the Earth. Elevation data can be retrieved at specific locations by sending lat/lon coordinates, by defining an ordered set of vertices that form a Polyline and a number of sample points along the length of a Polyline, or by defining a bounding box that consists of equally spaced vertices as rows and columns. The vertical datum is EPSG:3855. This datum uses the EGM2008 geoid model applied to the WGS84 ellipsoid as its zero height reference surface. The vertical unit is measured in meters, the spatial resolution of the elevation data is 0.8 arc-second for global coverage (~24 meters). + + :ivar elevation: ElevationOperations operations + :vartype elevation: azure.maps.elevation.operations.ElevationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = ElevationClientConfiguration(credential, client_id, **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.elevation = ElevationOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> ElevationClient + 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-elevation/azure/maps/elevation/_metadata.json b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_metadata.json new file mode 100644 index 000000000000..4883fc111229 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "ElevationClient", + "filename": "_elevation_client", + "description": "The Azure Maps Elevation API provides an HTTP interface to query elevation data on the surface of the Earth. Elevation data can be retrieved at specific locations by sending lat/lon coordinates, by defining an ordered set of vertices that form a Polyline and a number of sample points along the length of a Polyline, or by defining a bounding box that consists of equally spaced vertices as rows and columns. The vertical datum is EPSG:3855. This datum uses the EGM2008 geoid model applied to the WGS84 ellipsoid as its zero height reference surface. The vertical unit is measured in meters, the spatial resolution of the elevation data is 0.8 arc-second for global coverage (~24 meters).", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"ElevationClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"ElevationClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "elevation": "ElevationOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/_version.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/__init__.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/__init__.py new file mode 100644 index 000000000000..4dfcbb83c45c --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/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 ._elevation_client import ElevationClient +__all__ = ['ElevationClient'] diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_configuration.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_configuration.py new file mode 100644 index 000000000000..d9de0c93a76c --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 ElevationClientConfiguration(Configuration): + """Configuration for ElevationClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(ElevationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-elevation/{}'.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-elevation/azure/maps/elevation/aio/_elevation_client.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_elevation_client.py new file mode 100644 index 000000000000..37f8977fe85e --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_elevation_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 ElevationClientConfiguration +from .operations import ElevationOperations +from .. import models + + +class ElevationClient(object): + """The Azure Maps Elevation API provides an HTTP interface to query elevation data on the surface of the Earth. Elevation data can be retrieved at specific locations by sending lat/lon coordinates, by defining an ordered set of vertices that form a Polyline and a number of sample points along the length of a Polyline, or by defining a bounding box that consists of equally spaced vertices as rows and columns. The vertical datum is EPSG:3855. This datum uses the EGM2008 geoid model applied to the WGS84 ellipsoid as its zero height reference surface. The vertical unit is measured in meters, the spatial resolution of the elevation data is 0.8 arc-second for global coverage (~24 meters). + + :ivar elevation: ElevationOperations operations + :vartype elevation: azure.maps.elevation.aio.operations.ElevationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = ElevationClientConfiguration(credential, client_id, **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.elevation = ElevationOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "ElevationClient": + 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-elevation/azure/maps/elevation/aio/operations/__init__.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/__init__.py new file mode 100644 index 000000000000..93180328ab83 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._elevation_operations import ElevationOperations + +__all__ = [ + 'ElevationOperations', +] diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/_elevation_operations.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/_elevation_operations.py new file mode 100644 index 000000000000..36223f485321 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/_elevation_operations.py @@ -0,0 +1,462 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ElevationOperations: + """ElevationOperations 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.elevation.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_data_for_points( + self, + points: List[str], + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.ElevationResult": + """Get Elevation Data on One or More Points. + + **Applies to**\ : S1 pricing tier. + + The Get Data for Points API provides elevation data for one or more points. A point is + defined in lat,long coordinate format. + + Due to the URL character length limit of 2048, it's not possible to pass more than 100 + coordinates as a pipeline delimited string in a URL GET request. If you intend to pass more + than 100 coordinates as a pipeline delimited string, use the `POST Data + For Points `_. + + The result will be in the same sequence of points listed in the request. + + :param points: The string representation of a list of points. A point is defined in lon/lat + WGS84 coordinate reference system format. If multiple points are requested, each of the points + in a list should be separated by the pipe ('|') character. The maximum number of points that + can be requested in a single request is 2,000. The resolution of the elevation data will be + the highest for a single point and will decrease if multiple points are spread further apart. + :type points: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_points.metadata['url'] # type: ignore + path_format_arguments = { + '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['points'] = self._serialize.query("points", points, '[str]', skip_quote=True, div='|') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_for_points.metadata = {'url': '/elevation/point/{format}'} # type: ignore + + async def post_data_for_points( + self, + points: List["_models.LatLongPairAbbreviated"], + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.ElevationResult": + """Query Elevation Data for Multiple Points. + + **Applies to**\ : S1 pricing tier. + + The Post Data for Points API provides elevation data for multiple points. A point is defined + lon/lat coordinate format. + + Use the POST endpoint only if you intend to pass multiple points in the request. If you intend + to pass a single coordinate into the API, use the `GET Data For Points API + `_. + + The result will be in the same sequence of points listed in the request. + + :param points: The string representation of a list of points. A point is defined in lon/lat + WGS84 coordinate reference system format. Each points in a list should be separated by the + pipe ('|') character. The number of points that can be requested in a POST request ranges from + 2 to 2,000. The resolution of the elevation data will be the highest for a single point and + will decrease if multiple points are spread further apart. + :type points: list[~azure.maps.elevation.models.LatLongPairAbbreviated] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_points.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(points, '[LatLongPairAbbreviated]') + 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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_data_for_points.metadata = {'url': '/elevation/point/{format}'} # type: ignore + + async def get_data_for_polyline( + self, + lines: List[str], + format: Union[str, "_models.JsonFormat"] = "json", + samples: Optional[int] = None, + **kwargs: Any + ) -> "_models.ElevationResult": + """Get Elevation Data Along a Polyline. + + **Applies to**\ : S1 pricing tier. + + The Get Data for Polyline API provides elevation data along a polyline. + + A polyline is defined by passing in between 2 and N endpoint coordinates separated by a pipe + ('|') character. In addition to passing in endpoints, customers can specify the number of + sample points that will be used to divide polyline into equally spaced segments. + + Elevation data at both start and endpoints, as well as equally spaced points along the + polyline will be returned. The results will be listed in the direction from the first endpoint + towards the last endpoint. A line between two endpoints is a straight Cartesian line, the + shortest line between those two points in the coordinate reference system. Note that the point + is chosen based on Euclidean distance and may markedly differ from the geodesic path along the + curved surface of the reference ellipsoid. + + :param lines: The string representation of a polyline path. A polyline is defined by endpoint + coordinates, with each endpoint separated by a pipe ('|') character. The polyline should be + defined in the following format: ``[longitude_point1, latitude_point1 | longitude_point2, + latitude_point2, ..., longitude_pointN, latitude_pointN]``. + + The longitude and latitude values refer to the World Geodetic System (WGS84) coordinate + reference system. The resolution of the data used to compute the elevation depends on the + distance between the endpoints. + :type lines: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :param samples: The samples parameter specifies the number of equally spaced points at which + elevation values should be provided along a polyline path. The number of samples should range + from 2 to 2,000. Default value is 10. + :type samples: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_polyline.metadata['url'] # type: ignore + path_format_arguments = { + '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['lines'] = self._serialize.query("lines", lines, '[str]', skip_quote=True, div='|') + if samples is not None: + query_parameters['samples'] = self._serialize.query("samples", samples, 'int', maximum=2000, minimum=2) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_for_polyline.metadata = {'url': '/elevation/line/{format}'} # type: ignore + + async def post_data_for_polyline( + self, + polyline: List["_models.LatLongPairAbbreviated"], + format: Union[str, "_models.JsonFormat"] = "json", + samples: Optional[int] = None, + **kwargs: Any + ) -> "_models.ElevationResult": + """Query Elevation Data Along a Polyline. + + **Applies to**\ : S1 pricing tier. + + The Post Data for Polyline API provides elevation data along a polyline. + + A polyline is defined by passing in between 2 and N endpoint coordinates separated by a pipe + ('|') character. In addition to passing in endpoints, customers can specify the number of + sample points that will be used to divide polyline into equally spaced segments. + + Elevation data at both start and end points, as well as equally spaced points along the + polyline will be returned. The results will be listed in the direction from the first endpoint + towards the last endpoint. A line between two endpoints is a straight Cartesian line, the + shortest line between those two points in the coordinate reference system. Note that the point + is chosen based on Euclidean distance and may markedly differ from the geodesic path along the + curved surface of the reference ellipsoid. + + :param polyline: The string representation of a polyline path. A polyline is defined by + endpoint coordinates, with each endpoint separated by a pipe ('|') character. The polyline + should be defined in the following format: ``[longitude_point1, latitude_point1 | + longitude_point2, latitude_point2, ..., longitude_pointN, latitude_pointN]``. The longitude + and latitude values refer to the World Geodetic System (WGS84) coordinate reference system. + The resolution of the data used to compute the elevation will depend on the distance between + the endpoints. + :type polyline: list[~azure.maps.elevation.models.LatLongPairAbbreviated] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :param samples: The samples parameter specifies the number of equally spaced points at which + elevation values should be provided along a polyline path. The number of samples should range + from 2 to 2,000. Default value is 10. + :type samples: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_polyline.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if samples is not None: + query_parameters['samples'] = self._serialize.query("samples", samples, 'int', maximum=2000, minimum=2) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(polyline, '[LatLongPairAbbreviated]') + 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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_data_for_polyline.metadata = {'url': '/elevation/line/{format}'} # type: ignore + + async def get_data_for_bounding_box( + self, + bounds: List[float], + rows: int, + columns: int, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.ElevationResult": + """Get Elevation Data at Equally Spaced Locations Within a Bounding Box. + + **Applies to**\ : S1 pricing tier. + + The Get Data for Bounding Box API provides elevation data at equally spaced locations within a + bounding box. A bounding box is defined by the coordinates for two corners (southwest, + northeast) and then subsequently divided into rows and columns. + + Elevations are returned for the vertices of the grid created by the rows and columns. Up to + 2,000 elevations can be returned in a single request. The returned elevation values are + ordered, starting at the southwest corner, and then proceeding west to east along the row. At + the end of the row, it moves north to the next row, and repeats the process until it reaches + the far northeast corner. + + :param bounds: The string that represents the rectangular area of a bounding box. The bounds + parameter is defined by the 4 bounding box coordinates, with WGS84 longitude and latitude of + the southwest corner followed by WGS84 longitude and latitude of the northeast corner. The + string is presented in the following format: ``[SouthwestCorner_Longitude, + SouthwestCorner_Latitude, NortheastCorner_Longitude, NortheastCorner_Latitude]``. + :type bounds: list[float] + :param rows: Specifies the number of rows to use to divide the bounding box area into a grid. + The number of vertices (rows x columns) in the grid should be less than 2,000. + :type rows: int + :param columns: Specifies the number of columns to use to divide the bounding box area into a + grid. The number of vertices (rows x columns) in the grid should be less than 2,000. + :type columns: int + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_bounding_box.metadata['url'] # type: ignore + path_format_arguments = { + '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['bounds'] = self._serialize.query("bounds", bounds, '[float]', div=',') + query_parameters['rows'] = self._serialize.query("rows", rows, 'int', maximum=1000, minimum=2) + query_parameters['columns'] = self._serialize.query("columns", columns, 'int', maximum=1000, minimum=2) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_for_bounding_box.metadata = {'url': '/elevation/lattice/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/__init__.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/__init__.py new file mode 100644 index 000000000000..2866af40aaaf --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/__init__.py @@ -0,0 +1,39 @@ +# 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 Elevation + from ._models_py3 import ElevationResult + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import LatLongPair + from ._models_py3 import LatLongPairAbbreviated +except (SyntaxError, ImportError): + from ._models import Elevation # type: ignore + from ._models import ElevationResult # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import LatLongPair # type: ignore + from ._models import LatLongPairAbbreviated # type: ignore + +from ._elevation_client_enums import ( + JsonFormat, +) + +__all__ = [ + 'Elevation', + 'ElevationResult', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'LatLongPair', + 'LatLongPairAbbreviated', + 'JsonFormat', +] diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_elevation_client_enums.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_elevation_client_enums.py new file mode 100644 index 000000000000..749ad50afe35 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_elevation_client_enums.py @@ -0,0 +1,33 @@ +# 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 JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models.py new file mode 100644 index 000000000000..679a783b755d --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models.py @@ -0,0 +1,205 @@ +# 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 Elevation(msrest.serialization.Model): + """The elevation data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param coordinate: A location represented as a latitude and longitude. + :type coordinate: ~azure.maps.elevation.models.LatLongPair + :ivar elevation_in_meter: The elevation value in meters. + :vartype elevation_in_meter: float + """ + + _validation = { + 'elevation_in_meter': {'readonly': True}, + } + + _attribute_map = { + 'coordinate': {'key': 'coordinate', 'type': 'LatLongPair'}, + 'elevation_in_meter': {'key': 'elevationInMeter', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(Elevation, self).__init__(**kwargs) + self.coordinate = kwargs.get('coordinate', None) + self.elevation_in_meter = None + + +class ElevationResult(msrest.serialization.Model): + """The response from a successful Get Data for Bounding Box API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar elevations: The response for point/points elevation API. The result will be in same + sequence of points listed in request. + :vartype elevations: list[~azure.maps.elevation.models.Elevation] + """ + + _validation = { + 'elevations': {'readonly': True}, + } + + _attribute_map = { + 'elevations': {'key': 'data', 'type': '[Elevation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ElevationResult, self).__init__(**kwargs) + self.elevations = None + + +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.elevation.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.elevation.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.elevation.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 LatLongPair(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + :param latitude: Latitude property. + :type latitude: float + :param longitude: Longitude property. + :type longitude: float + """ + + _attribute_map = { + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPair, self).__init__(**kwargs) + self.latitude = kwargs.get('latitude', None) + self.longitude = kwargs.get('longitude', None) + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = kwargs.get('lat', None) + self.lon = kwargs.get('lon', None) diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models_py3.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models_py3.py new file mode 100644 index 000000000000..8d6518cbd815 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models_py3.py @@ -0,0 +1,217 @@ +# 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 Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Elevation(msrest.serialization.Model): + """The elevation data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param coordinate: A location represented as a latitude and longitude. + :type coordinate: ~azure.maps.elevation.models.LatLongPair + :ivar elevation_in_meter: The elevation value in meters. + :vartype elevation_in_meter: float + """ + + _validation = { + 'elevation_in_meter': {'readonly': True}, + } + + _attribute_map = { + 'coordinate': {'key': 'coordinate', 'type': 'LatLongPair'}, + 'elevation_in_meter': {'key': 'elevationInMeter', 'type': 'float'}, + } + + def __init__( + self, + *, + coordinate: Optional["LatLongPair"] = None, + **kwargs + ): + super(Elevation, self).__init__(**kwargs) + self.coordinate = coordinate + self.elevation_in_meter = None + + +class ElevationResult(msrest.serialization.Model): + """The response from a successful Get Data for Bounding Box API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar elevations: The response for point/points elevation API. The result will be in same + sequence of points listed in request. + :vartype elevations: list[~azure.maps.elevation.models.Elevation] + """ + + _validation = { + 'elevations': {'readonly': True}, + } + + _attribute_map = { + 'elevations': {'key': 'data', 'type': '[Elevation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ElevationResult, self).__init__(**kwargs) + self.elevations = None + + +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.elevation.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.elevation.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.elevation.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 LatLongPair(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + :param latitude: Latitude property. + :type latitude: float + :param longitude: Longitude property. + :type longitude: float + """ + + _attribute_map = { + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + } + + def __init__( + self, + *, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + **kwargs + ): + super(LatLongPair, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + *, + lat: Optional[float] = None, + lon: Optional[float] = None, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = lat + self.lon = lon diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/__init__.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/__init__.py new file mode 100644 index 000000000000..93180328ab83 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._elevation_operations import ElevationOperations + +__all__ = [ + 'ElevationOperations', +] diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/_elevation_operations.py b/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/_elevation_operations.py new file mode 100644 index 000000000000..3bfce8d9555d --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/_elevation_operations.py @@ -0,0 +1,471 @@ +# 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ElevationOperations(object): + """ElevationOperations 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.elevation.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_data_for_points( + self, + points, # type: List[str] + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ElevationResult" + """Get Elevation Data on One or More Points. + + **Applies to**\ : S1 pricing tier. + + The Get Data for Points API provides elevation data for one or more points. A point is + defined in lat,long coordinate format. + + Due to the URL character length limit of 2048, it's not possible to pass more than 100 + coordinates as a pipeline delimited string in a URL GET request. If you intend to pass more + than 100 coordinates as a pipeline delimited string, use the `POST Data + For Points `_. + + The result will be in the same sequence of points listed in the request. + + :param points: The string representation of a list of points. A point is defined in lon/lat + WGS84 coordinate reference system format. If multiple points are requested, each of the points + in a list should be separated by the pipe ('|') character. The maximum number of points that + can be requested in a single request is 2,000. The resolution of the elevation data will be + the highest for a single point and will decrease if multiple points are spread further apart. + :type points: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_points.metadata['url'] # type: ignore + path_format_arguments = { + '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['points'] = self._serialize.query("points", points, '[str]', skip_quote=True, div='|') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_for_points.metadata = {'url': '/elevation/point/{format}'} # type: ignore + + def post_data_for_points( + self, + points, # type: List["_models.LatLongPairAbbreviated"] + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ElevationResult" + """Query Elevation Data for Multiple Points. + + **Applies to**\ : S1 pricing tier. + + The Post Data for Points API provides elevation data for multiple points. A point is defined + lon/lat coordinate format. + + Use the POST endpoint only if you intend to pass multiple points in the request. If you intend + to pass a single coordinate into the API, use the `GET Data For Points API + `_. + + The result will be in the same sequence of points listed in the request. + + :param points: The string representation of a list of points. A point is defined in lon/lat + WGS84 coordinate reference system format. Each points in a list should be separated by the + pipe ('|') character. The number of points that can be requested in a POST request ranges from + 2 to 2,000. The resolution of the elevation data will be the highest for a single point and + will decrease if multiple points are spread further apart. + :type points: list[~azure.maps.elevation.models.LatLongPairAbbreviated] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_points.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(points, '[LatLongPairAbbreviated]') + 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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_data_for_points.metadata = {'url': '/elevation/point/{format}'} # type: ignore + + def get_data_for_polyline( + self, + lines, # type: List[str] + format="json", # type: Union[str, "_models.JsonFormat"] + samples=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.ElevationResult" + """Get Elevation Data Along a Polyline. + + **Applies to**\ : S1 pricing tier. + + The Get Data for Polyline API provides elevation data along a polyline. + + A polyline is defined by passing in between 2 and N endpoint coordinates separated by a pipe + ('|') character. In addition to passing in endpoints, customers can specify the number of + sample points that will be used to divide polyline into equally spaced segments. + + Elevation data at both start and endpoints, as well as equally spaced points along the + polyline will be returned. The results will be listed in the direction from the first endpoint + towards the last endpoint. A line between two endpoints is a straight Cartesian line, the + shortest line between those two points in the coordinate reference system. Note that the point + is chosen based on Euclidean distance and may markedly differ from the geodesic path along the + curved surface of the reference ellipsoid. + + :param lines: The string representation of a polyline path. A polyline is defined by endpoint + coordinates, with each endpoint separated by a pipe ('|') character. The polyline should be + defined in the following format: ``[longitude_point1, latitude_point1 | longitude_point2, + latitude_point2, ..., longitude_pointN, latitude_pointN]``. + + The longitude and latitude values refer to the World Geodetic System (WGS84) coordinate + reference system. The resolution of the data used to compute the elevation depends on the + distance between the endpoints. + :type lines: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :param samples: The samples parameter specifies the number of equally spaced points at which + elevation values should be provided along a polyline path. The number of samples should range + from 2 to 2,000. Default value is 10. + :type samples: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_polyline.metadata['url'] # type: ignore + path_format_arguments = { + '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['lines'] = self._serialize.query("lines", lines, '[str]', skip_quote=True, div='|') + if samples is not None: + query_parameters['samples'] = self._serialize.query("samples", samples, 'int', maximum=2000, minimum=2) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_for_polyline.metadata = {'url': '/elevation/line/{format}'} # type: ignore + + def post_data_for_polyline( + self, + polyline, # type: List["_models.LatLongPairAbbreviated"] + format="json", # type: Union[str, "_models.JsonFormat"] + samples=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.ElevationResult" + """Query Elevation Data Along a Polyline. + + **Applies to**\ : S1 pricing tier. + + The Post Data for Polyline API provides elevation data along a polyline. + + A polyline is defined by passing in between 2 and N endpoint coordinates separated by a pipe + ('|') character. In addition to passing in endpoints, customers can specify the number of + sample points that will be used to divide polyline into equally spaced segments. + + Elevation data at both start and end points, as well as equally spaced points along the + polyline will be returned. The results will be listed in the direction from the first endpoint + towards the last endpoint. A line between two endpoints is a straight Cartesian line, the + shortest line between those two points in the coordinate reference system. Note that the point + is chosen based on Euclidean distance and may markedly differ from the geodesic path along the + curved surface of the reference ellipsoid. + + :param polyline: The string representation of a polyline path. A polyline is defined by + endpoint coordinates, with each endpoint separated by a pipe ('|') character. The polyline + should be defined in the following format: ``[longitude_point1, latitude_point1 | + longitude_point2, latitude_point2, ..., longitude_pointN, latitude_pointN]``. The longitude + and latitude values refer to the World Geodetic System (WGS84) coordinate reference system. + The resolution of the data used to compute the elevation will depend on the distance between + the endpoints. + :type polyline: list[~azure.maps.elevation.models.LatLongPairAbbreviated] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :param samples: The samples parameter specifies the number of equally spaced points at which + elevation values should be provided along a polyline path. The number of samples should range + from 2 to 2,000. Default value is 10. + :type samples: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_polyline.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if samples is not None: + query_parameters['samples'] = self._serialize.query("samples", samples, 'int', maximum=2000, minimum=2) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(polyline, '[LatLongPairAbbreviated]') + 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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_data_for_polyline.metadata = {'url': '/elevation/line/{format}'} # type: ignore + + def get_data_for_bounding_box( + self, + bounds, # type: List[float] + rows, # type: int + columns, # type: int + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ElevationResult" + """Get Elevation Data at Equally Spaced Locations Within a Bounding Box. + + **Applies to**\ : S1 pricing tier. + + The Get Data for Bounding Box API provides elevation data at equally spaced locations within a + bounding box. A bounding box is defined by the coordinates for two corners (southwest, + northeast) and then subsequently divided into rows and columns. + + Elevations are returned for the vertices of the grid created by the rows and columns. Up to + 2,000 elevations can be returned in a single request. The returned elevation values are + ordered, starting at the southwest corner, and then proceeding west to east along the row. At + the end of the row, it moves north to the next row, and repeats the process until it reaches + the far northeast corner. + + :param bounds: The string that represents the rectangular area of a bounding box. The bounds + parameter is defined by the 4 bounding box coordinates, with WGS84 longitude and latitude of + the southwest corner followed by WGS84 longitude and latitude of the northeast corner. The + string is presented in the following format: ``[SouthwestCorner_Longitude, + SouthwestCorner_Latitude, NortheastCorner_Longitude, NortheastCorner_Latitude]``. + :type bounds: list[float] + :param rows: Specifies the number of rows to use to divide the bounding box area into a grid. + The number of vertices (rows x columns) in the grid should be less than 2,000. + :type rows: int + :param columns: Specifies the number of columns to use to divide the bounding box area into a + grid. The number of vertices (rows x columns) in the grid should be less than 2,000. + :type columns: int + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ElevationResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.ElevationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ElevationResult"] + 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_data_for_bounding_box.metadata['url'] # type: ignore + path_format_arguments = { + '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['bounds'] = self._serialize.query("bounds", bounds, '[float]', div=',') + query_parameters['rows'] = self._serialize.query("rows", rows, 'int', maximum=1000, minimum=2) + query_parameters['columns'] = self._serialize.query("columns", columns, 'int', maximum=1000, minimum=2) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ElevationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_for_bounding_box.metadata = {'url': '/elevation/lattice/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-elevation/azure/maps/elevation/py.typed b/sdk/maps/azure-maps-elevation/azure/maps/elevation/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-elevation/sdk_packaging.toml b/sdk/maps/azure-maps-elevation/sdk_packaging.toml new file mode 100644 index 000000000000..8c222a12659f --- /dev/null +++ b/sdk/maps/azure-maps-elevation/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-elevation" +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-elevation/setup.cfg b/sdk/maps/azure-maps-elevation/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-elevation/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-elevation/setup.py b/sdk/maps/azure-maps-elevation/setup.py new file mode 100644 index 000000000000..3f30bbfc90e9 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/setup.py @@ -0,0 +1,90 @@ +#!/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-elevation" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-geolocation/CHANGELOG.md b/sdk/maps/azure-maps-geolocation/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-geolocation/LICENSE.txt b/sdk/maps/azure-maps-geolocation/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-geolocation/MANIFEST.in b/sdk/maps/azure-maps-geolocation/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-geolocation/README.md b/sdk/maps/azure-maps-geolocation/README.md new file mode 100644 index 000000000000..1e2c4158ad4a --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/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.6+. +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-geolocation%2FREADME.png) diff --git a/sdk/maps/azure-maps-geolocation/_meta.json b/sdk/maps/azure-maps-geolocation/_meta.json new file mode 100644 index 000000000000..0a942925b43f --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Geolocation/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/Geolocation/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-geolocation/azure/__init__.py b/sdk/maps/azure-maps-geolocation/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/__init__.py b/sdk/maps/azure-maps-geolocation/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/__init__.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/__init__.py new file mode 100644 index 000000000000..830d400baca4 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/__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 ._geolocation_client import GeolocationClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['GeolocationClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_configuration.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_configuration.py new file mode 100644 index 000000000000..3dae55301f2f --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class GeolocationClientConfiguration(Configuration): + """Configuration for GeolocationClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(GeolocationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-geolocation/{}'.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-geolocation/azure/maps/geolocation/_geolocation_client.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_geolocation_client.py new file mode 100644 index 000000000000..5131bc5fc4ea --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_geolocation_client.py @@ -0,0 +1,85 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import GeolocationClientConfiguration +from .operations import GeolocationOperations +from . import models + + +class GeolocationClient(object): + """Azure Maps Geolocation REST APIs. + + :ivar geolocation: GeolocationOperations operations + :vartype geolocation: azure.maps.geolocation.operations.GeolocationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = GeolocationClientConfiguration(credential, client_id, **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.geolocation = GeolocationOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> GeolocationClient + 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-geolocation/azure/maps/geolocation/_metadata.json b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_metadata.json new file mode 100644 index 000000000000..41baed9b3655 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "GeolocationClient", + "filename": "_geolocation_client", + "description": "Azure Maps Geolocation REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"GeolocationClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"GeolocationClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "geolocation": "GeolocationOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_version.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/__init__.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/__init__.py new file mode 100644 index 000000000000..5c1605c3c8f8 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/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 ._geolocation_client import GeolocationClient +__all__ = ['GeolocationClient'] diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_configuration.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_configuration.py new file mode 100644 index 000000000000..95f9a42d4cd0 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 GeolocationClientConfiguration(Configuration): + """Configuration for GeolocationClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(GeolocationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-geolocation/{}'.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-geolocation/azure/maps/geolocation/aio/_geolocation_client.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_geolocation_client.py new file mode 100644 index 000000000000..55d9b7be9d17 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_geolocation_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 GeolocationClientConfiguration +from .operations import GeolocationOperations +from .. import models + + +class GeolocationClient(object): + """Azure Maps Geolocation REST APIs. + + :ivar geolocation: GeolocationOperations operations + :vartype geolocation: azure.maps.geolocation.aio.operations.GeolocationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = GeolocationClientConfiguration(credential, client_id, **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.geolocation = GeolocationOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "GeolocationClient": + 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-geolocation/azure/maps/geolocation/aio/operations/__init__.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/__init__.py new file mode 100644 index 000000000000..085952ed9f5a --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._geolocation_operations import GeolocationOperations + +__all__ = [ + 'GeolocationOperations', +] diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/_geolocation_operations.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/_geolocation_operations.py new file mode 100644 index 000000000000..5b18c7c9fa20 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/_geolocation_operations.py @@ -0,0 +1,104 @@ +# 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 GeolocationOperations: + """GeolocationOperations 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.geolocation.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_location( + self, + ip_address: str, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.IpAddressToLocationResult": + """**Applies to**\ : S0 and S1 pricing tiers. + + This service will return the ISO country code for the provided IP address. Developers can use + this information to block or alter certain content based on geographical locations where the + application is being viewed from. + + :param ip_address: The IP address. Both IPv4 and IPv6 are allowed. + :type ip_address: str + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.geolocation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAddressToLocationResult, or the result of cls(response) + :rtype: ~azure.maps.geolocation.models.IpAddressToLocationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpAddressToLocationResult"] + 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_location.metadata['url'] # type: ignore + path_format_arguments = { + '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['ip'] = self._serialize.query("ip_address", ip_address, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('IpAddressToLocationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_location.metadata = {'url': '/geolocation/ip/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/__init__.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/__init__.py new file mode 100644 index 000000000000..2360da81c778 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/__init__.py @@ -0,0 +1,33 @@ +# 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 CountryRegion + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import IpAddressToLocationResult +except (SyntaxError, ImportError): + from ._models import CountryRegion # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import IpAddressToLocationResult # type: ignore + +from ._geolocation_client_enums import ( + JsonFormat, +) + +__all__ = [ + 'CountryRegion', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'IpAddressToLocationResult', + 'JsonFormat', +] diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_geolocation_client_enums.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_geolocation_client_enums.py new file mode 100644 index 000000000000..749ad50afe35 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_geolocation_client_enums.py @@ -0,0 +1,33 @@ +# 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 JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models.py new file mode 100644 index 000000000000..f457b728ca00 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models.py @@ -0,0 +1,161 @@ +# 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 CountryRegion(msrest.serialization.Model): + """The object containing the country/region information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar iso_code: The IP Address's 2-character code `(ISO 3166-1) + `_ of the country or region. Please note, IP + address in ranges reserved for special purpose will return Null for country/region. + :vartype iso_code: str + """ + + _validation = { + 'iso_code': {'readonly': True}, + } + + _attribute_map = { + 'iso_code': {'key': 'isoCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CountryRegion, self).__init__(**kwargs) + self.iso_code = None + + +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.geolocation.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.geolocation.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.geolocation.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 IpAddressToLocationResult(msrest.serialization.Model): + """This object is returned from a successful call to IP Address to country/region API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar country_region: The object containing the country/region information. + :vartype country_region: ~azure.maps.geolocation.models.CountryRegion + :ivar ip_address: The IP Address of the request. + :vartype ip_address: str + """ + + _validation = { + 'country_region': {'readonly': True}, + 'ip_address': {'readonly': True}, + } + + _attribute_map = { + 'country_region': {'key': 'countryRegion', 'type': 'CountryRegion'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpAddressToLocationResult, self).__init__(**kwargs) + self.country_region = None + self.ip_address = None diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models_py3.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models_py3.py new file mode 100644 index 000000000000..57b37aefa462 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models_py3.py @@ -0,0 +1,165 @@ +# 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 Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CountryRegion(msrest.serialization.Model): + """The object containing the country/region information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar iso_code: The IP Address's 2-character code `(ISO 3166-1) + `_ of the country or region. Please note, IP + address in ranges reserved for special purpose will return Null for country/region. + :vartype iso_code: str + """ + + _validation = { + 'iso_code': {'readonly': True}, + } + + _attribute_map = { + 'iso_code': {'key': 'isoCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CountryRegion, self).__init__(**kwargs) + self.iso_code = None + + +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.geolocation.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.geolocation.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.geolocation.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 IpAddressToLocationResult(msrest.serialization.Model): + """This object is returned from a successful call to IP Address to country/region API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar country_region: The object containing the country/region information. + :vartype country_region: ~azure.maps.geolocation.models.CountryRegion + :ivar ip_address: The IP Address of the request. + :vartype ip_address: str + """ + + _validation = { + 'country_region': {'readonly': True}, + 'ip_address': {'readonly': True}, + } + + _attribute_map = { + 'country_region': {'key': 'countryRegion', 'type': 'CountryRegion'}, + 'ip_address': {'key': 'ipAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IpAddressToLocationResult, self).__init__(**kwargs) + self.country_region = None + self.ip_address = None diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/__init__.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/__init__.py new file mode 100644 index 000000000000..085952ed9f5a --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._geolocation_operations import GeolocationOperations + +__all__ = [ + 'GeolocationOperations', +] diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/_geolocation_operations.py b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/_geolocation_operations.py new file mode 100644 index 000000000000..6d13fde5505e --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/_geolocation_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 GeolocationOperations(object): + """GeolocationOperations 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.geolocation.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_location( + self, + ip_address, # type: str + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.IpAddressToLocationResult" + """**Applies to**\ : S0 and S1 pricing tiers. + + This service will return the ISO country code for the provided IP address. Developers can use + this information to block or alter certain content based on geographical locations where the + application is being viewed from. + + :param ip_address: The IP address. Both IPv4 and IPv6 are allowed. + :type ip_address: str + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.geolocation.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpAddressToLocationResult, or the result of cls(response) + :rtype: ~azure.maps.geolocation.models.IpAddressToLocationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpAddressToLocationResult"] + 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_location.metadata['url'] # type: ignore + path_format_arguments = { + '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['ip'] = self._serialize.query("ip_address", ip_address, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('IpAddressToLocationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_location.metadata = {'url': '/geolocation/ip/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/py.typed b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-geolocation/sdk_packaging.toml b/sdk/maps/azure-maps-geolocation/sdk_packaging.toml new file mode 100644 index 000000000000..683b6ff1cfd5 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-geolocation" +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-geolocation/setup.cfg b/sdk/maps/azure-maps-geolocation/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-geolocation/setup.py b/sdk/maps/azure-maps-geolocation/setup.py new file mode 100644 index 000000000000..f9b681943dc3 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/setup.py @@ -0,0 +1,90 @@ +#!/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-geolocation" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-render/CHANGELOG.md b/sdk/maps/azure-maps-render/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-render/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-render/LICENSE.txt b/sdk/maps/azure-maps-render/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-render/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-render/MANIFEST.in b/sdk/maps/azure-maps-render/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-render/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-render/README.md b/sdk/maps/azure-maps-render/README.md new file mode 100644 index 000000000000..22991385eec9 --- /dev/null +++ b/sdk/maps/azure-maps-render/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.6+. +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-render%2FREADME.png) diff --git a/sdk/maps/azure-maps-render/_meta.json b/sdk/maps/azure-maps-render/_meta.json new file mode 100644 index 000000000000..927584846800 --- /dev/null +++ b/sdk/maps/azure-maps-render/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Render/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/Render/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-render/azure/__init__.py b/sdk/maps/azure-maps-render/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-render/azure/maps/__init__.py b/sdk/maps/azure-maps-render/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-render/azure/maps/render/__init__.py b/sdk/maps/azure-maps-render/azure/maps/render/__init__.py new file mode 100644 index 000000000000..a0b70a50399c --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/__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 ._render_client import RenderClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['RenderClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-render/azure/maps/render/_configuration.py b/sdk/maps/azure-maps-render/azure/maps/render/_configuration.py new file mode 100644 index 000000000000..07b4fe48d838 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class RenderClientConfiguration(Configuration): + """Configuration for RenderClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(RenderClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "2.1" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-render/{}'.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-render/azure/maps/render/_metadata.json b/sdk/maps/azure-maps-render/azure/maps/render/_metadata.json new file mode 100644 index 000000000000..5d78bacba3de --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "2.1", + "total_api_version_list": ["2.1"], + "client": { + "name": "RenderClient", + "filename": "_render_client", + "description": "Azure Maps Render REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"RenderClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"RenderClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "render_v2": "RenderV2Operations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-render/azure/maps/render/_render_client.py b/sdk/maps/azure-maps-render/azure/maps/render/_render_client.py new file mode 100644 index 000000000000..52671e478390 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_render_client.py @@ -0,0 +1,85 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import RenderClientConfiguration +from .operations import RenderV2Operations +from . import models + + +class RenderClient(object): + """Azure Maps Render REST APIs. + + :ivar render_v2: RenderV2Operations operations + :vartype render_v2: azure.maps.render.operations.RenderV2Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = RenderClientConfiguration(credential, client_id, **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.render_v2 = RenderV2Operations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> RenderClient + 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-render/azure/maps/render/_version.py b/sdk/maps/azure-maps-render/azure/maps/render/_version.py new file mode 100644 index 000000000000..d6cbe1e7868a --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2.1-preview" diff --git a/sdk/maps/azure-maps-render/azure/maps/render/aio/__init__.py b/sdk/maps/azure-maps-render/azure/maps/render/aio/__init__.py new file mode 100644 index 000000000000..e7d8ef7f38d6 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/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 ._render_client import RenderClient +__all__ = ['RenderClient'] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/aio/_configuration.py b/sdk/maps/azure-maps-render/azure/maps/render/aio/_configuration.py new file mode 100644 index 000000000000..cd4a9439ae24 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 RenderClientConfiguration(Configuration): + """Configuration for RenderClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(RenderClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "2.1" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-render/{}'.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-render/azure/maps/render/aio/_render_client.py b/sdk/maps/azure-maps-render/azure/maps/render/aio/_render_client.py new file mode 100644 index 000000000000..bd87c6948fd3 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/_render_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 RenderClientConfiguration +from .operations import RenderV2Operations +from .. import models + + +class RenderClient(object): + """Azure Maps Render REST APIs. + + :ivar render_v2: RenderV2Operations operations + :vartype render_v2: azure.maps.render.aio.operations.RenderV2Operations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = RenderClientConfiguration(credential, client_id, **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.render_v2 = RenderV2Operations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "RenderClient": + 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-render/azure/maps/render/aio/operations/__init__.py b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/__init__.py new file mode 100644 index 000000000000..e911395a1ca8 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._render_v2_operations import RenderV2Operations + +__all__ = [ + 'RenderV2Operations', +] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_v2_operations.py b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_v2_operations.py new file mode 100644 index 000000000000..2dca66586d28 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_v2_operations.py @@ -0,0 +1,1247 @@ +# 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, IO, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RenderV2Operations: + """RenderV2Operations 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.render.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_map_tile( + self, + tileset_id: Union[str, "_models.TilesetID"], + tile_index: "_models.TileIndex", + time_stamp: Optional[datetime.datetime] = None, + tile_size: Optional[Union[str, "_models.MapTileSize"]] = None, + language: Optional[str] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> IO: + """**Applies to**\ : S0 and S1 pricing tiers. + + The Get Map Tiles API allows users to request map tiles in vector or raster formats typically + to be integrated into a map control or SDK. Some example tiles that can be requested are Azure + Maps road tiles, real-time Weather Radar tiles or the map tiles created using `Azure Maps + Creator `_. By default, Azure Maps uses vector tiles for its web map + control (Web SDK) and Android SDK. + + :param tileset_id: A tileset is a collection of raster or vector data broken up into a uniform + grid of square tiles at preset zoom levels. Every tileset has a **tilesetId** to use when + making requests. The **tilesetId** for tilesets created using `Azure Maps Creator + `_ are generated through the `Tileset Create API + `_. The ready-to-use tilesets supplied + by Azure Maps are listed below. For example, microsoft.base. + :type tileset_id: str or ~azure.maps.render.models.TilesetID + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.render.models.TileIndex + :param time_stamp: The desired date and time of the requested tile. This parameter must be + specified in the standard date-time format (e.g. 2019-11-14T16:03:00-08:00), as defined by `ISO + 8601 `_. This parameter is only supported when + tilesetId parameter is set to one of the values below. + + + * microsoft.weather.infrared.main: We provide tiles up to 3 hours in the past. Tiles are + available in 10-minute intervals. We round the timeStamp value to the nearest 10-minute time + frame. + * microsoft.weather.radar.main: We provide tiles up to 1.5 hours in the past and up to 2 hours + in the future. Tiles are available in 5-minute intervals. We round the timeStamp value to the + nearest 5-minute time frame. + :type time_stamp: ~datetime.datetime + :param tile_size: The size of the returned map tile in pixels. + :type tile_size: str or ~azure.maps.render.models.MapTileSize + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.render.models.LocalizedMapView + :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', {})) + + _z = None + _x = None + _y = None + if tile_index is not None: + _z = tile_index.z + _x = tile_index.x + _y = tile_index.y + api_version = "2.1" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_map_tile.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + query_parameters['zoom'] = self._serialize.query("z", _z, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'iso-8601') + if tile_size is not None: + query_parameters['tileSize'] = self._serialize.query("tile_size", tile_size, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_map_tile.metadata = {'url': '/map/tile'} # type: ignore + + async def get_map_tileset( + self, + tileset_id: Union[str, "_models.TilesetID"], + **kwargs: Any + ) -> "_models.MapTileset": + """**Applies to**\ : S0 and S1 pricing tiers. + + The Get Map Tileset API allows users to request metadata for a tileset. + + :param tileset_id: A tileset is a collection of raster or vector data broken up into a uniform + grid of square tiles at preset zoom levels. Every tileset has a **tilesetId** to use when + making requests. The **tilesetId** for tilesets created using `Azure Maps Creator + `_ are generated through the `Tileset Create API + `_. The ready-to-use tilesets supplied + by Azure Maps are listed below. For example, microsoft.base. + :type tileset_id: str or ~azure.maps.render.models.TilesetID + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapTileset, or the result of cls(response) + :rtype: ~azure.maps.render.models.MapTileset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapTileset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_map_tileset.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MapTileset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_map_tileset.metadata = {'url': '/map/tileset'} # type: ignore + + async def get_map_attribution( + self, + tileset_id: Union[str, "_models.TilesetID"], + zoom: int, + bounds: List[float], + **kwargs: Any + ) -> "_models.MapAttribution": + """**Applies to**\ : S0 and S1 pricing tiers. + + The Get Map Attribution API allows users to request map copyright attribution information for a + section of a tileset. + + :param tileset_id: A tileset is a collection of raster or vector data broken up into a uniform + grid of square tiles at preset zoom levels. Every tileset has a **tilesetId** to use when + making requests. The **tilesetId** for tilesets created using `Azure Maps Creator + `_ are generated through the `Tileset Create API + `_. The ready-to-use tilesets supplied + by Azure Maps are listed below. For example, microsoft.base. + :type tileset_id: str or ~azure.maps.render.models.TilesetID + :param zoom: Zoom level for the desired map attribution. + :type zoom: int + :param bounds: The string that represents the rectangular area of a bounding box. The bounds + parameter is defined by the 4 bounding box coordinates, with WGS84 longitude and latitude of + the southwest corner followed by WGS84 longitude and latitude of the northeast corner. The + string is presented in the following format: ``[SouthwestCorner_Longitude, + SouthwestCorner_Latitude, NortheastCorner_Longitude, NortheastCorner_Latitude]``. + :type bounds: list[float] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapAttribution, or the result of cls(response) + :rtype: ~azure.maps.render.models.MapAttribution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapAttribution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_map_attribution.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['bounds'] = self._serialize.query("bounds", bounds, '[float]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MapAttribution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_map_attribution.metadata = {'url': '/map/attribution'} # type: ignore + + async def get_map_state_tile( + self, + stateset_id: str, + tile_index: "_models.TileIndex", + **kwargs: Any + ) -> IO: + """**Applies to**\ : S0 and S1 pricing tiers. + + Fetches state tiles in vector format typically to be integrated into indoor maps module of map + control or SDK. The map control will call this API after user turns on dynamic styling (see + `Zoom Levels and Tile Grid + `_\ + ). + + :param stateset_id: The stateset id. + :type stateset_id: str + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.render.models.TileIndex + :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', {})) + + _z = None + _x = None + _y = None + if tile_index is not None: + _z = tile_index.z + _x = tile_index.x + _y = tile_index.y + api_version = "2.1" + accept = "application/vnd.mapbox-vector-tile, application/json" + + # Construct URL + url = self.get_map_state_tile.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['zoom'] = self._serialize.query("z", _z, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + query_parameters['statesetId'] = self._serialize.query("stateset_id", stateset_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_map_state_tile.metadata = {'url': '/map/statetile'} # type: ignore + + async def get_copyright_caption( + self, + format: Union[str, "_models.ResponseFormat"] = "json", + **kwargs: Any + ) -> "_models.CopyrightCaption": + """**Applies to**\ : S0 and S1 pricing tiers. + + Copyrights API is designed to serve copyright information for Render Tile + service. In addition to basic copyright for the whole map, API is serving + specific groups of copyrights for some countries. + + As an alternative to copyrights for map request, one can receive captions + for displaying the map provider information on the map. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CopyrightCaption, or the result of cls(response) + :rtype: ~azure.maps.render.models.CopyrightCaption + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CopyrightCaption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_caption.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('CopyrightCaption', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_caption.metadata = {'url': '/map/copyright/caption/{format}'} # type: ignore + + async def get_map_static_image( + self, + format: Union[str, "_models.RasterTileFormat"] = "png", + layer: Optional[Union[str, "_models.StaticMapLayer"]] = None, + style: Optional[Union[str, "_models.MapImageStyle"]] = None, + zoom: Optional[int] = None, + center: Optional[List[float]] = None, + bounding_box: Optional[List[float]] = None, + height: Optional[int] = None, + width: Optional[int] = None, + language: Optional[str] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + pins: Optional[List[str]] = None, + path: Optional[List[str]] = None, + **kwargs: Any + ) -> IO: + """**Applies to**\ : S0 and S1 pricing tiers. + + The static image service renders a user-defined, rectangular image containing a map section + using a zoom level from 0 to 20. The static image service renders a user-defined, rectangular + image containing a map section using a zoom level from 0 to 20. The supported resolution range + for the map image is from 1x1 to 8192x8192. If you are deciding when to use the static image + service over the map tile service, you may want to consider how you would like to interact with + the rendered map. If the map contents will be relatively unchanging, a static map is a good + choice. If you want to support a lot of zooming, panning and changing of the map content, the + map tile service would be a better choice. + + Service also provides Image Composition functionality to get a static image back with + additional data like; pushpins and geometry overlays with following S0 and S1 capabilities. + + In S0 you can: + + + * Render up to 5 pushpins specified in the request + * Provide one custom image for the pins referenced in the request + * Add labels to the pushpins + + In S1 you can: + + + * Render pushpins through `Azure Maps Data Service `_ + * Specify multiple pushpin styles + * Render circle, polyline and polygon geometry types. + * Render of supported GeoJSON geometry types uploaded through `Azure Maps Data Service + `_ + + Please see `How-to-Guide `_ for detailed + examples. + + *Note* : Either **center** or **bbox** parameter must be supplied to the + API. + :code:`
`:code:`
` + The supported Lat and Lon ranges when using the **bbox** parameter, are as follows: + :code:`
`:code:`
` + + .. list-table:: + :header-rows: 1 + + * - Zoom Level + - Max Lon Range + - Max Lat Range + * - 0 + - 360.0 + - 170.0 + * - 1 + - 360.0 + - 170.0 + * - 2 + - 360.0 + - 170.0 + * - 3 + - 360.0 + - 170.0 + * - 4 + - 360.0 + - 170.0 + * - 5 + - 180.0 + - 85.0 + * - 6 + - 90.0 + - 42.5 + * - 7 + - 45.0 + - 21.25 + * - 8 + - 22.5 + - 10.625 + * - 9 + - 11.25 + - 5.3125 + * - 10 + - 5.625 + - 2.62625 + * - 11 + - 2.8125 + - 1.328125 + * - 12 + - 1.40625 + - 0.6640625 + * - 13 + - 0.703125 + - 0.33203125 + * - 14 + - 0.3515625 + - 0.166015625 + * - 15 + - 0.17578125 + - 0.0830078125 + * - 16 + - 0.087890625 + - 0.0415039063 + * - 17 + - 0.0439453125 + - 0.0207519531 + * - 18 + - 0.0219726563 + - 0.0103759766 + * - 19 + - 0.0109863281 + - 0.0051879883 + * - 20 + - 0.0054931641 + - 0.0025939941. + + :param format: Desired format of the response. Possible value: png. + :type format: str or ~azure.maps.render.models.RasterTileFormat + :param layer: Map layer requested. If layer is set to labels or hybrid, the format should be + png. + :type layer: str or ~azure.maps.render.models.StaticMapLayer + :param style: Map style to be returned. Possible values are main and dark. + :type style: str or ~azure.maps.render.models.MapImageStyle + :param zoom: Desired zoom level of the map. Zoom value must be in the range: 0-20 (inclusive). + Default value is 12.:code:`
`:code:`
`Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param center: Coordinates of the center point. Format: 'lon,lat'. Projection used + + + * EPSG:3857. Longitude range: -180 to 180. Latitude range: -85 to 85. + + Note: Either center or bbox are required parameters. They are + mutually exclusive. + :type center: list[float] + :param bounding_box: Bounding box. Projection used - EPSG:3857. Format : 'minLon, minLat, + maxLon, maxLat'. + + Note: Either bbox or center are required + parameters. They are mutually exclusive. It shouldn’t be used with + height or width. + + The maximum allowed ranges for Lat and Lon are defined for each zoom level + in the table at the top of this page. + :type bounding_box: list[float] + :param height: Height of the resulting image in pixels. Range is 1 to 8192. Default + is 512. It shouldn’t be used with bbox. + :type height: int + :param width: Width of the resulting image in pixels. Range is 1 to 8192. Default is 512. It + shouldn’t be used with bbox. + :type width: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.render.models.LocalizedMapView + :param pins: Pushpin style and instances. Use this parameter to optionally add pushpins to the + image. + The pushpin style describes the appearance of the pushpins, and the instances specify + the coordinates of the pushpins and optional labels for each pin. (Be sure to properly + URL-encode values of this + parameter since it will contain reserved characters such as pipes and punctuation.) + + The Azure Maps account S0 SKU only supports a single instance of the pins parameter. Other + SKUs + allow multiple instances of the pins parameter to specify multiple pin styles. + + To render a pushpin at latitude 45°N and longitude 122°W using the default built-in pushpin + style, add the + querystring parameter + + ``pins=default||-122 45`` + + Note that the longitude comes before the latitude. + After URL encoding this will look like + + ``pins=default%7C%7C-122+45`` + + All of the examples here show the pins + parameter without URL encoding, for clarity. + + To render a pin at multiple locations, separate each location with a pipe character. For + example, use + + ``pins=default||-122 45|-119.5 43.2|-121.67 47.12`` + + The S0 Azure Maps account SKU only allows five pushpins. Other account SKUs do not have this + limitation. + + Style Modifiers + ^^^^^^^^^^^^^^^ + + You can modify the appearance of the pins by adding style modifiers. These are added after the + style but before + the locations and labels. Style modifiers each have a two-letter name. These abbreviated names + are used to help + reduce the length of the URL. + + To change the color of the pushpin, use the 'co' style modifier and specify the color using + the HTML/CSS RGB color + format which is a six-digit hexadecimal number (the three-digit form is not supported). For + example, to use + a deep pink color which you would specify as #FF1493 in CSS, use + + ``pins=default|coFF1493||-122 45`` + + Pushpin Labels + ^^^^^^^^^^^^^^ + + To add a label to the pins, put the label in single quotes just before the coordinates. For + example, to label + three pins with the values '1', '2', and '3', use + + ``pins=default||'1'-122 45|'2'-119.5 43.2|'3'-121.67 47.12`` + + There is a built in pushpin style called 'none' that does not display a pushpin image. You can + use this if + you want to display labels without any pin image. For example, + + ``pins=none||'A'-122 45|'B'-119.5 43.2`` + + To change the color of the pushpin labels, use the 'lc' label color style modifier. For + example, to use pink + pushpins with black labels, use + + ``pins=default|coFF1493|lc000000||-122 45`` + + To change the size of the labels, use the 'ls' label size style modifier. The label size + represents the approximate + height of the label text in pixels. For example, to increase the label size to 12, use + + ``pins=default|ls12||'A'-122 45|'B'-119 43`` + + The labels are centered at the pushpin 'label anchor.' The anchor location is predefined for + built-in pushpins and + is at the top center of custom pushpins (see below). To override the label anchor, using the + 'la' style modifier + and provide X and Y pixel coordinates for the anchor. These coordinates are relative to the + top left corner of the + pushpin image. Positive X values move the anchor to the right, and positive Y values move the + anchor down. For example, + to position the label anchor 10 pixels right and 4 pixels above the top left corner of the + pushpin image, + use + + ``pins=default|la10 -4||'A'-122 45|'B'-119 43`` + + Custom Pushpins + ^^^^^^^^^^^^^^^ + + To use a custom pushpin image, use the word 'custom' as the pin style name, and then specify a + URL after the + location and label information. Use two pipe characters to indicate that you're done + specifying locations and are + starting the URL. For example, + + ``pins=custom||-122 45||http://contoso.com/pushpins/red.png`` + + After URL encoding, this would look like + + ``pins=custom%7C%7C-122+45%7C%7Chttp%3A%2F%2Fcontoso.com%2Fpushpins%2Fred.png`` + + By default, custom pushpin images are drawn centered at the pin coordinates. This usually + isn't ideal as it obscures + the location that you're trying to highlight. To override the anchor location of the pin + image, use the 'an' + style modifier. This uses the same format as the 'la' label anchor style modifier. For + example, if your custom + pin image has the tip of the pin at the top left corner of the image, you can set the anchor + to that spot by + using + + ``pins=custom|an0 0||-122 45||http://contoso.com/pushpins/red.png`` + + Note: If you use the 'co' color modifier with a custom pushpin image, the specified color will + replace the RGB + channels of the pixels in the image but will leave the alpha (opacity) channel unchanged. This + would usually + only be done with a solid-color custom image. + + Getting Pushpins from Azure Maps Data Storage + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + For all Azure Maps account SKUs other than S0, + the pushpin location information can be obtained from Azure Maps Data Storage. After uploading + a GeoJSON document containing pin locations, the Data Storage service returns a Unique Data ID + (UDID) that you can use + to reference the data in the pins parameter. + + To use the point geometry from an uploaded GeoJSON document as the pin locations, specify the + UDID in the locations + section of the pins parameter. For example, + + ``pins=default||udid-29dc105a-dee7-409f-a3f9-22b066ae4713`` + + Note that + only point and multipoint geometry, points and multipoints from geometry collections, and + point geometry from features + will be used. Linestring and polygon geometry will be ignored. If the point comes from a + feature and the feature + has a string property called "label", the value of that property will be used as the label for + the pin. + + You can mix pin locations from Data Storage and pin locations specified in the pins parameter. + Any of the pipe-delimited + pin locations can be a longitude and latitude or a UDID. For example, + + ``pins=default||-122 45|udid-29dc105a-dee7-409f-a3f9-22b066ae4713|-119 43`` + + Scale, Rotation, and Opacity + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + You can make pushpins and their labels larger or smaller by using the 'sc' scale style + modifier. This is a + value greater than zero. A value of 1 is the standard scale. Values larger than 1 will make + the pins larger, and + values smaller than 1 will make them smaller. For example, to draw the pushpins 50% larger + than normal, use + + ``pins=default|sc1.5||-122 45`` + + You can rotate pushpins and their labels by using the 'ro' rotation style modifier. This is a + number of degrees + of clockwise rotation. Use a negative number to rotate counter-clockwise. For example, to + rotate the pushpins + 90 degrees clockwise and double their size, use + + ``pins=default|ro90|sc2||-122 45`` + + You can make pushpins and their labels partially transparent by specifying the 'al' alpha + style modifier. + This is a number between 0 and 1 indicating the opacity of the pushpins. Zero makes them + completely transparent + (and not visible) and 1 makes them completely opaque (which is the default). For example, to + make pushpins + and their labels only 67% opaque, use + + ``pins=default|al.67||-122 45`` + + Style Modifier Summary + ^^^^^^^^^^^^^^^^^^^^^^ + + .. list-table:: + :header-rows: 1 + + * - Modifier + - Description + - Range + * - al + - Alpha (opacity) + - 0 to 1 + * - an + - Pin anchor + - * + * - co + - Pin color + - 000000 to FFFFFF + * - la + - Label anchor + - * + * - lc + - Label color + - 000000 to FFFFFF + * - ls + - Label size + - Greater than 0 + * - ro + - Rotation + - -360 to 360 + * - sc + - Scale + - Greater than 0 + + + + * X and Y coordinates can be anywhere within pin image or a margin around it. + The margin size is the minimum of the pin width and height. + :type pins: list[str] + :param path: Path style and locations. Use this parameter to optionally add lines, polygons or + circles to the image. + The path style describes the appearance of the line and fill. (Be sure to properly URL-encode + values of this + parameter since it will contain reserved characters such as pipes and punctuation.) + + Path parameter is supported in Azure Maps account SKU starting with S1. Multiple instances of + the path parameter + allow to specify multiple geometries with their styles. Number of parameters per request is + limited to 10 and + number of locations is limited to 100 per path. + + To render a circle with radius 100 meters and center point at latitude 45°N and longitude + 122°W using the default style, add the + querystring parameter + + ``path=ra100||-122 45`` + + Note that the longitude comes before the latitude. + After URL encoding this will look like + + ``path=ra100%7C%7C-122+45`` + + All of the examples here show the path parameter without URL encoding, for clarity. + + To render a line, separate each location with a pipe character. For example, use + + ``path=||-122 45|-119.5 43.2|-121.67 47.12`` + + To render a polygon, last location must be equal to the start location. For example, use + + ``path=||-122 45|-119.5 43.2|-121.67 47.12|-122 45`` + + Longitude and latitude values for locations of lines and polygons can be in the range from + -360 to 360 to allow for rendering of geometries crossing the anti-meridian. + + Style Modifiers + ^^^^^^^^^^^^^^^ + + You can modify the appearance of the path by adding style modifiers. These are added before + the locations. + Style modifiers each have a two-letter name. These abbreviated names are used to help reduce + the length + of the URL. + + To change the color of the outline, use the 'lc' style modifier and specify the color using + the HTML/CSS RGB color + format which is a six-digit hexadecimal number (the three-digit form is not supported). For + example, to use + a deep pink color which you would specify as #FF1493 in CSS, use + + ``path=lcFF1493||-122 45|-119.5 43.2`` + + Multiple style modifiers may be combined together to create a more complex visual style. + + ``lc0000FF|lw3|la0.60|fa0.50||-122.2 47.6|-122.2 47.7|-122.3 47.7|-122.3 47.6|-122.2 47.6`` + + Getting Path locations from Azure Maps Data Storage + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + For all Azure Maps account SKUs other than S0, the path location information can be obtained + from Azure Maps Data Storage. + After uploading a GeoJSON document containing path locations, the Data Storage service returns + a Unique Data ID (UDID) that you can use + to reference the data in the path parameter. + + To use the point geometry from an uploaded GeoJSON document as the path locations, specify the + UDID in the locations + section of the path parameter. For example, + + ``path=||udid-29dc105a-dee7-409f-a3f9-22b066ae4713`` + + Note the it is not allowed to mix path locations from Data Storage with locations specified in + the path parameter. + + Style Modifier Summary + ^^^^^^^^^^^^^^^^^^^^^^ + + .. list-table:: + :header-rows: 1 + + * - Modifier + - Description + - Range + * - lc + - Line color + - 000000 to FFFFFF + * - fc + - Fill color + - 000000 to FFFFFF + * - la + - Line alpha (opacity) + - 0 to 1 + * - fa + - Fill alpha (opacity) + - 0 to 1 + * - lw + - Line width + - Greater than 0 + * - ra + - Circle radius (meters) + - Greater than 0. + :type path: list[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.1" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_map_static_image.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if layer is not None: + query_parameters['layer'] = self._serialize.query("layer", layer, 'str') + if style is not None: + query_parameters['style'] = self._serialize.query("style", style, 'str') + if zoom is not None: + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int', maximum=20, minimum=0) + if center is not None: + query_parameters['center'] = self._serialize.query("center", center, '[float]', div=',') + if bounding_box is not None: + query_parameters['bbox'] = self._serialize.query("bounding_box", bounding_box, '[float]', div=',') + if height is not None: + query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=8192, minimum=1) + if width is not None: + query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=8192, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if pins is not None: + query_parameters['pins'] = [self._serialize.query("pins", q, 'str') if q is not None else '' for q in pins] + if path is not None: + query_parameters['path'] = [self._serialize.query("path", q, 'str') if q is not None else '' for q in path] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_map_static_image.metadata = {'url': '/map/static/{format}'} # type: ignore + + async def get_copyright_from_bounding_box( + self, + bounding_box: "_models.BoundingBox", + format: Union[str, "_models.ResponseFormat"] = "json", + include_text: Optional[Union[str, "_models.IncludeText"]] = None, + **kwargs: Any + ) -> "_models.Copyright": + """**Applies to**\ : S0 and S1 pricing tiers. + + Returns copyright information for a given bounding box. Bounding-box requests should specify + the minimum and maximum longitude and latitude (EPSG-3857) coordinates. + + :param bounding_box: Parameter group. + :type bounding_box: ~azure.maps.render.models.BoundingBox + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :param include_text: Yes/no value to exclude textual data from response. Only images and + country names will be in response. + :type include_text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Copyright, or the result of cls(response) + :rtype: ~azure.maps.render.models.Copyright + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Copyright"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _south_west = None + _north_east = None + if bounding_box is not None: + _south_west = bounding_box.south_west + _north_east = bounding_box.north_east + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_from_bounding_box.metadata['url'] # type: ignore + path_format_arguments = { + '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['mincoordinates'] = self._serialize.query("south_west", _south_west, '[float]', div=',') + query_parameters['maxcoordinates'] = self._serialize.query("north_east", _north_east, '[float]', div=',') + if include_text is not None: + query_parameters['text'] = self._serialize.query("include_text", include_text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Copyright', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_from_bounding_box.metadata = {'url': '/map/copyright/bounding/{format}'} # type: ignore + + async def get_copyright_for_tile( + self, + tile_index: "_models.TileIndex", + format: Union[str, "_models.ResponseFormat"] = "json", + include_text: Optional[Union[str, "_models.IncludeText"]] = None, + **kwargs: Any + ) -> "_models.Copyright": + """**Applies to**\ : S0 and S1 pricing tiers. + + Copyrights API is designed to serve copyright information for Render Tile service. In addition + to basic copyright for the whole map, API is serving specific groups of copyrights for some + countries. + Returns the copyright information for a given tile. To obtain the copyright information for a + particular tile, the request should specify the tile's zoom level and x and y coordinates (see: + Zoom Levels and Tile Grid). + + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.render.models.TileIndex + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :param include_text: Yes/no value to exclude textual data from response. Only images and + country names will be in response. + :type include_text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Copyright, or the result of cls(response) + :rtype: ~azure.maps.render.models.Copyright + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Copyright"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _z = None + _x = None + _y = None + if tile_index is not None: + _z = tile_index.z + _x = tile_index.x + _y = tile_index.y + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_for_tile.metadata['url'] # type: ignore + path_format_arguments = { + '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['zoom'] = self._serialize.query("z", _z, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if include_text is not None: + query_parameters['text'] = self._serialize.query("include_text", include_text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Copyright', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_for_tile.metadata = {'url': '/map/copyright/tile/{format}'} # type: ignore + + async def get_copyright_for_world( + self, + format: Union[str, "_models.ResponseFormat"] = "json", + include_text: Optional[Union[str, "_models.IncludeText"]] = None, + **kwargs: Any + ) -> "_models.Copyright": + """**Applies to**\ : S0 and S1 pricing tiers. + + Copyrights API is designed to serve copyright information for Render Tile service. In addition + to basic copyright for the whole map, API is serving specific groups of copyrights for some + countries. + Returns the copyright information for the world. To obtain the default copyright information + for the whole world, do not specify a tile or bounding box. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :param include_text: Yes/no value to exclude textual data from response. Only images and + country names will be in response. + :type include_text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Copyright, or the result of cls(response) + :rtype: ~azure.maps.render.models.Copyright + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Copyright"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_for_world.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if include_text is not None: + query_parameters['text'] = self._serialize.query("include_text", include_text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Copyright', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_for_world.metadata = {'url': '/map/copyright/world/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-render/azure/maps/render/models/__init__.py b/sdk/maps/azure-maps-render/azure/maps/render/models/__init__.py new file mode 100644 index 000000000000..665c3583ee97 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/__init__.py @@ -0,0 +1,65 @@ +# 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 BoundingBox + from ._models_py3 import Copyright + from ._models_py3 import CopyrightCaption + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import MapAttribution + from ._models_py3 import MapTileset + from ._models_py3 import RegionCopyrights + from ._models_py3 import RegionCopyrightsCountry + from ._models_py3 import TileIndex +except (SyntaxError, ImportError): + from ._models import BoundingBox # type: ignore + from ._models import Copyright # type: ignore + from ._models import CopyrightCaption # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import MapAttribution # type: ignore + from ._models import MapTileset # type: ignore + from ._models import RegionCopyrights # type: ignore + from ._models import RegionCopyrightsCountry # type: ignore + from ._models import TileIndex # type: ignore + +from ._render_client_enums import ( + IncludeText, + LocalizedMapView, + MapImageStyle, + MapTileSize, + RasterTileFormat, + ResponseFormat, + StaticMapLayer, + TilesetID, +) + +__all__ = [ + 'BoundingBox', + 'Copyright', + 'CopyrightCaption', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'MapAttribution', + 'MapTileset', + 'RegionCopyrights', + 'RegionCopyrightsCountry', + 'TileIndex', + 'IncludeText', + 'LocalizedMapView', + 'MapImageStyle', + 'MapTileSize', + 'RasterTileFormat', + 'ResponseFormat', + 'StaticMapLayer', + 'TilesetID', +] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/models/_models.py b/sdk/maps/azure-maps-render/azure/maps/render/models/_models.py new file mode 100644 index 000000000000..de6e91ba4b55 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/_models.py @@ -0,0 +1,426 @@ +# 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 BoundingBox(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param south_west: Required. Minimum coordinates (south-west point) of bounding box in latitude + longitude coordinate system. E.g. 52.41064,4.84228. + :type south_west: list[float] + :param north_east: Required. Maximum coordinates (north-east point) of bounding box in latitude + longitude coordinate system. E.g. 52.41064,4.84228. + :type north_east: list[float] + """ + + _validation = { + 'south_west': {'required': True}, + 'north_east': {'required': True}, + } + + _attribute_map = { + 'south_west': {'key': 'southWest', 'type': '[float]'}, + 'north_east': {'key': 'northEast', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(BoundingBox, self).__init__(**kwargs) + self.south_west = kwargs['south_west'] + self.north_east = kwargs['north_east'] + + +class Copyright(msrest.serialization.Model): + """This object is returned from a successful copyright request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar general_copyrights: General Copyrights array. + :vartype general_copyrights: list[str] + :ivar regions: Regions array. + :vartype regions: list[~azure.maps.render.models.RegionCopyrights] + """ + + _validation = { + 'format_version': {'readonly': True}, + 'general_copyrights': {'readonly': True}, + 'regions': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'general_copyrights': {'key': 'generalCopyrights', 'type': '[str]'}, + 'regions': {'key': 'regions', 'type': '[RegionCopyrights]'}, + } + + def __init__( + self, + **kwargs + ): + super(Copyright, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = None + + +class CopyrightCaption(msrest.serialization.Model): + """This object is returned from a successful copyright call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar copyrights_caption: Copyrights Caption property. + :vartype copyrights_caption: str + """ + + _validation = { + 'format_version': {'readonly': True}, + 'copyrights_caption': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'copyrights_caption': {'key': 'copyrightsCaption', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CopyrightCaption, self).__init__(**kwargs) + self.format_version = None + self.copyrights_caption = None + + +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.render.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.render.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.render.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 MapAttribution(msrest.serialization.Model): + """Copyright attribution for the requested section of a tileset. + + :param copyrights: A list of copyright strings. + :type copyrights: list[str] + """ + + _attribute_map = { + 'copyrights': {'key': 'copyrights', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapAttribution, self).__init__(**kwargs) + self.copyrights = kwargs.get('copyrights', None) + + +class MapTileset(msrest.serialization.Model): + """Metadata for a tileset in the TileJSON format. + + :param tilejson: Describes the version of the TileJSON spec that is implemented by this JSON + object. + :type tilejson: str + :param name: A name describing the tileset. The name can contain any legal character. + Implementations SHOULD NOT interpret the name as HTML. + :type name: str + :param description: Text description of the tileset. The description can contain any legal + character. Implementations SHOULD NOT interpret the description as HTML. + :type description: str + :param version: A semver.org style version number for the tiles contained within the tileset. + When changes across tiles are introduced, the minor version MUST change. + :type version: str + :param attribution: Copyright attribution to be displayed on the map. Implementations MAY + decide to treat this as HTML or literal text. For security reasons, make absolutely sure that + this field can't be abused as a vector for XSS or beacon tracking. + :type attribution: str + :param template: A mustache template to be used to format data from grids for interaction. + :type template: str + :param legend: A legend to be displayed with the map. Implementations MAY decide to treat this + as HTML or literal text. For security reasons, make absolutely sure that this field can't be + abused as a vector for XSS or beacon tracking. + :type legend: str + :param scheme: Default: "xyz". Either "xyz" or "tms". Influences the y direction of the tile + coordinates. The global-mercator (aka Spherical Mercator) profile is assumed. + :type scheme: str + :param tiles: An array of tile endpoints. If multiple endpoints are specified, clients may use + any combination of endpoints. All endpoints MUST return the same content for the same URL. The + array MUST contain at least one endpoint. + :type tiles: list[str] + :param grids: An array of interactivity endpoints. + :type grids: list[str] + :param data: An array of data files in GeoJSON format. + :type data: list[str] + :param min_zoom: The minimum zoom level. + :type min_zoom: int + :param max_zoom: The maximum zoom level. + :type max_zoom: int + :param bounds: The maximum extent of available map tiles. Bounds MUST define an area covered by + all zoom levels. The bounds are represented in WGS:84 latitude and longitude values, in the + order left, bottom, right, top. Values may be integers or floating point numbers. + :type bounds: list[float] + :param center: The default location of the tileset in the form [longitude, latitude, zoom]. The + zoom level MUST be between minzoom and maxzoom. Implementations can use this value to set the + default location. + :type center: list[float] + """ + + _validation = { + 'tilejson': {'pattern': r'\d+\.\d+\.\d+\w?[\w\d]*'}, + 'version': {'pattern': r'\d+\.\d+\.\d+\w?[\w\d]*'}, + 'min_zoom': {'maximum': 30, 'minimum': 0}, + 'max_zoom': {'maximum': 30, 'minimum': 0}, + } + + _attribute_map = { + 'tilejson': {'key': 'tilejson', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'attribution': {'key': 'attribution', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'str'}, + 'legend': {'key': 'legend', 'type': 'str'}, + 'scheme': {'key': 'scheme', 'type': 'str'}, + 'tiles': {'key': 'tiles', 'type': '[str]'}, + 'grids': {'key': 'grids', 'type': '[str]'}, + 'data': {'key': 'data', 'type': '[str]'}, + 'min_zoom': {'key': 'minzoom', 'type': 'int'}, + 'max_zoom': {'key': 'maxzoom', 'type': 'int'}, + 'bounds': {'key': 'bounds', 'type': '[float]'}, + 'center': {'key': 'center', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapTileset, self).__init__(**kwargs) + self.tilejson = kwargs.get('tilejson', None) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.version = kwargs.get('version', None) + self.attribution = kwargs.get('attribution', None) + self.template = kwargs.get('template', None) + self.legend = kwargs.get('legend', None) + self.scheme = kwargs.get('scheme', None) + self.tiles = kwargs.get('tiles', None) + self.grids = kwargs.get('grids', None) + self.data = kwargs.get('data', None) + self.min_zoom = kwargs.get('min_zoom', None) + self.max_zoom = kwargs.get('max_zoom', None) + self.bounds = kwargs.get('bounds', None) + self.center = kwargs.get('center', None) + + +class RegionCopyrights(msrest.serialization.Model): + """RegionCopyrights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar copyrights: Copyrights array. + :vartype copyrights: list[str] + :ivar country: Country property. + :vartype country: ~azure.maps.render.models.RegionCopyrightsCountry + """ + + _validation = { + 'copyrights': {'readonly': True}, + 'country': {'readonly': True}, + } + + _attribute_map = { + 'copyrights': {'key': 'copyrights', 'type': '[str]'}, + 'country': {'key': 'country', 'type': 'RegionCopyrightsCountry'}, + } + + def __init__( + self, + **kwargs + ): + super(RegionCopyrights, self).__init__(**kwargs) + self.copyrights = None + self.country = None + + +class RegionCopyrightsCountry(msrest.serialization.Model): + """Country property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar iso3: ISO3 property. + :vartype iso3: str + :ivar label: Label property. + :vartype label: str + """ + + _validation = { + 'iso3': {'readonly': True}, + 'label': {'readonly': True}, + } + + _attribute_map = { + 'iso3': {'key': 'ISO3', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegionCopyrightsCountry, self).__init__(**kwargs) + self.iso3 = None + self.label = None + + +class TileIndex(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param z: Required. Zoom level for the desired tile. + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type z: int + :param x: Required. X coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type x: int + :param y: Required. Y coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type y: int + """ + + _validation = { + 'z': {'required': True}, + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'z': {'key': 'z', 'type': 'int'}, + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(TileIndex, self).__init__(**kwargs) + self.z = kwargs['z'] + self.x = kwargs['x'] + self.y = kwargs['y'] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/models/_models_py3.py b/sdk/maps/azure-maps-render/azure/maps/render/models/_models_py3.py new file mode 100644 index 000000000000..ed700951b599 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/_models_py3.py @@ -0,0 +1,455 @@ +# 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 List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class BoundingBox(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param south_west: Required. Minimum coordinates (south-west point) of bounding box in latitude + longitude coordinate system. E.g. 52.41064,4.84228. + :type south_west: list[float] + :param north_east: Required. Maximum coordinates (north-east point) of bounding box in latitude + longitude coordinate system. E.g. 52.41064,4.84228. + :type north_east: list[float] + """ + + _validation = { + 'south_west': {'required': True}, + 'north_east': {'required': True}, + } + + _attribute_map = { + 'south_west': {'key': 'southWest', 'type': '[float]'}, + 'north_east': {'key': 'northEast', 'type': '[float]'}, + } + + def __init__( + self, + *, + south_west: List[float], + north_east: List[float], + **kwargs + ): + super(BoundingBox, self).__init__(**kwargs) + self.south_west = south_west + self.north_east = north_east + + +class Copyright(msrest.serialization.Model): + """This object is returned from a successful copyright request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar general_copyrights: General Copyrights array. + :vartype general_copyrights: list[str] + :ivar regions: Regions array. + :vartype regions: list[~azure.maps.render.models.RegionCopyrights] + """ + + _validation = { + 'format_version': {'readonly': True}, + 'general_copyrights': {'readonly': True}, + 'regions': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'general_copyrights': {'key': 'generalCopyrights', 'type': '[str]'}, + 'regions': {'key': 'regions', 'type': '[RegionCopyrights]'}, + } + + def __init__( + self, + **kwargs + ): + super(Copyright, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = None + + +class CopyrightCaption(msrest.serialization.Model): + """This object is returned from a successful copyright call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar copyrights_caption: Copyrights Caption property. + :vartype copyrights_caption: str + """ + + _validation = { + 'format_version': {'readonly': True}, + 'copyrights_caption': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'copyrights_caption': {'key': 'copyrightsCaption', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CopyrightCaption, self).__init__(**kwargs) + self.format_version = None + self.copyrights_caption = None + + +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.render.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.render.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.render.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 MapAttribution(msrest.serialization.Model): + """Copyright attribution for the requested section of a tileset. + + :param copyrights: A list of copyright strings. + :type copyrights: list[str] + """ + + _attribute_map = { + 'copyrights': {'key': 'copyrights', 'type': '[str]'}, + } + + def __init__( + self, + *, + copyrights: Optional[List[str]] = None, + **kwargs + ): + super(MapAttribution, self).__init__(**kwargs) + self.copyrights = copyrights + + +class MapTileset(msrest.serialization.Model): + """Metadata for a tileset in the TileJSON format. + + :param tilejson: Describes the version of the TileJSON spec that is implemented by this JSON + object. + :type tilejson: str + :param name: A name describing the tileset. The name can contain any legal character. + Implementations SHOULD NOT interpret the name as HTML. + :type name: str + :param description: Text description of the tileset. The description can contain any legal + character. Implementations SHOULD NOT interpret the description as HTML. + :type description: str + :param version: A semver.org style version number for the tiles contained within the tileset. + When changes across tiles are introduced, the minor version MUST change. + :type version: str + :param attribution: Copyright attribution to be displayed on the map. Implementations MAY + decide to treat this as HTML or literal text. For security reasons, make absolutely sure that + this field can't be abused as a vector for XSS or beacon tracking. + :type attribution: str + :param template: A mustache template to be used to format data from grids for interaction. + :type template: str + :param legend: A legend to be displayed with the map. Implementations MAY decide to treat this + as HTML or literal text. For security reasons, make absolutely sure that this field can't be + abused as a vector for XSS or beacon tracking. + :type legend: str + :param scheme: Default: "xyz". Either "xyz" or "tms". Influences the y direction of the tile + coordinates. The global-mercator (aka Spherical Mercator) profile is assumed. + :type scheme: str + :param tiles: An array of tile endpoints. If multiple endpoints are specified, clients may use + any combination of endpoints. All endpoints MUST return the same content for the same URL. The + array MUST contain at least one endpoint. + :type tiles: list[str] + :param grids: An array of interactivity endpoints. + :type grids: list[str] + :param data: An array of data files in GeoJSON format. + :type data: list[str] + :param min_zoom: The minimum zoom level. + :type min_zoom: int + :param max_zoom: The maximum zoom level. + :type max_zoom: int + :param bounds: The maximum extent of available map tiles. Bounds MUST define an area covered by + all zoom levels. The bounds are represented in WGS:84 latitude and longitude values, in the + order left, bottom, right, top. Values may be integers or floating point numbers. + :type bounds: list[float] + :param center: The default location of the tileset in the form [longitude, latitude, zoom]. The + zoom level MUST be between minzoom and maxzoom. Implementations can use this value to set the + default location. + :type center: list[float] + """ + + _validation = { + 'tilejson': {'pattern': r'\d+\.\d+\.\d+\w?[\w\d]*'}, + 'version': {'pattern': r'\d+\.\d+\.\d+\w?[\w\d]*'}, + 'min_zoom': {'maximum': 30, 'minimum': 0}, + 'max_zoom': {'maximum': 30, 'minimum': 0}, + } + + _attribute_map = { + 'tilejson': {'key': 'tilejson', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'attribution': {'key': 'attribution', 'type': 'str'}, + 'template': {'key': 'template', 'type': 'str'}, + 'legend': {'key': 'legend', 'type': 'str'}, + 'scheme': {'key': 'scheme', 'type': 'str'}, + 'tiles': {'key': 'tiles', 'type': '[str]'}, + 'grids': {'key': 'grids', 'type': '[str]'}, + 'data': {'key': 'data', 'type': '[str]'}, + 'min_zoom': {'key': 'minzoom', 'type': 'int'}, + 'max_zoom': {'key': 'maxzoom', 'type': 'int'}, + 'bounds': {'key': 'bounds', 'type': '[float]'}, + 'center': {'key': 'center', 'type': '[float]'}, + } + + def __init__( + self, + *, + tilejson: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + version: Optional[str] = None, + attribution: Optional[str] = None, + template: Optional[str] = None, + legend: Optional[str] = None, + scheme: Optional[str] = None, + tiles: Optional[List[str]] = None, + grids: Optional[List[str]] = None, + data: Optional[List[str]] = None, + min_zoom: Optional[int] = None, + max_zoom: Optional[int] = None, + bounds: Optional[List[float]] = None, + center: Optional[List[float]] = None, + **kwargs + ): + super(MapTileset, self).__init__(**kwargs) + self.tilejson = tilejson + self.name = name + self.description = description + self.version = version + self.attribution = attribution + self.template = template + self.legend = legend + self.scheme = scheme + self.tiles = tiles + self.grids = grids + self.data = data + self.min_zoom = min_zoom + self.max_zoom = max_zoom + self.bounds = bounds + self.center = center + + +class RegionCopyrights(msrest.serialization.Model): + """RegionCopyrights. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar copyrights: Copyrights array. + :vartype copyrights: list[str] + :ivar country: Country property. + :vartype country: ~azure.maps.render.models.RegionCopyrightsCountry + """ + + _validation = { + 'copyrights': {'readonly': True}, + 'country': {'readonly': True}, + } + + _attribute_map = { + 'copyrights': {'key': 'copyrights', 'type': '[str]'}, + 'country': {'key': 'country', 'type': 'RegionCopyrightsCountry'}, + } + + def __init__( + self, + **kwargs + ): + super(RegionCopyrights, self).__init__(**kwargs) + self.copyrights = None + self.country = None + + +class RegionCopyrightsCountry(msrest.serialization.Model): + """Country property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar iso3: ISO3 property. + :vartype iso3: str + :ivar label: Label property. + :vartype label: str + """ + + _validation = { + 'iso3': {'readonly': True}, + 'label': {'readonly': True}, + } + + _attribute_map = { + 'iso3': {'key': 'ISO3', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegionCopyrightsCountry, self).__init__(**kwargs) + self.iso3 = None + self.label = None + + +class TileIndex(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param z: Required. Zoom level for the desired tile. + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type z: int + :param x: Required. X coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type x: int + :param y: Required. Y coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type y: int + """ + + _validation = { + 'z': {'required': True}, + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'z': {'key': 'z', 'type': 'int'}, + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + } + + def __init__( + self, + *, + z: int, + x: int, + y: int, + **kwargs + ): + super(TileIndex, self).__init__(**kwargs) + self.z = z + self.x = x + self.y = y diff --git a/sdk/maps/azure-maps-render/azure/maps/render/models/_render_client_enums.py b/sdk/maps/azure-maps-render/azure/maps/render/models/_render_client_enums.py new file mode 100644 index 000000000000..28e09308dfaa --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/_render_client_enums.py @@ -0,0 +1,225 @@ +# 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 IncludeText(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Include all textual data in response. + YES = "yes" + #: Exclude textual data from response. Only images and country names will be in response. + NO = "no" + +class LocalizedMapView(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: United Arab Emirates (Arabic View). + AE = "AE" + #: Argentina (Argentinian View). + AR = "AR" + #: Bahrain (Arabic View). + BH = "BH" + #: India (Indian View). + IN_ENUM = "IN" + #: Iraq (Arabic View). + IQ = "IQ" + #: Jordan (Arabic View). + JO = "JO" + #: Kuwait (Arabic View). + KW = "KW" + #: Lebanon (Arabic View). + LB = "LB" + #: Morocco (Moroccan View). + MA = "MA" + #: Oman (Arabic View). + OM = "OM" + #: Pakistan (Pakistani View). + PK = "PK" + #: Palestinian Authority (Arabic View). + PS = "PS" + #: Qatar (Arabic View). + QA = "QA" + #: Saudi Arabia (Arabic View). + SA = "SA" + #: Syria (Arabic View). + SY = "SY" + #: Yemen (Arabic View). + YE = "YE" + #: Return the map data based on the IP address of the request. + AUTO = "Auto" + #: Unified View (Others). + UNIFIED = "Unified" + +class MapImageStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Azure Maps main style. + MAIN = "main" + #: Dark grey version of the Azure Maps main style. + DARK = "dark" + +class MapTileSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Return a 256 by 256 pixel tile. + SIZE256 = "256" + #: Return a 512 by 512 pixel tile. + SIZE512 = "512" + +class RasterTileFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: An image in the png format. Supports zoom levels 0 through 18. + PNG = "png" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +class StaticMapLayer(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Returns an image containing all map features including polygons, borders, roads and labels. + BASIC = "basic" + #: Returns an image containing borders, roads, and labels, and can be overlaid on other tiles + #: (such as satellite imagery) to produce hybrid tiles. + HYBRID = "hybrid" + #: Returns an image of just the map's label information. + LABELS = "labels" + +class TilesetID(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: A base map is a standard map that displays roads, natural and artificial features along with + #: the labels for those features in a vector tile.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: vector (pbf). + MICROSOFT_BASE = "microsoft.base" + #: Displays labels for roads, natural and artificial features in a vector tile.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: vector (pbf). + MICROSOFT_BASE_LABELS = "microsoft.base.labels" + #: Displays road, boundary and label data in a vector tile.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: vector (pbf). + MICROSOFT_BASE_HYBRID = "microsoft.base.hybrid" + #: Shaded relief and terra layers.:code:`
` + #: + #: Supports zoom levels 0 through 6. Format: raster (png). + MICROSOFT_TERRA_MAIN = "microsoft.terra.main" + #: All layers with our main style.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: raster (png). + MICROSOFT_BASE_ROAD = "microsoft.base.road" + #: All layers with our dark grey style.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: raster (png). + MICROSOFT_BASE_DARKGREY = "microsoft.base.darkgrey" + #: Label data in our main style.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: raster (png). + MICROSOFT_BASE_LABELS_ROAD = "microsoft.base.labels.road" + #: Label data in our dark grey style.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: raster (png). + MICROSOFT_BASE_LABELS_DARKGREY = "microsoft.base.labels.darkgrey" + #: Road, boundary and label data in our main style.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: raster (png). + MICROSOFT_BASE_HYBRID_ROAD = "microsoft.base.hybrid.road" + #: Road, boundary and label data in our dark grey style.:code:`
` + #: + #: Supports zoom levels 0 through 22. Format: raster (png). + MICROSOFT_BASE_HYBRID_DARKGREY = "microsoft.base.hybrid.darkgrey" + #: A combination of satellite and aerial imagery. Only available in S1 pricing SKU.:code:`
` + #: + #: Supports zoom levels 1 through 19. Format: raster (jpeg). + MICROSOFT_IMAGERY = "microsoft.imagery" + #: Weather radar tiles. Latest weather radar images including areas of rain, snow, ice and mixed + #: conditions. Please see `coverage information `_ for + #: Azure Maps Weather service. To learn more about the Radar data, please see `Weather concepts + #: `_.:code:`
` + #: + #: Supports zoom levels 0 through 15. Format: raster (png). + MICROSOFT_WEATHER_RADAR_MAIN = "microsoft.weather.radar.main" + #: Weather infrared tiles. Latest Infrared Satellite images shows clouds by their temperature. + #: Please see `coverage information `_ for Azure Maps + #: Weather service. To learn more about the returned Satellite data, please see `Weather concepts + #: `_.:code:`
` + #: + #: Supports zoom levels 0 through 15. Format: raster (png). + MICROSOFT_WEATHER_INFRARED_MAIN = "microsoft.weather.infrared.main" + #: Digital Elevation Model tiles. The tiles are in the GeoTIFF format with a single 32-bit + #: floating point band. The tiles cover the whole landmass of Earth. Some small islands (e.g., + #: atolls) might not be represented accurately.:code:`
` + #: + #: + #: * The vertical unit for measurement of elevation height is meters. An elevation value of + #: -32767.0 is used for points that have no data value, most often returned where there isn't + #: landmass (i.e. water).:code:`
` + #: * The horizontal reference datum is the World Geodetic System 1984 (WGS84-G1150) and the + #: vertical reference datum is the Earth Gravitational Model 2008 (EGM2008).:code:`
` + #: * Tiles are 258x258 pixel squares rather than the standard 256 x 256. This is done to allow for + #: accurate interpolation of values at the tile edges. As such adjacent tiles overlap by 1 pixel + #: along all edges.:code:`
` + #: * Tile data comes from the `Airbus WorldDEM4Ortho product + #: `_. Urban areas are approximately + #: leveled down to ground level. All other areas are represented by the object surface level + #: (e.g., trees). :code:`
` + #: + #: Supports zoom level 13 only. Format: raster (tiff). + MICROSOFT_DEM = "microsoft.dem" + #: Digital elevation contour line tiles. Compared to the microsoft.dem option, these tiles are in + #: vector format and intended for visualization purpose. The tiles cover the whole landmass of + #: Earth. Some small islands (e.g., atolls) might not be represented accurately.:code:`
` + #: + #: + #: * The vertical unit for measurement of elevation height is meters.:code:`
` + #: * The horizontal reference datum is the World Geodetic System 1984 (WGS84-G1150) and the + #: vertical reference datum is the Earth Gravitational Model 2008 (EGM2008).:code:`
` + #: * Tile data comes from the `Airbus WorldDEM4Ortho product + #: `_. Urban areas are approximately + #: leveled down to ground level. All other areas are represented by the object surface level + #: (e.g., trees).:code:`
` + #: + #: Supports zoom levels 9 through 14. Format: vector (pbf). + MICROSOFT_DEM_CONTOURS = "microsoft.dem.contours" + #: absolute traffic tiles in vector. + MICROSOFT_TRAFFIC_ABSOLUTE = "microsoft.traffic.absolute" + #: absolute traffic tiles in raster in our main style. + MICROSOFT_TRAFFIC_ABSOLUTE_MAIN = "microsoft.traffic.absolute.main" + #: relative traffic tiles in vector. + MICROSOFT_TRAFFIC_RELATIVE = "microsoft.traffic.relative" + #: relative traffic tiles in raster in our main style. + MICROSOFT_TRAFFIC_RELATIVE_MAIN = "microsoft.traffic.relative.main" + #: relative traffic tiles in raster in our dark style. + MICROSOFT_TRAFFIC_RELATIVE_DARK = "microsoft.traffic.relative.dark" + #: traffic tiles in vector. + MICROSOFT_TRAFFIC_DELAY = "microsoft.traffic.delay" + #: traffic tiles in raster in our main style. + MICROSOFT_TRAFFIC_DELAY_MAIN = "microsoft.traffic.delay.main" + #: reduced traffic tiles in raster in our main style. + MICROSOFT_TRAFFIC_REDUCED_MAIN = "microsoft.traffic.reduced.main" + #: incident tiles in vector. + MICROSOFT_TRAFFIC_INCIDENT = "microsoft.traffic.incident" diff --git a/sdk/maps/azure-maps-render/azure/maps/render/operations/__init__.py b/sdk/maps/azure-maps-render/azure/maps/render/operations/__init__.py new file mode 100644 index 000000000000..e911395a1ca8 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._render_v2_operations import RenderV2Operations + +__all__ = [ + 'RenderV2Operations', +] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_v2_operations.py b/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_v2_operations.py new file mode 100644 index 000000000000..5a5f37efea90 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_v2_operations.py @@ -0,0 +1,1260 @@ +# 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, IO, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RenderV2Operations(object): + """RenderV2Operations 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.render.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_map_tile( + self, + tileset_id, # type: Union[str, "_models.TilesetID"] + tile_index, # type: "_models.TileIndex" + time_stamp=None, # type: Optional[datetime.datetime] + tile_size=None, # type: Optional[Union[str, "_models.MapTileSize"]] + language=None, # type: Optional[str] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> IO + """**Applies to**\ : S0 and S1 pricing tiers. + + The Get Map Tiles API allows users to request map tiles in vector or raster formats typically + to be integrated into a map control or SDK. Some example tiles that can be requested are Azure + Maps road tiles, real-time Weather Radar tiles or the map tiles created using `Azure Maps + Creator `_. By default, Azure Maps uses vector tiles for its web map + control (Web SDK) and Android SDK. + + :param tileset_id: A tileset is a collection of raster or vector data broken up into a uniform + grid of square tiles at preset zoom levels. Every tileset has a **tilesetId** to use when + making requests. The **tilesetId** for tilesets created using `Azure Maps Creator + `_ are generated through the `Tileset Create API + `_. The ready-to-use tilesets supplied + by Azure Maps are listed below. For example, microsoft.base. + :type tileset_id: str or ~azure.maps.render.models.TilesetID + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.render.models.TileIndex + :param time_stamp: The desired date and time of the requested tile. This parameter must be + specified in the standard date-time format (e.g. 2019-11-14T16:03:00-08:00), as defined by `ISO + 8601 `_. This parameter is only supported when + tilesetId parameter is set to one of the values below. + + + * microsoft.weather.infrared.main: We provide tiles up to 3 hours in the past. Tiles are + available in 10-minute intervals. We round the timeStamp value to the nearest 10-minute time + frame. + * microsoft.weather.radar.main: We provide tiles up to 1.5 hours in the past and up to 2 hours + in the future. Tiles are available in 5-minute intervals. We round the timeStamp value to the + nearest 5-minute time frame. + :type time_stamp: ~datetime.datetime + :param tile_size: The size of the returned map tile in pixels. + :type tile_size: str or ~azure.maps.render.models.MapTileSize + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.render.models.LocalizedMapView + :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', {})) + + _z = None + _x = None + _y = None + if tile_index is not None: + _z = tile_index.z + _x = tile_index.x + _y = tile_index.y + api_version = "2.1" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_map_tile.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + query_parameters['zoom'] = self._serialize.query("z", _z, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'iso-8601') + if tile_size is not None: + query_parameters['tileSize'] = self._serialize.query("tile_size", tile_size, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_map_tile.metadata = {'url': '/map/tile'} # type: ignore + + def get_map_tileset( + self, + tileset_id, # type: Union[str, "_models.TilesetID"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MapTileset" + """**Applies to**\ : S0 and S1 pricing tiers. + + The Get Map Tileset API allows users to request metadata for a tileset. + + :param tileset_id: A tileset is a collection of raster or vector data broken up into a uniform + grid of square tiles at preset zoom levels. Every tileset has a **tilesetId** to use when + making requests. The **tilesetId** for tilesets created using `Azure Maps Creator + `_ are generated through the `Tileset Create API + `_. The ready-to-use tilesets supplied + by Azure Maps are listed below. For example, microsoft.base. + :type tileset_id: str or ~azure.maps.render.models.TilesetID + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapTileset, or the result of cls(response) + :rtype: ~azure.maps.render.models.MapTileset + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapTileset"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_map_tileset.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MapTileset', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_map_tileset.metadata = {'url': '/map/tileset'} # type: ignore + + def get_map_attribution( + self, + tileset_id, # type: Union[str, "_models.TilesetID"] + zoom, # type: int + bounds, # type: List[float] + **kwargs # type: Any + ): + # type: (...) -> "_models.MapAttribution" + """**Applies to**\ : S0 and S1 pricing tiers. + + The Get Map Attribution API allows users to request map copyright attribution information for a + section of a tileset. + + :param tileset_id: A tileset is a collection of raster or vector data broken up into a uniform + grid of square tiles at preset zoom levels. Every tileset has a **tilesetId** to use when + making requests. The **tilesetId** for tilesets created using `Azure Maps Creator + `_ are generated through the `Tileset Create API + `_. The ready-to-use tilesets supplied + by Azure Maps are listed below. For example, microsoft.base. + :type tileset_id: str or ~azure.maps.render.models.TilesetID + :param zoom: Zoom level for the desired map attribution. + :type zoom: int + :param bounds: The string that represents the rectangular area of a bounding box. The bounds + parameter is defined by the 4 bounding box coordinates, with WGS84 longitude and latitude of + the southwest corner followed by WGS84 longitude and latitude of the northeast corner. The + string is presented in the following format: ``[SouthwestCorner_Longitude, + SouthwestCorner_Latitude, NortheastCorner_Longitude, NortheastCorner_Latitude]``. + :type bounds: list[float] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapAttribution, or the result of cls(response) + :rtype: ~azure.maps.render.models.MapAttribution + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapAttribution"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_map_attribution.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['bounds'] = self._serialize.query("bounds", bounds, '[float]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MapAttribution', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_map_attribution.metadata = {'url': '/map/attribution'} # type: ignore + + def get_map_state_tile( + self, + stateset_id, # type: str + tile_index, # type: "_models.TileIndex" + **kwargs # type: Any + ): + # type: (...) -> IO + """**Applies to**\ : S0 and S1 pricing tiers. + + Fetches state tiles in vector format typically to be integrated into indoor maps module of map + control or SDK. The map control will call this API after user turns on dynamic styling (see + `Zoom Levels and Tile Grid + `_\ + ). + + :param stateset_id: The stateset id. + :type stateset_id: str + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.render.models.TileIndex + :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', {})) + + _z = None + _x = None + _y = None + if tile_index is not None: + _z = tile_index.z + _x = tile_index.x + _y = tile_index.y + api_version = "2.1" + accept = "application/vnd.mapbox-vector-tile, application/json" + + # Construct URL + url = self.get_map_state_tile.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['zoom'] = self._serialize.query("z", _z, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + query_parameters['statesetId'] = self._serialize.query("stateset_id", stateset_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_map_state_tile.metadata = {'url': '/map/statetile'} # type: ignore + + def get_copyright_caption( + self, + format="json", # type: Union[str, "_models.ResponseFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.CopyrightCaption" + """**Applies to**\ : S0 and S1 pricing tiers. + + Copyrights API is designed to serve copyright information for Render Tile + service. In addition to basic copyright for the whole map, API is serving + specific groups of copyrights for some countries. + + As an alternative to copyrights for map request, one can receive captions + for displaying the map provider information on the map. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CopyrightCaption, or the result of cls(response) + :rtype: ~azure.maps.render.models.CopyrightCaption + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CopyrightCaption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_caption.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('CopyrightCaption', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_caption.metadata = {'url': '/map/copyright/caption/{format}'} # type: ignore + + def get_map_static_image( + self, + format="png", # type: Union[str, "_models.RasterTileFormat"] + layer=None, # type: Optional[Union[str, "_models.StaticMapLayer"]] + style=None, # type: Optional[Union[str, "_models.MapImageStyle"]] + zoom=None, # type: Optional[int] + center=None, # type: Optional[List[float]] + bounding_box=None, # type: Optional[List[float]] + height=None, # type: Optional[int] + width=None, # type: Optional[int] + language=None, # type: Optional[str] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + pins=None, # type: Optional[List[str]] + path=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> IO + """**Applies to**\ : S0 and S1 pricing tiers. + + The static image service renders a user-defined, rectangular image containing a map section + using a zoom level from 0 to 20. The static image service renders a user-defined, rectangular + image containing a map section using a zoom level from 0 to 20. The supported resolution range + for the map image is from 1x1 to 8192x8192. If you are deciding when to use the static image + service over the map tile service, you may want to consider how you would like to interact with + the rendered map. If the map contents will be relatively unchanging, a static map is a good + choice. If you want to support a lot of zooming, panning and changing of the map content, the + map tile service would be a better choice. + + Service also provides Image Composition functionality to get a static image back with + additional data like; pushpins and geometry overlays with following S0 and S1 capabilities. + + In S0 you can: + + + * Render up to 5 pushpins specified in the request + * Provide one custom image for the pins referenced in the request + * Add labels to the pushpins + + In S1 you can: + + + * Render pushpins through `Azure Maps Data Service `_ + * Specify multiple pushpin styles + * Render circle, polyline and polygon geometry types. + * Render of supported GeoJSON geometry types uploaded through `Azure Maps Data Service + `_ + + Please see `How-to-Guide `_ for detailed + examples. + + *Note* : Either **center** or **bbox** parameter must be supplied to the + API. + :code:`
`:code:`
` + The supported Lat and Lon ranges when using the **bbox** parameter, are as follows: + :code:`
`:code:`
` + + .. list-table:: + :header-rows: 1 + + * - Zoom Level + - Max Lon Range + - Max Lat Range + * - 0 + - 360.0 + - 170.0 + * - 1 + - 360.0 + - 170.0 + * - 2 + - 360.0 + - 170.0 + * - 3 + - 360.0 + - 170.0 + * - 4 + - 360.0 + - 170.0 + * - 5 + - 180.0 + - 85.0 + * - 6 + - 90.0 + - 42.5 + * - 7 + - 45.0 + - 21.25 + * - 8 + - 22.5 + - 10.625 + * - 9 + - 11.25 + - 5.3125 + * - 10 + - 5.625 + - 2.62625 + * - 11 + - 2.8125 + - 1.328125 + * - 12 + - 1.40625 + - 0.6640625 + * - 13 + - 0.703125 + - 0.33203125 + * - 14 + - 0.3515625 + - 0.166015625 + * - 15 + - 0.17578125 + - 0.0830078125 + * - 16 + - 0.087890625 + - 0.0415039063 + * - 17 + - 0.0439453125 + - 0.0207519531 + * - 18 + - 0.0219726563 + - 0.0103759766 + * - 19 + - 0.0109863281 + - 0.0051879883 + * - 20 + - 0.0054931641 + - 0.0025939941. + + :param format: Desired format of the response. Possible value: png. + :type format: str or ~azure.maps.render.models.RasterTileFormat + :param layer: Map layer requested. If layer is set to labels or hybrid, the format should be + png. + :type layer: str or ~azure.maps.render.models.StaticMapLayer + :param style: Map style to be returned. Possible values are main and dark. + :type style: str or ~azure.maps.render.models.MapImageStyle + :param zoom: Desired zoom level of the map. Zoom value must be in the range: 0-20 (inclusive). + Default value is 12.:code:`
`:code:`
`Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param center: Coordinates of the center point. Format: 'lon,lat'. Projection used + + + * EPSG:3857. Longitude range: -180 to 180. Latitude range: -85 to 85. + + Note: Either center or bbox are required parameters. They are + mutually exclusive. + :type center: list[float] + :param bounding_box: Bounding box. Projection used - EPSG:3857. Format : 'minLon, minLat, + maxLon, maxLat'. + + Note: Either bbox or center are required + parameters. They are mutually exclusive. It shouldn’t be used with + height or width. + + The maximum allowed ranges for Lat and Lon are defined for each zoom level + in the table at the top of this page. + :type bounding_box: list[float] + :param height: Height of the resulting image in pixels. Range is 1 to 8192. Default + is 512. It shouldn’t be used with bbox. + :type height: int + :param width: Width of the resulting image in pixels. Range is 1 to 8192. Default is 512. It + shouldn’t be used with bbox. + :type width: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.render.models.LocalizedMapView + :param pins: Pushpin style and instances. Use this parameter to optionally add pushpins to the + image. + The pushpin style describes the appearance of the pushpins, and the instances specify + the coordinates of the pushpins and optional labels for each pin. (Be sure to properly + URL-encode values of this + parameter since it will contain reserved characters such as pipes and punctuation.) + + The Azure Maps account S0 SKU only supports a single instance of the pins parameter. Other + SKUs + allow multiple instances of the pins parameter to specify multiple pin styles. + + To render a pushpin at latitude 45°N and longitude 122°W using the default built-in pushpin + style, add the + querystring parameter + + ``pins=default||-122 45`` + + Note that the longitude comes before the latitude. + After URL encoding this will look like + + ``pins=default%7C%7C-122+45`` + + All of the examples here show the pins + parameter without URL encoding, for clarity. + + To render a pin at multiple locations, separate each location with a pipe character. For + example, use + + ``pins=default||-122 45|-119.5 43.2|-121.67 47.12`` + + The S0 Azure Maps account SKU only allows five pushpins. Other account SKUs do not have this + limitation. + + Style Modifiers + ^^^^^^^^^^^^^^^ + + You can modify the appearance of the pins by adding style modifiers. These are added after the + style but before + the locations and labels. Style modifiers each have a two-letter name. These abbreviated names + are used to help + reduce the length of the URL. + + To change the color of the pushpin, use the 'co' style modifier and specify the color using + the HTML/CSS RGB color + format which is a six-digit hexadecimal number (the three-digit form is not supported). For + example, to use + a deep pink color which you would specify as #FF1493 in CSS, use + + ``pins=default|coFF1493||-122 45`` + + Pushpin Labels + ^^^^^^^^^^^^^^ + + To add a label to the pins, put the label in single quotes just before the coordinates. For + example, to label + three pins with the values '1', '2', and '3', use + + ``pins=default||'1'-122 45|'2'-119.5 43.2|'3'-121.67 47.12`` + + There is a built in pushpin style called 'none' that does not display a pushpin image. You can + use this if + you want to display labels without any pin image. For example, + + ``pins=none||'A'-122 45|'B'-119.5 43.2`` + + To change the color of the pushpin labels, use the 'lc' label color style modifier. For + example, to use pink + pushpins with black labels, use + + ``pins=default|coFF1493|lc000000||-122 45`` + + To change the size of the labels, use the 'ls' label size style modifier. The label size + represents the approximate + height of the label text in pixels. For example, to increase the label size to 12, use + + ``pins=default|ls12||'A'-122 45|'B'-119 43`` + + The labels are centered at the pushpin 'label anchor.' The anchor location is predefined for + built-in pushpins and + is at the top center of custom pushpins (see below). To override the label anchor, using the + 'la' style modifier + and provide X and Y pixel coordinates for the anchor. These coordinates are relative to the + top left corner of the + pushpin image. Positive X values move the anchor to the right, and positive Y values move the + anchor down. For example, + to position the label anchor 10 pixels right and 4 pixels above the top left corner of the + pushpin image, + use + + ``pins=default|la10 -4||'A'-122 45|'B'-119 43`` + + Custom Pushpins + ^^^^^^^^^^^^^^^ + + To use a custom pushpin image, use the word 'custom' as the pin style name, and then specify a + URL after the + location and label information. Use two pipe characters to indicate that you're done + specifying locations and are + starting the URL. For example, + + ``pins=custom||-122 45||http://contoso.com/pushpins/red.png`` + + After URL encoding, this would look like + + ``pins=custom%7C%7C-122+45%7C%7Chttp%3A%2F%2Fcontoso.com%2Fpushpins%2Fred.png`` + + By default, custom pushpin images are drawn centered at the pin coordinates. This usually + isn't ideal as it obscures + the location that you're trying to highlight. To override the anchor location of the pin + image, use the 'an' + style modifier. This uses the same format as the 'la' label anchor style modifier. For + example, if your custom + pin image has the tip of the pin at the top left corner of the image, you can set the anchor + to that spot by + using + + ``pins=custom|an0 0||-122 45||http://contoso.com/pushpins/red.png`` + + Note: If you use the 'co' color modifier with a custom pushpin image, the specified color will + replace the RGB + channels of the pixels in the image but will leave the alpha (opacity) channel unchanged. This + would usually + only be done with a solid-color custom image. + + Getting Pushpins from Azure Maps Data Storage + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + For all Azure Maps account SKUs other than S0, + the pushpin location information can be obtained from Azure Maps Data Storage. After uploading + a GeoJSON document containing pin locations, the Data Storage service returns a Unique Data ID + (UDID) that you can use + to reference the data in the pins parameter. + + To use the point geometry from an uploaded GeoJSON document as the pin locations, specify the + UDID in the locations + section of the pins parameter. For example, + + ``pins=default||udid-29dc105a-dee7-409f-a3f9-22b066ae4713`` + + Note that + only point and multipoint geometry, points and multipoints from geometry collections, and + point geometry from features + will be used. Linestring and polygon geometry will be ignored. If the point comes from a + feature and the feature + has a string property called "label", the value of that property will be used as the label for + the pin. + + You can mix pin locations from Data Storage and pin locations specified in the pins parameter. + Any of the pipe-delimited + pin locations can be a longitude and latitude or a UDID. For example, + + ``pins=default||-122 45|udid-29dc105a-dee7-409f-a3f9-22b066ae4713|-119 43`` + + Scale, Rotation, and Opacity + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + You can make pushpins and their labels larger or smaller by using the 'sc' scale style + modifier. This is a + value greater than zero. A value of 1 is the standard scale. Values larger than 1 will make + the pins larger, and + values smaller than 1 will make them smaller. For example, to draw the pushpins 50% larger + than normal, use + + ``pins=default|sc1.5||-122 45`` + + You can rotate pushpins and their labels by using the 'ro' rotation style modifier. This is a + number of degrees + of clockwise rotation. Use a negative number to rotate counter-clockwise. For example, to + rotate the pushpins + 90 degrees clockwise and double their size, use + + ``pins=default|ro90|sc2||-122 45`` + + You can make pushpins and their labels partially transparent by specifying the 'al' alpha + style modifier. + This is a number between 0 and 1 indicating the opacity of the pushpins. Zero makes them + completely transparent + (and not visible) and 1 makes them completely opaque (which is the default). For example, to + make pushpins + and their labels only 67% opaque, use + + ``pins=default|al.67||-122 45`` + + Style Modifier Summary + ^^^^^^^^^^^^^^^^^^^^^^ + + .. list-table:: + :header-rows: 1 + + * - Modifier + - Description + - Range + * - al + - Alpha (opacity) + - 0 to 1 + * - an + - Pin anchor + - * + * - co + - Pin color + - 000000 to FFFFFF + * - la + - Label anchor + - * + * - lc + - Label color + - 000000 to FFFFFF + * - ls + - Label size + - Greater than 0 + * - ro + - Rotation + - -360 to 360 + * - sc + - Scale + - Greater than 0 + + + + * X and Y coordinates can be anywhere within pin image or a margin around it. + The margin size is the minimum of the pin width and height. + :type pins: list[str] + :param path: Path style and locations. Use this parameter to optionally add lines, polygons or + circles to the image. + The path style describes the appearance of the line and fill. (Be sure to properly URL-encode + values of this + parameter since it will contain reserved characters such as pipes and punctuation.) + + Path parameter is supported in Azure Maps account SKU starting with S1. Multiple instances of + the path parameter + allow to specify multiple geometries with their styles. Number of parameters per request is + limited to 10 and + number of locations is limited to 100 per path. + + To render a circle with radius 100 meters and center point at latitude 45°N and longitude + 122°W using the default style, add the + querystring parameter + + ``path=ra100||-122 45`` + + Note that the longitude comes before the latitude. + After URL encoding this will look like + + ``path=ra100%7C%7C-122+45`` + + All of the examples here show the path parameter without URL encoding, for clarity. + + To render a line, separate each location with a pipe character. For example, use + + ``path=||-122 45|-119.5 43.2|-121.67 47.12`` + + To render a polygon, last location must be equal to the start location. For example, use + + ``path=||-122 45|-119.5 43.2|-121.67 47.12|-122 45`` + + Longitude and latitude values for locations of lines and polygons can be in the range from + -360 to 360 to allow for rendering of geometries crossing the anti-meridian. + + Style Modifiers + ^^^^^^^^^^^^^^^ + + You can modify the appearance of the path by adding style modifiers. These are added before + the locations. + Style modifiers each have a two-letter name. These abbreviated names are used to help reduce + the length + of the URL. + + To change the color of the outline, use the 'lc' style modifier and specify the color using + the HTML/CSS RGB color + format which is a six-digit hexadecimal number (the three-digit form is not supported). For + example, to use + a deep pink color which you would specify as #FF1493 in CSS, use + + ``path=lcFF1493||-122 45|-119.5 43.2`` + + Multiple style modifiers may be combined together to create a more complex visual style. + + ``lc0000FF|lw3|la0.60|fa0.50||-122.2 47.6|-122.2 47.7|-122.3 47.7|-122.3 47.6|-122.2 47.6`` + + Getting Path locations from Azure Maps Data Storage + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + For all Azure Maps account SKUs other than S0, the path location information can be obtained + from Azure Maps Data Storage. + After uploading a GeoJSON document containing path locations, the Data Storage service returns + a Unique Data ID (UDID) that you can use + to reference the data in the path parameter. + + To use the point geometry from an uploaded GeoJSON document as the path locations, specify the + UDID in the locations + section of the path parameter. For example, + + ``path=||udid-29dc105a-dee7-409f-a3f9-22b066ae4713`` + + Note the it is not allowed to mix path locations from Data Storage with locations specified in + the path parameter. + + Style Modifier Summary + ^^^^^^^^^^^^^^^^^^^^^^ + + .. list-table:: + :header-rows: 1 + + * - Modifier + - Description + - Range + * - lc + - Line color + - 000000 to FFFFFF + * - fc + - Fill color + - 000000 to FFFFFF + * - la + - Line alpha (opacity) + - 0 to 1 + * - fa + - Fill alpha (opacity) + - 0 to 1 + * - lw + - Line width + - Greater than 0 + * - ra + - Circle radius (meters) + - Greater than 0. + :type path: list[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.1" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_map_static_image.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if layer is not None: + query_parameters['layer'] = self._serialize.query("layer", layer, 'str') + if style is not None: + query_parameters['style'] = self._serialize.query("style", style, 'str') + if zoom is not None: + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int', maximum=20, minimum=0) + if center is not None: + query_parameters['center'] = self._serialize.query("center", center, '[float]', div=',') + if bounding_box is not None: + query_parameters['bbox'] = self._serialize.query("bounding_box", bounding_box, '[float]', div=',') + if height is not None: + query_parameters['height'] = self._serialize.query("height", height, 'int', maximum=8192, minimum=1) + if width is not None: + query_parameters['width'] = self._serialize.query("width", width, 'int', maximum=8192, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if pins is not None: + query_parameters['pins'] = [self._serialize.query("pins", q, 'str') if q is not None else '' for q in pins] + if path is not None: + query_parameters['path'] = [self._serialize.query("path", q, 'str') if q is not None else '' for q in path] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_map_static_image.metadata = {'url': '/map/static/{format}'} # type: ignore + + def get_copyright_from_bounding_box( + self, + bounding_box, # type: "_models.BoundingBox" + format="json", # type: Union[str, "_models.ResponseFormat"] + include_text=None, # type: Optional[Union[str, "_models.IncludeText"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Copyright" + """**Applies to**\ : S0 and S1 pricing tiers. + + Returns copyright information for a given bounding box. Bounding-box requests should specify + the minimum and maximum longitude and latitude (EPSG-3857) coordinates. + + :param bounding_box: Parameter group. + :type bounding_box: ~azure.maps.render.models.BoundingBox + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :param include_text: Yes/no value to exclude textual data from response. Only images and + country names will be in response. + :type include_text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Copyright, or the result of cls(response) + :rtype: ~azure.maps.render.models.Copyright + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Copyright"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _south_west = None + _north_east = None + if bounding_box is not None: + _south_west = bounding_box.south_west + _north_east = bounding_box.north_east + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_from_bounding_box.metadata['url'] # type: ignore + path_format_arguments = { + '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['mincoordinates'] = self._serialize.query("south_west", _south_west, '[float]', div=',') + query_parameters['maxcoordinates'] = self._serialize.query("north_east", _north_east, '[float]', div=',') + if include_text is not None: + query_parameters['text'] = self._serialize.query("include_text", include_text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Copyright', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_from_bounding_box.metadata = {'url': '/map/copyright/bounding/{format}'} # type: ignore + + def get_copyright_for_tile( + self, + tile_index, # type: "_models.TileIndex" + format="json", # type: Union[str, "_models.ResponseFormat"] + include_text=None, # type: Optional[Union[str, "_models.IncludeText"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Copyright" + """**Applies to**\ : S0 and S1 pricing tiers. + + Copyrights API is designed to serve copyright information for Render Tile service. In addition + to basic copyright for the whole map, API is serving specific groups of copyrights for some + countries. + Returns the copyright information for a given tile. To obtain the copyright information for a + particular tile, the request should specify the tile's zoom level and x and y coordinates (see: + Zoom Levels and Tile Grid). + + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.render.models.TileIndex + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :param include_text: Yes/no value to exclude textual data from response. Only images and + country names will be in response. + :type include_text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Copyright, or the result of cls(response) + :rtype: ~azure.maps.render.models.Copyright + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Copyright"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + _z = None + _x = None + _y = None + if tile_index is not None: + _z = tile_index.z + _x = tile_index.x + _y = tile_index.y + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_for_tile.metadata['url'] # type: ignore + path_format_arguments = { + '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['zoom'] = self._serialize.query("z", _z, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if include_text is not None: + query_parameters['text'] = self._serialize.query("include_text", include_text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Copyright', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_for_tile.metadata = {'url': '/map/copyright/tile/{format}'} # type: ignore + + def get_copyright_for_world( + self, + format="json", # type: Union[str, "_models.ResponseFormat"] + include_text=None, # type: Optional[Union[str, "_models.IncludeText"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.Copyright" + """**Applies to**\ : S0 and S1 pricing tiers. + + Copyrights API is designed to serve copyright information for Render Tile service. In addition + to basic copyright for the whole map, API is serving specific groups of copyrights for some + countries. + Returns the copyright information for the world. To obtain the default copyright information + for the whole world, do not specify a tile or bounding box. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.ResponseFormat + :param include_text: Yes/no value to exclude textual data from response. Only images and + country names will be in response. + :type include_text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Copyright, or the result of cls(response) + :rtype: ~azure.maps.render.models.Copyright + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Copyright"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.1" + accept = "application/json" + + # Construct URL + url = self.get_copyright_for_world.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if include_text is not None: + query_parameters['text'] = self._serialize.query("include_text", include_text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('Copyright', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_copyright_for_world.metadata = {'url': '/map/copyright/world/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-render/azure/maps/render/py.typed b/sdk/maps/azure-maps-render/azure/maps/render/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-render/sdk_packaging.toml b/sdk/maps/azure-maps-render/sdk_packaging.toml new file mode 100644 index 000000000000..417cb6307241 --- /dev/null +++ b/sdk/maps/azure-maps-render/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-render" +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-render/setup.cfg b/sdk/maps/azure-maps-render/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-render/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-render/setup.py b/sdk/maps/azure-maps-render/setup.py new file mode 100644 index 000000000000..4683b6c69286 --- /dev/null +++ b/sdk/maps/azure-maps-render/setup.py @@ -0,0 +1,90 @@ +#!/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-render" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-route/CHANGELOG.md b/sdk/maps/azure-maps-route/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-route/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-route/LICENSE.txt b/sdk/maps/azure-maps-route/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-route/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-route/MANIFEST.in b/sdk/maps/azure-maps-route/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-route/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-route/README.md b/sdk/maps/azure-maps-route/README.md new file mode 100644 index 000000000000..b8dd40a7bf1e --- /dev/null +++ b/sdk/maps/azure-maps-route/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.6+. +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-route%2FREADME.png) diff --git a/sdk/maps/azure-maps-route/_meta.json b/sdk/maps/azure-maps-route/_meta.json new file mode 100644 index 000000000000..a7595fce714b --- /dev/null +++ b/sdk/maps/azure-maps-route/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Route/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/Route/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-route/azure/__init__.py b/sdk/maps/azure-maps-route/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-route/azure/maps/__init__.py b/sdk/maps/azure-maps-route/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-route/azure/maps/route/__init__.py b/sdk/maps/azure-maps-route/azure/maps/route/__init__.py new file mode 100644 index 000000000000..616953f5de44 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/__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 ._route_client import RouteClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['RouteClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-route/azure/maps/route/_configuration.py b/sdk/maps/azure-maps-route/azure/maps/route/_configuration.py new file mode 100644 index 000000000000..30f925824ad6 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class RouteClientConfiguration(Configuration): + """Configuration for RouteClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(RouteClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-route/{}'.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-route/azure/maps/route/_metadata.json b/sdk/maps/azure-maps-route/azure/maps/route/_metadata.json new file mode 100644 index 000000000000..6a70601ff906 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "RouteClient", + "filename": "_route_client", + "description": "Azure Maps Route REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"RouteClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"RouteClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "route": "RouteOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py b/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py new file mode 100644 index 000000000000..e92e39c81e00 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py @@ -0,0 +1,86 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import RouteClientConfiguration +from .operations import RouteOperations +from . import models + + +class RouteClient(object): + """Azure Maps Route REST APIs. + + :ivar route: RouteOperations operations + :vartype route: azure.maps.route.operations.RouteOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = RouteClientConfiguration(credential, client_id, **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.route = RouteOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> RouteClient + 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-route/azure/maps/route/_version.py b/sdk/maps/azure-maps-route/azure/maps/route/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-route/azure/maps/route/aio/__init__.py b/sdk/maps/azure-maps-route/azure/maps/route/aio/__init__.py new file mode 100644 index 000000000000..affbe9c7b264 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/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 ._route_client import RouteClient +__all__ = ['RouteClient'] diff --git a/sdk/maps/azure-maps-route/azure/maps/route/aio/_configuration.py b/sdk/maps/azure-maps-route/azure/maps/route/aio/_configuration.py new file mode 100644 index 000000000000..052e19ca2dc7 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 RouteClientConfiguration(Configuration): + """Configuration for RouteClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(RouteClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-route/{}'.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-route/azure/maps/route/aio/_route_client.py b/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client.py new file mode 100644 index 000000000000..d882eac9b909 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 RouteClientConfiguration +from .operations import RouteOperations +from .. import models + + +class RouteClient(object): + """Azure Maps Route REST APIs. + + :ivar route: RouteOperations operations + :vartype route: azure.maps.route.aio.operations.RouteOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = RouteClientConfiguration(credential, client_id, **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.route = RouteOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "RouteClient": + 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-route/azure/maps/route/aio/operations/__init__.py b/sdk/maps/azure-maps-route/azure/maps/route/aio/operations/__init__.py new file mode 100644 index 000000000000..5388780d333b --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._route_operations import RouteOperations + +__all__ = [ + 'RouteOperations', +] diff --git a/sdk/maps/azure-maps-route/azure/maps/route/aio/operations/_route_operations.py b/sdk/maps/azure-maps-route/azure/maps/route/aio/operations/_route_operations.py new file mode 100644 index 000000000000..928deb153854 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/operations/_route_operations.py @@ -0,0 +1,3225 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.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 RouteOperations: + """RouteOperations 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.route.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 _request_route_matrix_initial( + self, + route_matrix_query: "_models.RouteMatrixQuery", + format: Union[str, "_models.JsonFormat"] = "json", + wait_for_results: Optional[bool] = None, + compute_travel_time: Optional[Union[str, "_models.ComputeTravelTime"]] = None, + filter_section_type: Optional[Union[str, "_models.SectionType"]] = None, + arrive_at: Optional[datetime.datetime] = None, + depart_at: Optional[datetime.datetime] = None, + vehicle_axle_weight: Optional[int] = 0, + vehicle_length: Optional[float] = 0, + vehicle_height: Optional[float] = 0, + vehicle_width: Optional[float] = 0, + vehicle_max_speed: Optional[int] = 0, + vehicle_weight: Optional[int] = 0, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + incline_level: Optional[Union[str, "_models.InclineLevel"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + use_traffic_data: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + **kwargs: Any + ) -> Optional["_models.RouteMatrixResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResult"]] + 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._request_route_matrix_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_matrix_query, 'RouteMatrixQuery') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _request_route_matrix_initial.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + async def begin_request_route_matrix( + self, + route_matrix_query: "_models.RouteMatrixQuery", + format: Union[str, "_models.JsonFormat"] = "json", + wait_for_results: Optional[bool] = None, + compute_travel_time: Optional[Union[str, "_models.ComputeTravelTime"]] = None, + filter_section_type: Optional[Union[str, "_models.SectionType"]] = None, + arrive_at: Optional[datetime.datetime] = None, + depart_at: Optional[datetime.datetime] = None, + vehicle_axle_weight: Optional[int] = 0, + vehicle_length: Optional[float] = 0, + vehicle_height: Optional[float] = 0, + vehicle_width: Optional[float] = 0, + vehicle_max_speed: Optional[int] = 0, + vehicle_weight: Optional[int] = 0, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + incline_level: Optional[Union[str, "_models.InclineLevel"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + use_traffic_data: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteMatrixResult"]: + """**Applies to**\ : S1 pricing tier. + + The Matrix Routing service allows calculation of a matrix of route summaries for a set of + routes defined by origin and destination locations by using an asynchronous (async) or + synchronous (sync) POST request. For every given origin, the service calculates the cost of + routing from that origin to every given destination. The set of origins and the set of + destinations can be thought of as the column and row headers of a table and each cell in the + table contains the costs of routing from the origin to the destination for that cell. As an + example, let's say a food delivery company has 20 drivers and they need to find the closest + driver to pick up the delivery from the restaurant. To solve this use case, they can call + Matrix Route API. + + For each route, the travel times and distances are returned. You can use the computed costs to + determine which detailed routes to calculate using the Route Directions API. + + The maximum size of a matrix for async request is **700** and for sync request it's **100** + (the number of origins multiplied by the number of destinations). + + Submit Synchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + If your scenario requires synchronous requests and the maximum size of the matrix is less than + or equal to 100, you might want to make synchronous request. The maximum size of a matrix for + this API is **100** (the number of origins multiplied by the number of destinations). With that + constraint in mind, examples of possible matrix dimensions are: 10x10, 6x8, 9x8 (it does not + need to be square). + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex routing + requests. When you make a request by using async request, by default the service returns a 202 + response code along a redirect URL in the Location field of the response header. This URL + should be checked periodically until the response data or error information is available. If + ``waitForResults`` parameter in the request is set to true, user will get a 200 response if the + request is finished under 120 seconds. + + The maximum size of a matrix for this API is **700** (the number of origins multiplied by the + number of destinations). With that constraint in mind, examples of possible matrix dimensions + are: 50x10, 10x10, 28x25. 10x70 (it does not need to be square). + + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/json?api-version=1.0&subscription-key={subscription-key} + + Here's a typical sequence of asynchronous operations: + + + #. + Client sends a Route Matrix POST request to Azure Maps + + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Route Matrix request has been accepted. + + HTTP ``Error`` - There was an error processing your Route Matrix request. This could + either be a 400 Bad Request or any other Error status code. + + + + #. + If the Matrix Route request was accepted successfully, the Location header in the response + contains the URL to download the results of the request. This status URI looks like the + following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + + #. Client issues a GET request on the download URL obtained in Step 3 to download the results + + Download Sync Results + ^^^^^^^^^^^^^^^^^^^^^ + + When you make a POST request for Route Matrix Sync API, the service returns 200 response code + for successful request and a response array. The response body will contain the data and there + will be no possibility to retrieve the results later. + + Download Async Results + ^^^^^^^^^^^^^^^^^^^^^^ + + When a request issues a ``202 Accepted`` response, the request is being processed using our + async pipeline. You will be given a URL to check the progress of your async request in the + location header of the response. This status URI looks like the following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + The URL provided by the location header will return the following responses when a ``GET`` + request is issued. + + .. + + HTTP ``202 Accepted`` - Matrix request was accepted but is still being processed. Please try + again in some time. + + HTTP ``200 OK`` - Matrix request successfully processed. The response body contains all of + the results. + + :param route_matrix_query: The matrix of origin and destination coordinates to compute the + route distance, travel time and other summary for each cell of the matrix based on the input + parameters. The minimum and the maximum cell count supported are 1 and **700** for async and + **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 + origins and 25 destinations for async API. + :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :param wait_for_results: Boolean to indicate whether to execute the request synchronously. If + set to true, user will get a 200 response if the request is finished under 120 seconds. + Otherwise, user will get a 202 response right away. Please refer to the API description for + more details on 202 response. **Supported only for async request**. + :type wait_for_results: bool + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + :type vehicle_weight: int + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :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 RouteMatrixResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteMatrixResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResult"] + 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._request_route_matrix_initial( + route_matrix_query=route_matrix_query, + format=format, + wait_for_results=wait_for_results, + compute_travel_time=compute_travel_time, + filter_section_type=filter_section_type, + arrive_at=arrive_at, + depart_at=depart_at, + vehicle_axle_weight=vehicle_axle_weight, + vehicle_length=vehicle_length, + vehicle_height=vehicle_height, + vehicle_width=vehicle_width, + vehicle_max_speed=vehicle_max_speed, + vehicle_weight=vehicle_weight, + windingness=windingness, + incline_level=incline_level, + travel_mode=travel_mode, + avoid=avoid, + use_traffic_data=use_traffic_data, + route_type=route_type, + vehicle_load_type=vehicle_load_type, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_request_route_matrix.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + async def _get_route_matrix_initial( + self, + matrix_id: str, + **kwargs: Any + ) -> Optional["_models.RouteMatrixResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResult"]] + 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_route_matrix_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("matrix_id", matrix_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_route_matrix_initial.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + async def begin_get_route_matrix( + self, + matrix_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteMatrixResult"]: + """If the Matrix Route request was accepted successfully, the Location header in the response + contains the URL to download the results of the request. This status URI looks like the + following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + + #. Client issues a GET request on the download URL obtained in Step 3 to download the results + + Download Sync Results + ^^^^^^^^^^^^^^^^^^^^^ + + When you make a POST request for Route Matrix Sync API, the service returns 200 response code + for successful request and a response array. The response body will contain the data and there + will be no possibility to retrieve the results later. + + Download Async Results + ^^^^^^^^^^^^^^^^^^^^^^ + + When a request issues a ``202 Accepted`` response, the request is being processed using our + async pipeline. You will be given a URL to check the progress of your async request in the + location header of the response. This status URI looks like the following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + The URL provided by the location header will return the following responses when a ``GET`` + request is issued. + + .. + + HTTP ``202 Accepted`` - Matrix request was accepted but is still being processed. Please try + again in some time. + + HTTP ``200 OK`` - Matrix request successfully processed. The response body contains all of + the results. + + :param matrix_id: Matrix id received after the Matrix Route request was accepted successfully. + :type matrix_id: 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 RouteMatrixResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteMatrixResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResult"] + 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._get_route_matrix_initial( + matrix_id=matrix_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("matrix_id", matrix_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_route_matrix.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + async def request_route_matrix_sync( + self, + route_matrix_query: "_models.RouteMatrixQuery", + format: Union[str, "_models.JsonFormat"] = "json", + wait_for_results: Optional[bool] = None, + compute_travel_time: Optional[Union[str, "_models.ComputeTravelTime"]] = None, + filter_section_type: Optional[Union[str, "_models.SectionType"]] = None, + arrive_at: Optional[datetime.datetime] = None, + depart_at: Optional[datetime.datetime] = None, + vehicle_axle_weight: Optional[int] = 0, + vehicle_length: Optional[float] = 0, + vehicle_height: Optional[float] = 0, + vehicle_width: Optional[float] = 0, + vehicle_max_speed: Optional[int] = 0, + vehicle_weight: Optional[int] = 0, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + incline_level: Optional[Union[str, "_models.InclineLevel"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + use_traffic_data: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + **kwargs: Any + ) -> "_models.RouteMatrixResult": + """**Applies to**\ : S1 pricing tier. + + The Matrix Routing service allows calculation of a matrix of route summaries for a set of + routes defined by origin and destination locations by using an asynchronous (async) or + synchronous (sync) POST request. For every given origin, the service calculates the cost of + routing from that origin to every given destination. The set of origins and the set of + destinations can be thought of as the column and row headers of a table and each cell in the + table contains the costs of routing from the origin to the destination for that cell. As an + example, let's say a food delivery company has 20 drivers and they need to find the closest + driver to pick up the delivery from the restaurant. To solve this use case, they can call + Matrix Route API. + + For each route, the travel times and distances are returned. You can use the computed costs to + determine which detailed routes to calculate using the Route Directions API. + + The maximum size of a matrix for async request is **700** and for sync request it's **100** + (the number of origins multiplied by the number of destinations). + + Submit Synchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + If your scenario requires synchronous requests and the maximum size of the matrix is less than + or equal to 100, you might want to make synchronous request. The maximum size of a matrix for + this API is **100** (the number of origins multiplied by the number of destinations). With that + constraint in mind, examples of possible matrix dimensions are: 10x10, 6x8, 9x8 (it does not + need to be square). + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex routing + requests. When you make a request by using async request, by default the service returns a 202 + response code along a redirect URL in the Location field of the response header. This URL + should be checked periodically until the response data or error information is available. If + ``waitForResults`` parameter in the request is set to true, user will get a 200 response if the + request is finished under 120 seconds. + + The maximum size of a matrix for this API is **700** (the number of origins multiplied by the + number of destinations). With that constraint in mind, examples of possible matrix dimensions + are: 50x10, 10x10, 28x25. 10x70 (it does not need to be square). + + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/json?api-version=1.0&subscription-key={subscription-key} + + Here's a typical sequence of asynchronous operations: + + + #. + Client sends a Route Matrix POST request to Azure Maps + + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Route Matrix request has been accepted. + + HTTP ``Error`` - There was an error processing your Route Matrix request. This could + either be a 400 Bad Request or any other Error status code. + + + + #. + If the Matrix Route request was accepted successfully, the Location header in the response + contains the URL to download the results of the request. This status URI looks like the + following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + + #. Client issues a GET request on the download URL obtained in Step 3 to download the results + + Download Sync Results + ^^^^^^^^^^^^^^^^^^^^^ + + When you make a POST request for Route Matrix Sync API, the service returns 200 response code + for successful request and a response array. The response body will contain the data and there + will be no possibility to retrieve the results later. + + Download Async Results + ^^^^^^^^^^^^^^^^^^^^^^ + + When a request issues a ``202 Accepted`` response, the request is being processed using our + async pipeline. You will be given a URL to check the progress of your async request in the + location header of the response. This status URI looks like the following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + The URL provided by the location header will return the following responses when a ``GET`` + request is issued. + + .. + + HTTP ``202 Accepted`` - Matrix request was accepted but is still being processed. Please try + again in some time. + + HTTP ``200 OK`` - Matrix request successfully processed. The response body contains all of + the results. + + :param route_matrix_query: The matrix of origin and destination coordinates to compute the + route distance, travel time and other summary for each cell of the matrix based on the input + parameters. The minimum and the maximum cell count supported are 1 and **700** for async and + **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 + origins and 25 destinations for async API. + :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :param wait_for_results: Boolean to indicate whether to execute the request synchronously. If + set to true, user will get a 200 response if the request is finished under 120 seconds. + Otherwise, user will get a 202 response right away. Please refer to the API description for + more details on 202 response. **Supported only for async request**. + :type wait_for_results: bool + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + :type vehicle_weight: int + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteMatrixResult, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteMatrixResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.request_route_matrix_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_matrix_query, 'RouteMatrixQuery') + 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('RouteMatrixResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + request_route_matrix_sync.metadata = {'url': '/route/matrix/sync/{format}'} # type: ignore + + async def get_route_directions( + self, + route_points: str, + format: Union[str, "_models.ResponseFormat"] = "json", + max_alternatives: Optional[int] = None, + alternative_type: Optional[Union[str, "_models.AlternativeRouteType"]] = None, + min_deviation_distance: Optional[int] = None, + arrive_at: Optional[datetime.datetime] = None, + depart_at: Optional[datetime.datetime] = None, + min_deviation_time: Optional[int] = None, + instructions_type: Optional[Union[str, "_models.RouteInstructionsType"]] = None, + language: Optional[str] = None, + compute_best_waypoint_order: Optional[bool] = None, + route_representation_for_best_order: Optional[Union[str, "_models.RouteRepresentationForBestOrder"]] = None, + compute_travel_time: Optional[Union[str, "_models.ComputeTravelTime"]] = None, + vehicle_heading: Optional[int] = None, + report: Optional[Union[str, "_models.Report"]] = None, + filter_section_type: Optional[Union[str, "_models.SectionType"]] = None, + vehicle_axle_weight: Optional[int] = 0, + vehicle_width: Optional[float] = 0, + vehicle_height: Optional[float] = 0, + vehicle_length: Optional[float] = 0, + vehicle_max_speed: Optional[int] = 0, + vehicle_weight: Optional[int] = 0, + is_commercial_vehicle: Optional[bool] = False, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + incline_level: Optional[Union[str, "_models.InclineLevel"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + use_traffic_data: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + vehicle_engine_type: Optional[Union[str, "_models.VehicleEngineType"]] = None, + constant_speed_consumption_in_liters_per_hundred_km: Optional[str] = None, + current_fuel_in_liters: Optional[float] = None, + auxiliary_power_in_liters_per_hour: Optional[float] = None, + fuel_energy_density_in_megajoules_per_liter: Optional[float] = None, + acceleration_efficiency: Optional[float] = None, + deceleration_efficiency: Optional[float] = None, + uphill_efficiency: Optional[float] = None, + downhill_efficiency: Optional[float] = None, + constant_speed_consumption_in_kw_h_per_hundred_km: Optional[str] = None, + current_charge_in_kw_h: Optional[float] = None, + max_charge_in_kw_h: Optional[float] = None, + auxiliary_power_in_kw: Optional[float] = None, + **kwargs: Any + ) -> "_models.RouteDirections": + """**Applies to**\ : S0 and S1 pricing tiers. + + Returns a route between an origin and a destination, passing through waypoints if they are + specified. The route will take into account factors such as current traffic and the typical + road speeds on the requested day of the week and time of day. + + Information returned includes the distance, estimated travel time, and a representation of the + route geometry. Additional routing information such as optimized waypoint order or turn by turn + instructions is also available, depending on the options selected. + + Routing service provides a set of parameters for a detailed description of vehicle-specific + Consumption Model. Please check `Consumption Model + `_ for detailed explanation of + the concepts and parameters involved. + + :param route_points: The Coordinates through which the route is calculated, delimited by a + colon. A minimum of two coordinates is required. The first one is the origin and the last is + the destination of the route. Optional coordinates in-between act as WayPoints in the route. + You can pass up to 150 WayPoints. + :type route_points: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param max_alternatives: Number of desired alternative routes to be calculated. Default: 0, + minimum: 0 and maximum: 5. + :type max_alternatives: int + :param alternative_type: Controls the optimality, with respect to the given planning criteria, + of the calculated alternatives compared to the reference route. + :type alternative_type: str or ~azure.maps.route.models.AlternativeRouteType + :param min_deviation_distance: All alternative routes returned will follow the reference route + (see section POST Requests) from the origin point of the calculateRoute request for at least + this number of meters. Can only be used when reconstructing a route. The minDeviationDistance + parameter cannot be used in conjunction with arriveAt. + :type min_deviation_distance: int + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param min_deviation_time: All alternative routes returned will follow the reference route (see + section POST Requests) from the origin point of the calculateRoute request for at least this + number of seconds. Can only be used when reconstructing a route. The minDeviationTime parameter + cannot be used in conjunction with arriveAt. Default value is 0. Setting )minDeviationTime_ to + a value greater than zero has the following consequences: + + + * The origin point of the *calculateRoute* Request must be on + (or very near) the input reference route. + + * If this is not the case, an error is returned. + * However, the origin point does not need to be at the beginning + of the input reference route (it can be thought of as the current + vehicle position on the reference route). + + * The reference route, returned as the first route in the *calculateRoute* + Response, will start at the origin point specified in the *calculateRoute* + Request. The initial part of the input reference route up until the origin + point will be excluded from the Response. + * The values of *minDeviationDistance* and *minDeviationTime* determine + how far alternative routes will be guaranteed to follow the reference + route from the origin point onwards. + * The route must use *departAt*. + * The *vehicleHeading* is ignored. + :type min_deviation_time: int + :param instructions_type: If specified, guidance instructions will be returned. Note that the + instructionsType parameter cannot be used in conjunction with routeRepresentation=none. + :type instructions_type: str or ~azure.maps.route.models.RouteInstructionsType + :param language: The language parameter determines the language of the guidance messages. + Proper nouns (the names of streets, plazas, etc.) are returned in the specified language, or + if that is not available, they are returned in an available language that is close to it. + Allowed values are (a subset of) the IETF language tags. The currently supported languages are + listed in the `Supported languages section + `_. + + Default value: en-GB. + :type language: str + :param compute_best_waypoint_order: Re-order the route waypoints using a fast heuristic + algorithm to reduce the route length. Yields best results when used in conjunction with + routeType *shortest*. Notice that origin and destination are excluded from the optimized + waypoint indices. To include origin and destination in the response, please increase all the + indices by 1 to account for the origin, and then add the destination as the final index. + Possible values are true or false. True computes a better order if possible, but is not allowed + to be used in conjunction with maxAlternatives value greater than 0 or in conjunction with + circle waypoints. False will use the locations in the given order and not allowed to be used in + conjunction with routeRepresentation *none*. + :type compute_best_waypoint_order: bool + :param route_representation_for_best_order: Specifies the representation of the set of routes + provided as response. This parameter value can only be used in conjunction with + computeBestOrder=true. + :type route_representation_for_best_order: str or ~azure.maps.route.models.RouteRepresentationForBestOrder + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param vehicle_heading: The directional heading of the vehicle in degrees starting at true + North and continuing in clockwise direction. North is 0 degrees, east is 90 degrees, south is + 180 degrees, west is 270 degrees. Possible values 0-359. + :type vehicle_heading: int + :param report: Specifies which data should be reported for diagnosis purposes. The only + possible value is *effectiveSettings*. Reports the effective parameters or data used when + calling the API. In the case of defaulted parameters the default will be reflected where the + parameter was not specified by the caller. + :type report: str or ~azure.maps.route.models.Report + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + + + * + It is mandatory if any of the *Efficiency parameters are set. + + * + It must be strictly positive when used in the context of the Consumption Model. Weight + restrictions are considered. + + * + If no detailed **Consumption Model** is specified and the value of **vehicleWeight** is + non-zero, then weight restrictions are considered. + + * + In all other cases, this parameter is ignored. + + Sensible Values : for **Combustion Model** : 1600, for **Electric Model** : 1900. + :type vehicle_weight: int + :param is_commercial_vehicle: Whether the vehicle is used for commercial purposes. Commercial + vehicles may not be allowed to drive on some roads. + :type is_commercial_vehicle: bool + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :param vehicle_engine_type: Engine type of the vehicle. When a detailed Consumption Model is + specified, it must be consistent with the value of **vehicleEngineType**. + :type vehicle_engine_type: str or ~azure.maps.route.models.VehicleEngineType + :param constant_speed_consumption_in_liters_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of colon-delimited speed & consumption-rate pairs. The list + defines points on a consumption curve. Consumption rates for speeds not in the list are found + as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in l/100km) is between 0.01 and 100000.0. + + Sensible Values : 50,6.3:130,11.5 + + **Note** : This parameter is required for **The Combustion Consumption Model**. + :type constant_speed_consumption_in_liters_per_hundred_km: str + :param current_fuel_in_liters: Specifies the current supply of fuel in liters. + + Sensible Values : 55. + :type current_fuel_in_liters: float + :param auxiliary_power_in_liters_per_hour: Specifies the amount of fuel consumed for sustaining + auxiliary systems of the vehicle, in liters per hour. + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 0.2. + :type auxiliary_power_in_liters_per_hour: float + :param fuel_energy_density_in_megajoules_per_liter: Specifies the amount of chemical energy + stored in one liter of fuel in megajoules (MJ). It is used in conjunction with the + ***Efficiency** parameters for conversions between saved or consumed energy and fuel. For + example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel. + + This parameter is required if any ***Efficiency** parameter is set. + + Sensible Values : 34.2. + :type fuel_energy_density_in_megajoules_per_liter: float + :param acceleration_efficiency: Specifies the efficiency of converting chemical energy stored + in fuel to kinetic energy when the vehicle accelerates *(i.e. + KineticEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by converting + consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **decelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **decelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.33, for **Electric Model** : 0.66. + :type acceleration_efficiency: float + :param deceleration_efficiency: Specifies the efficiency of converting kinetic energy to saved + (not consumed) fuel when the vehicle decelerates *(i.e. ChemicalEnergySaved/KineticEnergyLost). + ChemicalEnergySaved* is obtained by converting saved (not consumed) fuel to energy using + **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **accelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **accelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.83, for **Electric Model** : 0.91. + :type deceleration_efficiency: float + :param uphill_efficiency: Specifies the efficiency of converting chemical energy stored in fuel + to potential energy when the vehicle gains elevation *(i.e. + PotentialEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by + converting consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **downhillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **downhillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.27, for **Electric Model** : 0.74. + :type uphill_efficiency: float + :param downhill_efficiency: Specifies the efficiency of converting potential energy to saved + (not consumed) fuel when the vehicle loses elevation *(i.e. + ChemicalEnergySaved/PotentialEnergyLost). ChemicalEnergySaved* is obtained by converting saved + (not consumed) fuel to energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **uphillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **uphillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.51, for **Electric Model** : 0.73. + :type downhill_efficiency: float + :param constant_speed_consumption_in_kw_h_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a + consumption curve. Consumption rates for speeds not in the list are found as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in kWh/100km) is between 0.01 and + 100000.0. + + Sensible Values : 50,8.2:130,21.3 + + This parameter is required for **Electric consumption model**. + :type constant_speed_consumption_in_kw_h_per_hundred_km: str + :param current_charge_in_kw_h: Specifies the current electric energy supply in kilowatt hours + (kWh). + + This parameter co-exists with **maxChargeInkWh** parameter. + + The range of values allowed are 0.0 to **maxChargeInkWh**. + + Sensible Values : 43. + :type current_charge_in_kw_h: float + :param max_charge_in_kw_h: Specifies the maximum electric energy supply in kilowatt hours (kWh) + that may be stored in the vehicle's battery. + + This parameter co-exists with **currentChargeInkWh** parameter. + + Minimum value has to be greater than or equal to **currentChargeInkWh**. + + Sensible Values : 85. + :type max_charge_in_kw_h: float + :param auxiliary_power_in_kw: Specifies the amount of power consumed for sustaining auxiliary + systems, in kilowatts (kW). + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 1.7. + :type auxiliary_power_in_kw: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirections, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirections + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirections"] + 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_route_directions.metadata['url'] # type: ignore + path_format_arguments = { + '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("route_points", route_points, 'str') + if max_alternatives is not None: + query_parameters['maxAlternatives'] = self._serialize.query("max_alternatives", max_alternatives, 'int', maximum=5, minimum=0) + if alternative_type is not None: + query_parameters['alternativeType'] = self._serialize.query("alternative_type", alternative_type, 'str') + if min_deviation_distance is not None: + query_parameters['minDeviationDistance'] = self._serialize.query("min_deviation_distance", min_deviation_distance, 'int') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if min_deviation_time is not None: + query_parameters['minDeviationTime'] = self._serialize.query("min_deviation_time", min_deviation_time, 'int') + if instructions_type is not None: + query_parameters['instructionsType'] = self._serialize.query("instructions_type", instructions_type, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if compute_best_waypoint_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_waypoint_order", compute_best_waypoint_order, 'bool') + if route_representation_for_best_order is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation_for_best_order", route_representation_for_best_order, 'str') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if vehicle_heading is not None: + query_parameters['vehicleHeading'] = self._serialize.query("vehicle_heading", vehicle_heading, 'int', maximum=359, minimum=0) + if report is not None: + query_parameters['report'] = self._serialize.query("report", report, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if is_commercial_vehicle is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("is_commercial_vehicle", is_commercial_vehicle, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + if vehicle_engine_type is not None: + query_parameters['vehicleEngineType'] = self._serialize.query("vehicle_engine_type", vehicle_engine_type, 'str') + if constant_speed_consumption_in_liters_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundred_km", constant_speed_consumption_in_liters_per_hundred_km, 'str') + if current_fuel_in_liters is not None: + query_parameters['currentFuelInLiters'] = self._serialize.query("current_fuel_in_liters", current_fuel_in_liters, 'float') + if auxiliary_power_in_liters_per_hour is not None: + query_parameters['auxiliaryPowerInLitersPerHour'] = self._serialize.query("auxiliary_power_in_liters_per_hour", auxiliary_power_in_liters_per_hour, 'float') + if fuel_energy_density_in_megajoules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_megajoules_per_liter", fuel_energy_density_in_megajoules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float', maximum=1, minimum=0) + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float', maximum=1, minimum=0) + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float', maximum=1, minimum=0) + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float', maximum=1, minimum=0) + if constant_speed_consumption_in_kw_h_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_kw_h_per_hundred_km", constant_speed_consumption_in_kw_h_per_hundred_km, 'str') + if current_charge_in_kw_h is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_in_kw_h", current_charge_in_kw_h, 'float') + if max_charge_in_kw_h is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_in_kw_h", max_charge_in_kw_h, 'float') + if auxiliary_power_in_kw is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_in_kw", auxiliary_power_in_kw, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('RouteDirections', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_directions.metadata = {'url': '/route/directions/{format}'} # type: ignore + + async def get_route_directions_with_additional_parameters( + self, + route_points: str, + route_direction_parameters: "_models.RouteDirectionParameters", + format: Union[str, "_models.ResponseFormat"] = "json", + max_alternatives: Optional[int] = None, + alternative_type: Optional[Union[str, "_models.AlternativeRouteType"]] = None, + min_deviation_distance: Optional[int] = None, + min_deviation_time: Optional[int] = None, + instructions_type: Optional[Union[str, "_models.RouteInstructionsType"]] = None, + language: Optional[str] = None, + compute_best_waypoint_order: Optional[bool] = None, + route_representation_for_best_order: Optional[Union[str, "_models.RouteRepresentationForBestOrder"]] = None, + compute_travel_time: Optional[Union[str, "_models.ComputeTravelTime"]] = None, + vehicle_heading: Optional[int] = None, + report: Optional[Union[str, "_models.Report"]] = None, + filter_section_type: Optional[Union[str, "_models.SectionType"]] = None, + arrive_at: Optional[datetime.datetime] = None, + depart_at: Optional[datetime.datetime] = None, + vehicle_axle_weight: Optional[int] = 0, + vehicle_length: Optional[float] = 0, + vehicle_height: Optional[float] = 0, + vehicle_width: Optional[float] = 0, + vehicle_max_speed: Optional[int] = 0, + vehicle_weight: Optional[int] = 0, + is_commercial_vehicle: Optional[bool] = False, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + incline_level: Optional[Union[str, "_models.InclineLevel"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + use_traffic_data: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + vehicle_engine_type: Optional[Union[str, "_models.VehicleEngineType"]] = None, + constant_speed_consumption_in_liters_per_hundred_km: Optional[str] = None, + current_fuel_in_liters: Optional[float] = None, + auxiliary_power_in_liters_per_hour: Optional[float] = None, + fuel_energy_density_in_megajoules_per_liter: Optional[float] = None, + acceleration_efficiency: Optional[float] = None, + deceleration_efficiency: Optional[float] = None, + uphill_efficiency: Optional[float] = None, + downhill_efficiency: Optional[float] = None, + constant_speed_consumption_in_kw_h_per_hundred_km: Optional[str] = None, + current_charge_in_kw_h: Optional[float] = None, + max_charge_in_kw_h: Optional[float] = None, + auxiliary_power_in_kw: Optional[float] = None, + **kwargs: Any + ) -> "_models.RouteDirections": + """**Applies to**\ : S0 and S1 pricing tiers. + + Returns a route between an origin and a destination, passing through waypoints if they are + specified. The route will take into account factors such as current traffic and the typical + road speeds on the requested day of the week and time of day. + + Information returned includes the distance, estimated travel time, and a representation of the + route geometry. Additional routing information such as optimized waypoint order or turn by turn + instructions is also available, depending on the options selected. + + Routing service provides a set of parameters for a detailed description of a vehicle-specific + Consumption Model. Please check `Consumption Model + `_ for detailed explanation of + the concepts and parameters involved. + + :param route_points: The Coordinates through which the route is calculated, delimited by a + colon. A minimum of two coordinates is required. The first one is the origin and the last is + the destination of the route. Optional coordinates in-between act as WayPoints in the route. + You can pass up to 150 WayPoints. + :type route_points: str + :param route_direction_parameters: Used for reconstructing a route and for calculating zero or + more alternative routes to this reference route. The provided sequence of coordinates is used + as input for route reconstruction. The alternative routes are calculated between the origin + and destination points specified in the base path parameter locations. If both + minDeviationDistance and minDeviationTime are set to zero, then these origin and destination + points are expected to be at (or very near) the beginning and end of the reference route, + respectively. Intermediate locations (waypoints) are not supported when using + supportingPoints. + + Setting at least one of minDeviationDistance or minDeviationTime to a value greater than zero + has the following consequences: + + + * The origin point of the calculateRoute request must be on (or very near) the input reference + route. If this is not the case, an error is returned. However, the origin point does not need + to be at the beginning of the input reference route (it can be thought of as the current + vehicle position on the reference route). + * The reference route, returned as the first route in the calculateRoute response, will start + at the origin point specified in the calculateRoute request. The initial part of the input + reference route up until the origin point will be excluded from the response. + * The values of minDeviationDistance and minDeviationTime determine how far alternative routes + will be guaranteed to follow the reference route from the origin point onwards. + * The route must use departAt. + * The vehicleHeading is ignored. + :type route_direction_parameters: ~azure.maps.route.models.RouteDirectionParameters + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param max_alternatives: Number of desired alternative routes to be calculated. Default: 0, + minimum: 0 and maximum: 5. + :type max_alternatives: int + :param alternative_type: Controls the optimality, with respect to the given planning criteria, + of the calculated alternatives compared to the reference route. + :type alternative_type: str or ~azure.maps.route.models.AlternativeRouteType + :param min_deviation_distance: All alternative routes returned will follow the reference route + (see section POST Requests) from the origin point of the calculateRoute request for at least + this number of meters. Can only be used when reconstructing a route. The minDeviationDistance + parameter cannot be used in conjunction with arriveAt. + :type min_deviation_distance: int + :param min_deviation_time: All alternative routes returned will follow the reference route (see + section POST Requests) from the origin point of the calculateRoute request for at least this + number of seconds. Can only be used when reconstructing a route. The minDeviationTime parameter + cannot be used in conjunction with arriveAt. Default value is 0. Setting )minDeviationTime_ to + a value greater than zero has the following consequences: + + + * The origin point of the *calculateRoute* Request must be on + (or very near) the input reference route. + + * If this is not the case, an error is returned. + * However, the origin point does not need to be at the beginning + of the input reference route (it can be thought of as the current + vehicle position on the reference route). + + * The reference route, returned as the first route in the *calculateRoute* + Response, will start at the origin point specified in the *calculateRoute* + Request. The initial part of the input reference route up until the origin + point will be excluded from the Response. + * The values of *minDeviationDistance* and *minDeviationTime* determine + how far alternative routes will be guaranteed to follow the reference + route from the origin point onwards. + * The route must use *departAt*. + * The *vehicleHeading* is ignored. + :type min_deviation_time: int + :param instructions_type: If specified, guidance instructions will be returned. Note that the + instructionsType parameter cannot be used in conjunction with routeRepresentation=none. + :type instructions_type: str or ~azure.maps.route.models.RouteInstructionsType + :param language: The language parameter determines the language of the guidance messages. It + does not affect proper nouns (the names of streets, plazas, etc.) It has no effect when + instructionsType=coded. Allowed values are (a subset of) the IETF language tags described. + :type language: str + :param compute_best_waypoint_order: Re-order the route waypoints using a fast heuristic + algorithm to reduce the route length. Yields best results when used in conjunction with + routeType *shortest*. Notice that origin and destination are excluded from the optimized + waypoint indices. To include origin and destination in the response, please increase all the + indices by 1 to account for the origin, and then add the destination as the final index. + Possible values are true or false. True computes a better order if possible, but is not allowed + to be used in conjunction with maxAlternatives value greater than 0 or in conjunction with + circle waypoints. False will use the locations in the given order and not allowed to be used in + conjunction with routeRepresentation *none*. + :type compute_best_waypoint_order: bool + :param route_representation_for_best_order: Specifies the representation of the set of routes + provided as response. This parameter value can only be used in conjunction with + computeBestOrder=true. + :type route_representation_for_best_order: str or ~azure.maps.route.models.RouteRepresentationForBestOrder + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param vehicle_heading: The directional heading of the vehicle in degrees starting at true + North and continuing in clockwise direction. North is 0 degrees, east is 90 degrees, south is + 180 degrees, west is 270 degrees. Possible values 0-359. + :type vehicle_heading: int + :param report: Specifies which data should be reported for diagnosis purposes. The only + possible value is *effectiveSettings*. Reports the effective parameters or data used when + calling the API. In the case of defaulted parameters the default will be reflected where the + parameter was not specified by the caller. + :type report: str or ~azure.maps.route.models.Report + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + + + * + It is mandatory if any of the *Efficiency parameters are set. + + * + It must be strictly positive when used in the context of the Consumption Model. Weight + restrictions are considered. + + * + If no detailed **Consumption Model** is specified and the value of **vehicleWeight** is + non-zero, then weight restrictions are considered. + + * + In all other cases, this parameter is ignored. + + Sensible Values : for **Combustion Model** : 1600, for **Electric Model** : 1900. + :type vehicle_weight: int + :param is_commercial_vehicle: Whether the vehicle is used for commercial purposes. Commercial + vehicles may not be allowed to drive on some roads. + :type is_commercial_vehicle: bool + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :param vehicle_engine_type: Engine type of the vehicle. When a detailed Consumption Model is + specified, it must be consistent with the value of **vehicleEngineType**. + :type vehicle_engine_type: str or ~azure.maps.route.models.VehicleEngineType + :param constant_speed_consumption_in_liters_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of colon-delimited speed & consumption-rate pairs. The list + defines points on a consumption curve. Consumption rates for speeds not in the list are found + as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in l/100km) is between 0.01 and 100000.0. + + Sensible Values : 50,6.3:130,11.5 + + **Note** : This parameter is required for **The Combustion Consumption Model**. + :type constant_speed_consumption_in_liters_per_hundred_km: str + :param current_fuel_in_liters: Specifies the current supply of fuel in liters. + + Sensible Values : 55. + :type current_fuel_in_liters: float + :param auxiliary_power_in_liters_per_hour: Specifies the amount of fuel consumed for sustaining + auxiliary systems of the vehicle, in liters per hour. + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 0.2. + :type auxiliary_power_in_liters_per_hour: float + :param fuel_energy_density_in_megajoules_per_liter: Specifies the amount of chemical energy + stored in one liter of fuel in megajoules (MJ). It is used in conjunction with the + ***Efficiency** parameters for conversions between saved or consumed energy and fuel. For + example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel. + + This parameter is required if any ***Efficiency** parameter is set. + + Sensible Values : 34.2. + :type fuel_energy_density_in_megajoules_per_liter: float + :param acceleration_efficiency: Specifies the efficiency of converting chemical energy stored + in fuel to kinetic energy when the vehicle accelerates *(i.e. + KineticEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by converting + consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **decelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **decelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.33, for **Electric Model** : 0.66. + :type acceleration_efficiency: float + :param deceleration_efficiency: Specifies the efficiency of converting kinetic energy to saved + (not consumed) fuel when the vehicle decelerates *(i.e. ChemicalEnergySaved/KineticEnergyLost). + ChemicalEnergySaved* is obtained by converting saved (not consumed) fuel to energy using + **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **accelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **accelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.83, for **Electric Model** : 0.91. + :type deceleration_efficiency: float + :param uphill_efficiency: Specifies the efficiency of converting chemical energy stored in fuel + to potential energy when the vehicle gains elevation *(i.e. + PotentialEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by + converting consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **downhillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **downhillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.27, for **Electric Model** : 0.74. + :type uphill_efficiency: float + :param downhill_efficiency: Specifies the efficiency of converting potential energy to saved + (not consumed) fuel when the vehicle loses elevation *(i.e. + ChemicalEnergySaved/PotentialEnergyLost). ChemicalEnergySaved* is obtained by converting saved + (not consumed) fuel to energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **uphillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **uphillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.51, for **Electric Model** : 0.73. + :type downhill_efficiency: float + :param constant_speed_consumption_in_kw_h_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a + consumption curve. Consumption rates for speeds not in the list are found as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in kWh/100km) is between 0.01 and + 100000.0. + + Sensible Values : 50,8.2:130,21.3 + + This parameter is required for **Electric consumption model**. + :type constant_speed_consumption_in_kw_h_per_hundred_km: str + :param current_charge_in_kw_h: Specifies the current electric energy supply in kilowatt hours + (kWh). + + This parameter co-exists with **maxChargeInkWh** parameter. + + The range of values allowed are 0.0 to **maxChargeInkWh**. + + Sensible Values : 43. + :type current_charge_in_kw_h: float + :param max_charge_in_kw_h: Specifies the maximum electric energy supply in kilowatt hours (kWh) + that may be stored in the vehicle's battery. + + This parameter co-exists with **currentChargeInkWh** parameter. + + Minimum value has to be greater than or equal to **currentChargeInkWh**. + + Sensible Values : 85. + :type max_charge_in_kw_h: float + :param auxiliary_power_in_kw: Specifies the amount of power consumed for sustaining auxiliary + systems, in kilowatts (kW). + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 1.7. + :type auxiliary_power_in_kw: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirections, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirections + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirections"] + 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.get_route_directions_with_additional_parameters.metadata['url'] # type: ignore + path_format_arguments = { + '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("route_points", route_points, 'str') + if max_alternatives is not None: + query_parameters['maxAlternatives'] = self._serialize.query("max_alternatives", max_alternatives, 'int', maximum=5, minimum=0) + if alternative_type is not None: + query_parameters['alternativeType'] = self._serialize.query("alternative_type", alternative_type, 'str') + if min_deviation_distance is not None: + query_parameters['minDeviationDistance'] = self._serialize.query("min_deviation_distance", min_deviation_distance, 'int') + if min_deviation_time is not None: + query_parameters['minDeviationTime'] = self._serialize.query("min_deviation_time", min_deviation_time, 'int') + if instructions_type is not None: + query_parameters['instructionsType'] = self._serialize.query("instructions_type", instructions_type, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if compute_best_waypoint_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_waypoint_order", compute_best_waypoint_order, 'bool') + if route_representation_for_best_order is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation_for_best_order", route_representation_for_best_order, 'str') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if vehicle_heading is not None: + query_parameters['vehicleHeading'] = self._serialize.query("vehicle_heading", vehicle_heading, 'int', maximum=359, minimum=0) + if report is not None: + query_parameters['report'] = self._serialize.query("report", report, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if is_commercial_vehicle is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("is_commercial_vehicle", is_commercial_vehicle, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + if vehicle_engine_type is not None: + query_parameters['vehicleEngineType'] = self._serialize.query("vehicle_engine_type", vehicle_engine_type, 'str') + if constant_speed_consumption_in_liters_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundred_km", constant_speed_consumption_in_liters_per_hundred_km, 'str') + if current_fuel_in_liters is not None: + query_parameters['currentFuelInLiters'] = self._serialize.query("current_fuel_in_liters", current_fuel_in_liters, 'float') + if auxiliary_power_in_liters_per_hour is not None: + query_parameters['auxiliaryPowerInLitersPerHour'] = self._serialize.query("auxiliary_power_in_liters_per_hour", auxiliary_power_in_liters_per_hour, 'float') + if fuel_energy_density_in_megajoules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_megajoules_per_liter", fuel_energy_density_in_megajoules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float', maximum=1, minimum=0) + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float', maximum=1, minimum=0) + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float', maximum=1, minimum=0) + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float', maximum=1, minimum=0) + if constant_speed_consumption_in_kw_h_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_kw_h_per_hundred_km", constant_speed_consumption_in_kw_h_per_hundred_km, 'str') + if current_charge_in_kw_h is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_in_kw_h", current_charge_in_kw_h, 'float') + if max_charge_in_kw_h is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_in_kw_h", max_charge_in_kw_h, 'float') + if auxiliary_power_in_kw is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_in_kw", auxiliary_power_in_kw, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_direction_parameters, 'RouteDirectionParameters') + 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('RouteDirections', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_directions_with_additional_parameters.metadata = {'url': '/route/directions/{format}'} # type: ignore + + async def get_route_range( + self, + query: List[float], + format: Union[str, "_models.ResponseFormat"] = "json", + fuel_budget_in_liters: Optional[float] = None, + energy_budget_in_kw_h: Optional[float] = None, + time_budget_in_sec: Optional[float] = None, + distance_budget_in_meters: Optional[float] = None, + depart_at: Optional[datetime.datetime] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + use_traffic_data: Optional[bool] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + incline_level: Optional[Union[str, "_models.InclineLevel"]] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + vehicle_axle_weight: Optional[int] = 0, + vehicle_width: Optional[float] = 0, + vehicle_height: Optional[float] = 0, + vehicle_length: Optional[float] = 0, + vehicle_max_speed: Optional[int] = 0, + vehicle_weight: Optional[int] = 0, + is_commercial_vehicle: Optional[bool] = False, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + vehicle_engine_type: Optional[Union[str, "_models.VehicleEngineType"]] = None, + constant_speed_consumption_in_liters_per_hundred_km: Optional[str] = None, + current_fuel_in_liters: Optional[float] = None, + auxiliary_power_in_liters_per_hour: Optional[float] = None, + fuel_energy_density_in_megajoules_per_liter: Optional[float] = None, + acceleration_efficiency: Optional[float] = None, + deceleration_efficiency: Optional[float] = None, + uphill_efficiency: Optional[float] = None, + downhill_efficiency: Optional[float] = None, + constant_speed_consumption_in_kw_h_per_hundred_km: Optional[str] = None, + current_charge_in_kw_h: Optional[float] = None, + max_charge_in_kw_h: Optional[float] = None, + auxiliary_power_in_kw: Optional[float] = None, + **kwargs: Any + ) -> "_models.RouteRangeResult": + """**Route Range (Isochrone) API** + + **Applies to**\ : S1 pricing tier. + + This service will calculate a set of locations that can be reached from the origin point based + on fuel, energy, time or distance budget that is specified. A polygon boundary (or Isochrone) + is returned in a counterclockwise orientation as well as the precise polygon center which was + the result of the origin point. + + The returned polygon can be used for further processing such as `Search Inside Geometry + `_ to search for + POIs within the provided Isochrone. + + :param query: The Coordinate from which the range calculation should start. + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param fuel_budget_in_liters: Fuel budget in liters that determines maximal range which can be + travelled using the specified Combustion Consumption Model.:code:`
` When fuelBudgetInLiters + is used, it is mandatory to specify a detailed Combustion Consumption Model.:code:`
` + Exactly one budget (fuelBudgetInLiters, energyBudgetInkWh, timeBudgetInSec, or + distanceBudgetInMeters) must be used. + :type fuel_budget_in_liters: float + :param energy_budget_in_kw_h: Electric energy budget in kilowatt hours (kWh) that determines + maximal range which can be travelled using the specified Electric Consumption + Model.:code:`
` When energyBudgetInkWh is used, it is mandatory to specify a detailed + Electric Consumption Model.:code:`
` Exactly one budget (fuelBudgetInLiters, + energyBudgetInkWh, timeBudgetInSec, or distanceBudgetInMeters) must be used. + :type energy_budget_in_kw_h: float + :param time_budget_in_sec: Time budget in seconds that determines maximal range which can be + travelled using driving time. The Consumption Model will only affect the range when routeType + is eco.:code:`
` Exactly one budget (fuelBudgetInLiters, energyBudgetInkWh, timeBudgetInSec, + or distanceBudgetInMeters) must be used. + :type time_budget_in_sec: float + :param distance_budget_in_meters: Distance budget in meters that determines maximal range which + can be travelled using driving distance. The Consumption Model will only affect the range when + routeType is eco.:code:`
` Exactly one budget (fuelBudgetInLiters, energyBudgetInkWh, + timeBudgetInSec, or distanceBudgetInMeters) must be used. + :type distance_budget_in_meters: float + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + + + * + It is mandatory if any of the *Efficiency parameters are set. + + * + It must be strictly positive when used in the context of the Consumption Model. Weight + restrictions are considered. + + * + If no detailed **Consumption Model** is specified and the value of **vehicleWeight** is + non-zero, then weight restrictions are considered. + + * + In all other cases, this parameter is ignored. + + Sensible Values : for **Combustion Model** : 1600, for **Electric Model** : 1900. + :type vehicle_weight: int + :param is_commercial_vehicle: Whether the vehicle is used for commercial purposes. Commercial + vehicles may not be allowed to drive on some roads. + :type is_commercial_vehicle: bool + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :param vehicle_engine_type: Engine type of the vehicle. When a detailed Consumption Model is + specified, it must be consistent with the value of **vehicleEngineType**. + :type vehicle_engine_type: str or ~azure.maps.route.models.VehicleEngineType + :param constant_speed_consumption_in_liters_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of colon-delimited speed & consumption-rate pairs. The list + defines points on a consumption curve. Consumption rates for speeds not in the list are found + as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in l/100km) is between 0.01 and 100000.0. + + Sensible Values : 50,6.3:130,11.5 + + **Note** : This parameter is required for **The Combustion Consumption Model**. + :type constant_speed_consumption_in_liters_per_hundred_km: str + :param current_fuel_in_liters: Specifies the current supply of fuel in liters. + + Sensible Values : 55. + :type current_fuel_in_liters: float + :param auxiliary_power_in_liters_per_hour: Specifies the amount of fuel consumed for sustaining + auxiliary systems of the vehicle, in liters per hour. + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 0.2. + :type auxiliary_power_in_liters_per_hour: float + :param fuel_energy_density_in_megajoules_per_liter: Specifies the amount of chemical energy + stored in one liter of fuel in megajoules (MJ). It is used in conjunction with the + ***Efficiency** parameters for conversions between saved or consumed energy and fuel. For + example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel. + + This parameter is required if any ***Efficiency** parameter is set. + + Sensible Values : 34.2. + :type fuel_energy_density_in_megajoules_per_liter: float + :param acceleration_efficiency: Specifies the efficiency of converting chemical energy stored + in fuel to kinetic energy when the vehicle accelerates *(i.e. + KineticEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by converting + consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **decelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **decelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.33, for **Electric Model** : 0.66. + :type acceleration_efficiency: float + :param deceleration_efficiency: Specifies the efficiency of converting kinetic energy to saved + (not consumed) fuel when the vehicle decelerates *(i.e. ChemicalEnergySaved/KineticEnergyLost). + ChemicalEnergySaved* is obtained by converting saved (not consumed) fuel to energy using + **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **accelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **accelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.83, for **Electric Model** : 0.91. + :type deceleration_efficiency: float + :param uphill_efficiency: Specifies the efficiency of converting chemical energy stored in fuel + to potential energy when the vehicle gains elevation *(i.e. + PotentialEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by + converting consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **downhillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **downhillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.27, for **Electric Model** : 0.74. + :type uphill_efficiency: float + :param downhill_efficiency: Specifies the efficiency of converting potential energy to saved + (not consumed) fuel when the vehicle loses elevation *(i.e. + ChemicalEnergySaved/PotentialEnergyLost). ChemicalEnergySaved* is obtained by converting saved + (not consumed) fuel to energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **uphillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **uphillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.51, for **Electric Model** : 0.73. + :type downhill_efficiency: float + :param constant_speed_consumption_in_kw_h_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a + consumption curve. Consumption rates for speeds not in the list are found as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in kWh/100km) is between 0.01 and + 100000.0. + + Sensible Values : 50,8.2:130,21.3 + + This parameter is required for **Electric consumption model**. + :type constant_speed_consumption_in_kw_h_per_hundred_km: str + :param current_charge_in_kw_h: Specifies the current electric energy supply in kilowatt hours + (kWh). + + This parameter co-exists with **maxChargeInkWh** parameter. + + The range of values allowed are 0.0 to **maxChargeInkWh**. + + Sensible Values : 43. + :type current_charge_in_kw_h: float + :param max_charge_in_kw_h: Specifies the maximum electric energy supply in kilowatt hours (kWh) + that may be stored in the vehicle's battery. + + This parameter co-exists with **currentChargeInkWh** parameter. + + Minimum value has to be greater than or equal to **currentChargeInkWh**. + + Sensible Values : 85. + :type max_charge_in_kw_h: float + :param auxiliary_power_in_kw: Specifies the amount of power consumed for sustaining auxiliary + systems, in kilowatts (kW). + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 1.7. + :type auxiliary_power_in_kw: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteRangeResult, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteRangeResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteRangeResult"] + 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_route_range.metadata['url'] # type: ignore + path_format_arguments = { + '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, '[float]', div=',') + if fuel_budget_in_liters is not None: + query_parameters['fuelBudgetInLiters'] = self._serialize.query("fuel_budget_in_liters", fuel_budget_in_liters, 'float') + if energy_budget_in_kw_h is not None: + query_parameters['energyBudgetInkWh'] = self._serialize.query("energy_budget_in_kw_h", energy_budget_in_kw_h, 'float') + if time_budget_in_sec is not None: + query_parameters['timeBudgetInSec'] = self._serialize.query("time_budget_in_sec", time_budget_in_sec, 'float') + if distance_budget_in_meters is not None: + query_parameters['distanceBudgetInMeters'] = self._serialize.query("distance_budget_in_meters", distance_budget_in_meters, 'float') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if is_commercial_vehicle is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("is_commercial_vehicle", is_commercial_vehicle, 'bool') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + if vehicle_engine_type is not None: + query_parameters['vehicleEngineType'] = self._serialize.query("vehicle_engine_type", vehicle_engine_type, 'str') + if constant_speed_consumption_in_liters_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundred_km", constant_speed_consumption_in_liters_per_hundred_km, 'str') + if current_fuel_in_liters is not None: + query_parameters['currentFuelInLiters'] = self._serialize.query("current_fuel_in_liters", current_fuel_in_liters, 'float') + if auxiliary_power_in_liters_per_hour is not None: + query_parameters['auxiliaryPowerInLitersPerHour'] = self._serialize.query("auxiliary_power_in_liters_per_hour", auxiliary_power_in_liters_per_hour, 'float') + if fuel_energy_density_in_megajoules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_megajoules_per_liter", fuel_energy_density_in_megajoules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float', maximum=1, minimum=0) + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float', maximum=1, minimum=0) + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float', maximum=1, minimum=0) + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float', maximum=1, minimum=0) + if constant_speed_consumption_in_kw_h_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_kw_h_per_hundred_km", constant_speed_consumption_in_kw_h_per_hundred_km, 'str') + if current_charge_in_kw_h is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_in_kw_h", current_charge_in_kw_h, 'float') + if max_charge_in_kw_h is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_in_kw_h", max_charge_in_kw_h, 'float') + if auxiliary_power_in_kw is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_in_kw", auxiliary_power_in_kw, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('RouteRangeResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_range.metadata = {'url': '/route/range/{format}'} # type: ignore + + async def _request_route_directions_batch_initial( + self, + route_directions_batch_queries: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.RouteDirectionsBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResult"]] + 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._request_route_directions_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_directions_batch_queries, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _request_route_directions_batch_initial.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + async def begin_request_route_directions_batch( + self, + route_directions_batch_queries: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteDirectionsBatchResult"]: + """**Route Directions Batch API** + + **Applies to**\ : S1 pricing tier. + + The Route Directions Batch API sends batches of queries to `Route Directions API + `_ using just a single API + call. You can call Route Directions Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **700** queries and sync API + up to **100** queries. + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex route + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **700** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Route Directions Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + ``GET https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0`` + Note:- Please remember to add AUTH information (subscription-key/azure_auth - See `Security + <#security>`_\ ) to the *status URI* before running it. :code:`
` + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *route directions* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 3 *route directions* + queries: + + .. code-block:: json + + { + "batchItems": [ + { "query": + "?query=47.620659,-122.348934:47.610101,-122.342015&travelMode=bicycle&routeType=eco&traffic=false" + }, + { "query": + "?query=40.759856,-73.985108:40.771136,-73.973506&travelMode=pedestrian&routeType=shortest" }, + { "query": "?query=48.923159,-122.557362:32.621279,-116.840362" } + ] + } + + A *route directions* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *route directions* + `URI parameters + `_. The + string values in the *route directions* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **700** queries and sync API up to **100** queries, + and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``RouteDirections`` + `_ - If the + query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 1 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 1, + "totalRequests": 2 + }, + "batchItems": [ + { + "statusCode": 200, + "response": { + "routes": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "legs": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "points": [ + { + "latitude": 47.62094, + "longitude": -122.34892 + }, + { + "latitude": 47.62094, + "longitude": -122.3485 + }, + { + "latitude": 47.62095, + "longitude": -122.3476 + } + ] + } + ], + "sections": [ + { + "startPointIndex": 0, + "endPointIndex": 40, + "sectionType": "TRAVEL_MODE", + "travelMode": "bicycle" + } + ] + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param route_directions_batch_queries: The list of route directions queries/requests to + process. The list can contain a max of 700 queries for async and 100 queries for sync version + and must contain at least 1 query. + :type route_directions_batch_queries: ~azure.maps.route.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :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 RouteDirectionsBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResult"] + 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._request_route_directions_batch_initial( + route_directions_batch_queries=route_directions_batch_queries, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_request_route_directions_batch.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + async def _get_route_directions_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.RouteDirectionsBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResult"]] + 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_route_directions_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_route_directions_batch_initial.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + async def begin_get_route_directions_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteDirectionsBatchResult"]: + """Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``RouteDirections`` + `_ - If the + query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 1 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 1, + "totalRequests": 2 + }, + "batchItems": [ + { + "statusCode": 200, + "response": { + "routes": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "legs": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "points": [ + { + "latitude": 47.62094, + "longitude": -122.34892 + }, + { + "latitude": 47.62094, + "longitude": -122.3485 + }, + { + "latitude": 47.62095, + "longitude": -122.3476 + } + ] + } + ], + "sections": [ + { + "startPointIndex": 0, + "endPointIndex": 40, + "sectionType": "TRAVEL_MODE", + "travelMode": "bicycle" + } + ] + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 RouteDirectionsBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResult"] + 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._get_route_directions_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_route_directions_batch.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + async def request_route_directions_batch_sync( + self, + route_directions_batch_queries: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.RouteDirectionsBatchResult": + """**Route Directions Batch API** + + **Applies to**\ : S1 pricing tier. + + The Route Directions Batch API sends batches of queries to `Route Directions API + `_ using just a single API + call. You can call Route Directions Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **700** queries and sync API + up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/route/directions/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``RouteDirections`` + `_ - If the + query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 1 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 1, + "totalRequests": 2 + }, + "batchItems": [ + { + "statusCode": 200, + "response": { + "routes": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "legs": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "points": [ + { + "latitude": 47.62094, + "longitude": -122.34892 + }, + { + "latitude": 47.62094, + "longitude": -122.3485 + }, + { + "latitude": 47.62095, + "longitude": -122.3476 + } + ] + } + ], + "sections": [ + { + "startPointIndex": 0, + "endPointIndex": 40, + "sectionType": "TRAVEL_MODE", + "travelMode": "bicycle" + } + ] + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param route_directions_batch_queries: The list of route directions queries/requests to + process. The list can contain a max of 700 queries for async and 100 queries for sync version + and must contain at least 1 query. + :type route_directions_batch_queries: ~azure.maps.route.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsBatchResult, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.request_route_directions_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_directions_batch_queries, 'BatchRequest') + 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('RouteDirectionsBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + request_route_directions_batch_sync.metadata = {'url': '/route/directions/batch/sync/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py b/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py new file mode 100644 index 000000000000..eadabaaeea3c --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py @@ -0,0 +1,226 @@ +# 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 BatchRequest + from ._models_py3 import BatchRequestItem + from ._models_py3 import BatchResult + from ._models_py3 import BatchResultItem + from ._models_py3 import BatchResultSummary + from ._models_py3 import EffectiveSetting + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + 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 LatLongPair + from ._models_py3 import Route + from ._models_py3 import RouteDirectionParameters + from ._models_py3 import RouteDirections + from ._models_py3 import RouteDirectionsBatchItem + from ._models_py3 import RouteDirectionsBatchItemResponse + from ._models_py3 import RouteDirectionsBatchResult + from ._models_py3 import RouteGuidance + from ._models_py3 import RouteInstruction + from ._models_py3 import RouteInstructionGroup + from ._models_py3 import RouteLeg + from ._models_py3 import RouteLegSummary + from ._models_py3 import RouteMatrix + from ._models_py3 import RouteMatrixQuery + from ._models_py3 import RouteMatrixResult + from ._models_py3 import RouteMatrixResultResponse + from ._models_py3 import RouteMatrixSummary + from ._models_py3 import RouteOptimizedWaypoint + from ._models_py3 import RouteRange + from ._models_py3 import RouteRangeResult + from ._models_py3 import RouteReport + from ._models_py3 import RouteSection + from ._models_py3 import RouteSectionTec + from ._models_py3 import RouteSectionTecCause + from ._models_py3 import RouteSummary +except (SyntaxError, ImportError): + from ._models import BatchRequest # type: ignore + from ._models import BatchRequestItem # type: ignore + from ._models import BatchResult # type: ignore + from ._models import BatchResultItem # type: ignore + from ._models import BatchResultSummary # type: ignore + from ._models import EffectiveSetting # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # 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 LatLongPair # type: ignore + from ._models import Route # type: ignore + from ._models import RouteDirectionParameters # type: ignore + from ._models import RouteDirections # type: ignore + from ._models import RouteDirectionsBatchItem # type: ignore + from ._models import RouteDirectionsBatchItemResponse # type: ignore + from ._models import RouteDirectionsBatchResult # type: ignore + from ._models import RouteGuidance # type: ignore + from ._models import RouteInstruction # type: ignore + from ._models import RouteInstructionGroup # type: ignore + from ._models import RouteLeg # type: ignore + from ._models import RouteLegSummary # type: ignore + from ._models import RouteMatrix # type: ignore + from ._models import RouteMatrixQuery # type: ignore + from ._models import RouteMatrixResult # type: ignore + from ._models import RouteMatrixResultResponse # type: ignore + from ._models import RouteMatrixSummary # type: ignore + from ._models import RouteOptimizedWaypoint # type: ignore + from ._models import RouteRange # type: ignore + from ._models import RouteRangeResult # type: ignore + from ._models import RouteReport # type: ignore + from ._models import RouteSection # type: ignore + from ._models import RouteSectionTec # type: ignore + from ._models import RouteSectionTecCause # type: ignore + from ._models import RouteSummary # type: ignore + +from ._route_client_enums import ( + AlternativeRouteType, + ComputeTravelTime, + DelayMagnitude, + DrivingSide, + GeoJsonObjectType, + GuidanceInstructionType, + GuidanceManeuver, + InclineLevel, + JsonFormat, + JunctionType, + Report, + ResponseFormat, + ResponseSectionType, + ResponseTravelMode, + RouteAvoidType, + RouteInstructionsType, + RouteRepresentationForBestOrder, + RouteType, + SectionType, + SimpleCategory, + TravelMode, + VehicleEngineType, + VehicleLoadType, + WindingnessLevel, +) + +__all__ = [ + 'BatchRequest', + 'BatchRequestItem', + 'BatchResult', + 'BatchResultItem', + 'BatchResultSummary', + 'EffectiveSetting', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'LatLongPair', + 'Route', + 'RouteDirectionParameters', + 'RouteDirections', + 'RouteDirectionsBatchItem', + 'RouteDirectionsBatchItemResponse', + 'RouteDirectionsBatchResult', + 'RouteGuidance', + 'RouteInstruction', + 'RouteInstructionGroup', + 'RouteLeg', + 'RouteLegSummary', + 'RouteMatrix', + 'RouteMatrixQuery', + 'RouteMatrixResult', + 'RouteMatrixResultResponse', + 'RouteMatrixSummary', + 'RouteOptimizedWaypoint', + 'RouteRange', + 'RouteRangeResult', + 'RouteReport', + 'RouteSection', + 'RouteSectionTec', + 'RouteSectionTecCause', + 'RouteSummary', + 'AlternativeRouteType', + 'ComputeTravelTime', + 'DelayMagnitude', + 'DrivingSide', + 'GeoJsonObjectType', + 'GuidanceInstructionType', + 'GuidanceManeuver', + 'InclineLevel', + 'JsonFormat', + 'JunctionType', + 'Report', + 'ResponseFormat', + 'ResponseSectionType', + 'ResponseTravelMode', + 'RouteAvoidType', + 'RouteInstructionsType', + 'RouteRepresentationForBestOrder', + 'RouteType', + 'SectionType', + 'SimpleCategory', + 'TravelMode', + 'VehicleEngineType', + 'VehicleLoadType', + 'WindingnessLevel', +] diff --git a/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py b/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py new file mode 100644 index 000000000000..1a61981d42d5 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py @@ -0,0 +1,2015 @@ +# 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 BatchRequest(msrest.serialization.Model): + """This type represents the request body for the Batch service. + + :param batch_items: The list of queries to process. + :type batch_items: list[~azure.maps.route.models.BatchRequestItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequest, self).__init__(**kwargs) + self.batch_items = kwargs.get('batch_items', None) + + +class BatchRequestItem(msrest.serialization.Model): + """Batch request object. + + :param query: This parameter contains a query string used to perform an unstructured geocoding + operation. The query string will be passed verbatim to the search API for processing. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestItem, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + + +class BatchResult(msrest.serialization.Model): + """This object is returned from a successful Batch service call. Extend with 'batchItems' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.route.models.BatchResultSummary + """ + + _validation = { + 'batch_summary': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResult, self).__init__(**kwargs) + self.batch_summary = None + + +class BatchResultItem(msrest.serialization.Model): + """An item returned from Batch API. Extend with 'response' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchResultSummary(msrest.serialization.Model): + """Summary of the results for the batch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_requests: Number of successful requests in the batch. + :vartype successful_requests: int + :ivar total_requests: Total number of requests in the batch. + :vartype total_requests: int + """ + + _validation = { + 'successful_requests': {'readonly': True}, + 'total_requests': {'readonly': True}, + } + + _attribute_map = { + 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, + 'total_requests': {'key': 'totalRequests', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class EffectiveSetting(msrest.serialization.Model): + """Effective parameter or data used when calling this Route API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key: Name of the parameter used. + :vartype key: str + :ivar value: Value of the parameter used. + :vartype value: str + """ + + _validation = { + 'key': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveSetting, self).__init__(**kwargs) + self.key = None + self.value = None + + +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.route.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.route.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.route.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 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.route.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 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.route.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 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.route.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.route.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 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.route.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 GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + 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.route.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.route.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(**kwargs) + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # 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.route.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.route.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.route.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.route.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.route.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.route.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.route.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.route.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.route.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.route.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 LatLongPair(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + :param latitude: Latitude property. + :type latitude: float + :param longitude: Longitude property. + :type longitude: float + """ + + _attribute_map = { + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPair, self).__init__(**kwargs) + self.latitude = kwargs.get('latitude', None) + self.longitude = kwargs.get('longitude', None) + + +class Route(msrest.serialization.Model): + """Route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object. + :vartype summary: ~azure.maps.route.models.RouteSummary + :ivar legs: Legs array. + :vartype legs: list[~azure.maps.route.models.RouteLeg] + :ivar sections: Sections array. + :vartype sections: list[~azure.maps.route.models.RouteSection] + :ivar guidance: Contains guidance related elements. This field is present only when guidance + was requested and is available. + :vartype guidance: ~azure.maps.route.models.RouteGuidance + """ + + _validation = { + 'summary': {'readonly': True}, + 'legs': {'readonly': True}, + 'sections': {'readonly': True}, + 'guidance': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteSummary'}, + 'legs': {'key': 'legs', 'type': '[RouteLeg]'}, + 'sections': {'key': 'sections', 'type': '[RouteSection]'}, + 'guidance': {'key': 'guidance', 'type': 'RouteGuidance'}, + } + + def __init__( + self, + **kwargs + ): + super(Route, self).__init__(**kwargs) + self.summary = None + self.legs = None + self.sections = None + self.guidance = None + + +class RouteDirectionParameters(msrest.serialization.Model): + """Post body parameters for Route directions. + + :param supporting_points: A GeoJSON Geometry collection representing sequence of coordinates + used as input for route reconstruction and for calculating zero or more alternative routes to + this reference route. + + + * The provided sequence of supporting points is used as input for route reconstruction. + * The alternative routes are calculated between the origin and destination points specified in + the base path parameter locations. + * If both *minDeviationDistance* and *minDeviationTime* are set to zero, then these origin and + destination points are + expected to be at (or very near) the beginning and end of the reference route, respectively. + * Intermediate locations (\ *waypoints*\ ) are not supported when using + :code:`<_supportingPoints_>`. + * The reference route may contain traffic incidents of type _ROAD\ *CLOSURE*\ , which are + ignored for the calculation of the reference route's travel time and traffic delay. + Please refer to `Supporting Points + `_ + for details. + :type supporting_points: ~azure.maps.route.models.GeoJsonGeometryCollection + :param avoid_vignette: This is a list of 3-character, ISO 3166-1, alpha-3 country codes of + countries in which all toll roads with vignettes are to be avoided, e.g. "AUS,CHE". Toll roads + with vignettes in countries not in the list are unaffected. Note: It is an error to specify + both **avoidVignette** and **allowVignette**. + :type avoid_vignette: list[str] + :param allow_vignette: This is a list of 3-character, ISO 3166-1, alpha-3 country codes of + countries in which toll roads with vignettes are allowed, e.g. "AUS,CHE". Specifying + **allowVignette** with some countries X is equivalent to specifying **avoidVignette** with all + countries but X. Specifying **allowVignette** with an empty list is the same as avoiding all + toll roads with vignettes. Note: It is an error to specify both **avoidVignette** and + **allowVignette**. + :type allow_vignette: list[str] + :param avoid_areas: A GeoJSON MultiPolygon representing list of areas to avoid. Only rectangle + polygons are supported. The maximum size of a rectangle is about 160x160 km. Maximum number of + avoided areas is **10**. It cannot cross the 180th meridian. It must be between -80 and +80 + degrees of latitude. + :type avoid_areas: ~azure.maps.route.models.GeoJsonMultiPolygon + """ + + _attribute_map = { + 'supporting_points': {'key': 'supportingPoints', 'type': 'GeoJsonGeometryCollection'}, + 'avoid_vignette': {'key': 'avoidVignette', 'type': '[str]'}, + 'allow_vignette': {'key': 'allowVignette', 'type': '[str]'}, + 'avoid_areas': {'key': 'avoidAreas', 'type': 'GeoJsonMultiPolygon'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionParameters, self).__init__(**kwargs) + self.supporting_points = kwargs.get('supporting_points', None) + self.avoid_vignette = kwargs.get('avoid_vignette', None) + self.allow_vignette = kwargs.get('allow_vignette', None) + self.avoid_areas = kwargs.get('avoid_areas', None) + + +class RouteDirections(msrest.serialization.Model): + """This object is returned from a successful Route Directions call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar routes: Routes array. + :vartype routes: list[~azure.maps.route.models.Route] + :ivar optimized_waypoints: Optimized sequence of waypoints. It shows the index from the user + provided waypoint sequence for the original and optimized list. For instance, a response: + + .. code-block:: + + + + + + + + means that the original sequence is [0, 1, 2] and optimized sequence is [1, 2, 0]. Since the + index starts by 0 the original is "first, second, third" while the optimized is "second, third, + first". + :vartype optimized_waypoints: list[~azure.maps.route.models.RouteOptimizedWaypoint] + :param report: Reports the effective settings used in the current call. + :type report: ~azure.maps.route.models.RouteReport + """ + + _validation = { + 'format_version': {'readonly': True}, + 'routes': {'readonly': True}, + 'optimized_waypoints': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[Route]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteReport'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirections, self).__init__(**kwargs) + self.format_version = None + self.routes = None + self.optimized_waypoints = None + self.report = kwargs.get('report', None) + + +class RouteDirectionsBatchItem(BatchResultItem): + """An item returned from Route Directions Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. RouteDirections if the query completed successfully, + ErrorResponse otherwise. + :vartype response: ~azure.maps.route.models.RouteDirectionsBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'RouteDirectionsBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchItem, self).__init__(**kwargs) + self.response = None + + +class RouteDirectionsBatchItemResponse(ErrorResponse, RouteDirections): + """The result of the query. RouteDirections if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar routes: Routes array. + :vartype routes: list[~azure.maps.route.models.Route] + :ivar optimized_waypoints: Optimized sequence of waypoints. It shows the index from the user + provided waypoint sequence for the original and optimized list. For instance, a response: + + .. code-block:: + + + + + + + + means that the original sequence is [0, 1, 2] and optimized sequence is [1, 2, 0]. Since the + index starts by 0 the original is "first, second, third" while the optimized is "second, third, + first". + :vartype optimized_waypoints: list[~azure.maps.route.models.RouteOptimizedWaypoint] + :param report: Reports the effective settings used in the current call. + :type report: ~azure.maps.route.models.RouteReport + :param error: The error object. + :type error: ~azure.maps.route.models.ErrorDetail + """ + + _validation = { + 'format_version': {'readonly': True}, + 'routes': {'readonly': True}, + 'optimized_waypoints': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[Route]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteReport'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchItemResponse, self).__init__(**kwargs) + self.format_version = None + self.routes = None + self.optimized_waypoints = None + self.report = kwargs.get('report', None) + self.error = kwargs.get('error', None) + + +class RouteDirectionsBatchResult(BatchResult): + """This object is returned from a successful Route Directions Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.route.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.route.models.RouteDirectionsBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[RouteDirectionsBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchResult, self).__init__(**kwargs) + self.batch_items = None + + +class RouteGuidance(msrest.serialization.Model): + """Contains guidance related elements. This field is present only when guidance was requested and is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar instructions: A list of instructions describing maneuvers. + :vartype instructions: list[~azure.maps.route.models.RouteInstruction] + :ivar instruction_groups: Groups a sequence of instruction elements which are related to each + other. + :vartype instruction_groups: list[~azure.maps.route.models.RouteInstructionGroup] + """ + + _validation = { + 'instructions': {'readonly': True}, + 'instruction_groups': {'readonly': True}, + } + + _attribute_map = { + 'instructions': {'key': 'instructions', 'type': '[RouteInstruction]'}, + 'instruction_groups': {'key': 'instructionGroups', 'type': '[RouteInstructionGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteGuidance, self).__init__(**kwargs) + self.instructions = None + self.instruction_groups = None + + +class RouteInstruction(msrest.serialization.Model): + """A set of attributes describing a maneuver, e.g. 'Turn right', 'Keep left', 'Take the ferry', 'Take the motorway', 'Arrive'. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar route_offset_in_meters: Distance from the start of the route to the point of the + instruction. + :vartype route_offset_in_meters: int + :ivar travel_time_in_seconds: Estimated travel time up to the point corresponding to + routeOffsetInMeters. + :vartype travel_time_in_seconds: int + :param point: A location represented as a latitude and longitude. + :type point: ~azure.maps.route.models.LatLongPair + :ivar point_index: The index of the point in the list of polyline "points" corresponding to the + point of the instruction. + :vartype point_index: int + :param instruction_type: Type of the instruction, e.g., turn or change of road form. Possible + values include: "TURN", "ROAD_CHANGE", "LOCATION_DEPARTURE", "LOCATION_ARRIVAL", + "DIRECTION_INFO", "LOCATION_WAYPOINT". + :type instruction_type: str or ~azure.maps.route.models.GuidanceInstructionType + :ivar road_numbers: The road number(s) of the next significant road segment(s) after the + maneuver, or of the road(s) to be followed. Example: ["E34", "N205"]. + :vartype road_numbers: list[str] + :ivar exit_number: The number(s) of a highway exit taken by the current maneuver. If an exit + has multiple exit numbers, they will be separated by "," and possibly aggregated by "-", e.g., + "10, 13-15". + :vartype exit_number: str + :ivar street: Street name of the next significant road segment after the maneuver, or of the + street that should be followed. + :vartype street: str + :ivar signpost_text: The text on a signpost which is most relevant to the maneuver, or to the + direction that should be followed. + :vartype signpost_text: str + :ivar country_code: 3-character `ISO 3166-1 `_ + alpha-3 country code. E.g. USA. + :vartype country_code: str + :ivar state_code: A subdivision (e.g., state) of the country, represented by the second part of + an `ISO 3166-2 `_ code. This is only available for + some countries like the US, Canada, and Mexico. + :vartype state_code: str + :ivar junction_type: The type of the junction where the maneuver takes place. For larger + roundabouts, two separate instructions are generated for entering and leaving the roundabout. + Possible values include: "REGULAR", "ROUNDABOUT", "BIFURCATION". + :vartype junction_type: str or ~azure.maps.route.models.JunctionType + :ivar turn_angle_in_degrees: Indicates the direction of an instruction. If junctionType + indicates a turn instruction: + + + * 180 = U-turn + * [-179, -1] = Left turn + * 0 = Straight on (a '0 degree' turn) + * [1, 179] = Right turn + + If junctionType indicates a bifurcation instruction: + + + * <0 - keep left + * >0 - keep right. + :vartype turn_angle_in_degrees: int + :ivar roundabout_exit_number: This indicates which exit to take at a roundabout. + :vartype roundabout_exit_number: str + :ivar possible_combine_with_next: It is possible to optionally combine the instruction with the + next one. This can be used to build messages like "Turn left and then turn right". + :vartype possible_combine_with_next: bool + :ivar driving_side: Indicates left-hand vs. right-hand side driving at the point of the + maneuver. Possible values include: "LEFT", "RIGHT". + :vartype driving_side: str or ~azure.maps.route.models.DrivingSide + :ivar maneuver: A code identifying the maneuver. Possible values include: "ARRIVE", + "ARRIVE_LEFT", "ARRIVE_RIGHT", "DEPART", "STRAIGHT", "KEEP_RIGHT", "BEAR_RIGHT", "TURN_RIGHT", + "SHARP_RIGHT", "KEEP_LEFT", "BEAR_LEFT", "TURN_LEFT", "SHARP_LEFT", "MAKE_UTURN", + "ENTER_MOTORWAY", "ENTER_FREEWAY", "ENTER_HIGHWAY", "TAKE_EXIT", "MOTORWAY_EXIT_LEFT", + "MOTORWAY_EXIT_RIGHT", "TAKE_FERRY", "ROUNDABOUT_CROSS", "ROUNDABOUT_RIGHT", "ROUNDABOUT_LEFT", + "ROUNDABOUT_BACK", "TRY_MAKE_UTURN", "FOLLOW", "SWITCH_PARALLEL_ROAD", "SWITCH_MAIN_ROAD", + "ENTRANCE_RAMP", "WAYPOINT_LEFT", "WAYPOINT_RIGHT", "WAYPOINT_REACHED". + :vartype maneuver: str or ~azure.maps.route.models.GuidanceManeuver + :ivar message: A human-readable message for the maneuver. + :vartype message: str + :ivar combined_message: A human-readable message for the maneuver combined with the message + from the next instruction. Sometimes it is possible to combine two successive instructions into + a single instruction making it easier to follow. When this is the case the + possibleCombineWithNext flag will be true. For example: + + .. code-block:: + + 10. Turn left onto Einsteinweg/A10/E22 towards Ring Amsterdam + 11. Follow Einsteinweg/A10/E22 towards Ring Amsterdam + + The possibleCombineWithNext flag on instruction 10 is true. This indicates to the clients of + coded guidance that it can be combined with instruction 11. The instructions will be combined + automatically for clients requesting human-readable guidance. The combinedMessage field + contains the combined message: + + .. code-block:: + + Turn left onto Einsteinweg/A10/E22 towards Ring Amsterdam + then follow Einsteinweg/A10/E22 towards Ring Amsterdam. + :vartype combined_message: str + """ + + _validation = { + 'route_offset_in_meters': {'readonly': True}, + 'travel_time_in_seconds': {'readonly': True}, + 'point_index': {'readonly': True}, + 'road_numbers': {'readonly': True}, + 'exit_number': {'readonly': True}, + 'street': {'readonly': True}, + 'signpost_text': {'readonly': True}, + 'country_code': {'readonly': True}, + 'state_code': {'readonly': True}, + 'junction_type': {'readonly': True}, + 'turn_angle_in_degrees': {'readonly': True}, + 'roundabout_exit_number': {'readonly': True}, + 'possible_combine_with_next': {'readonly': True}, + 'driving_side': {'readonly': True}, + 'maneuver': {'readonly': True}, + 'message': {'readonly': True}, + 'combined_message': {'readonly': True}, + } + + _attribute_map = { + 'route_offset_in_meters': {'key': 'routeOffsetInMeters', 'type': 'int'}, + 'travel_time_in_seconds': {'key': 'travelTimeInSeconds', 'type': 'int'}, + 'point': {'key': 'point', 'type': 'LatLongPair'}, + 'point_index': {'key': 'pointIndex', 'type': 'int'}, + 'instruction_type': {'key': 'instructionType', 'type': 'str'}, + 'road_numbers': {'key': 'roadNumbers', 'type': '[str]'}, + 'exit_number': {'key': 'exitNumber', 'type': 'str'}, + 'street': {'key': 'street', 'type': 'str'}, + 'signpost_text': {'key': 'signpostText', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'state_code': {'key': 'stateCode', 'type': 'str'}, + 'junction_type': {'key': 'junctionType', 'type': 'str'}, + 'turn_angle_in_degrees': {'key': 'turnAngleInDecimalDegrees', 'type': 'int'}, + 'roundabout_exit_number': {'key': 'roundaboutExitNumber', 'type': 'str'}, + 'possible_combine_with_next': {'key': 'possibleCombineWithNext', 'type': 'bool'}, + 'driving_side': {'key': 'drivingSide', 'type': 'str'}, + 'maneuver': {'key': 'maneuver', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'combined_message': {'key': 'combinedMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteInstruction, self).__init__(**kwargs) + self.route_offset_in_meters = None + self.travel_time_in_seconds = None + self.point = kwargs.get('point', None) + self.point_index = None + self.instruction_type = kwargs.get('instruction_type', None) + self.road_numbers = None + self.exit_number = None + self.street = None + self.signpost_text = None + self.country_code = None + self.state_code = None + self.junction_type = None + self.turn_angle_in_degrees = None + self.roundabout_exit_number = None + self.possible_combine_with_next = None + self.driving_side = None + self.maneuver = None + self.message = None + self.combined_message = None + + +class RouteInstructionGroup(msrest.serialization.Model): + """Groups a sequence of instruction elements which are related to each other. The sequence range is constrained with firstInstructionIndex and lastInstructionIndex. When human-readable text messages are requested for guidance (instructionType=text or tagged), then the instructionGroup has a summary message returned when available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar first_instruction_index: Index of the first instruction in the instructions and belonging + to this group. + :vartype first_instruction_index: int + :ivar last_instruction_index: Index of the last instruction in the instructions and belonging + to this group. + :vartype last_instruction_index: int + :ivar group_length_in_meters: Length of the group. + :vartype group_length_in_meters: int + :ivar group_message: Summary message when human-readable text messages are requested for + guidance (instructionType=text or tagged). + :vartype group_message: str + """ + + _validation = { + 'first_instruction_index': {'readonly': True}, + 'last_instruction_index': {'readonly': True}, + 'group_length_in_meters': {'readonly': True}, + 'group_message': {'readonly': True}, + } + + _attribute_map = { + 'first_instruction_index': {'key': 'firstInstructionIndex', 'type': 'int'}, + 'last_instruction_index': {'key': 'lastInstructionIndex', 'type': 'int'}, + 'group_length_in_meters': {'key': 'groupLengthInMeters', 'type': 'int'}, + 'group_message': {'key': 'groupMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteInstructionGroup, self).__init__(**kwargs) + self.first_instruction_index = None + self.last_instruction_index = None + self.group_length_in_meters = None + self.group_message = None + + +class RouteLeg(msrest.serialization.Model): + """A description of a part of a route, comprised of a list of points. Each additional waypoint provided in the request will result in an additional leg in the returned route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for route section. + :vartype summary: ~azure.maps.route.models.RouteLegSummary + :ivar points: Points array. + :vartype points: list[~azure.maps.route.models.LatLongPair] + """ + + _validation = { + 'summary': {'readonly': True}, + 'points': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteLegSummary'}, + 'points': {'key': 'points', 'type': '[LatLongPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteLeg, self).__init__(**kwargs) + self.summary = None + self.points = None + + +class RouteLegSummary(msrest.serialization.Model): + """Summary object for route section. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar length_in_meters: Length In Meters property. + :vartype length_in_meters: int + :ivar travel_time_in_seconds: Estimated travel time in seconds property that includes the delay + due to real-time traffic. Note that even when traffic=false travelTimeInSeconds still includes + the delay due to traffic. If DepartAt is in the future, travel time is calculated using + time-dependent historic traffic data. + :vartype travel_time_in_seconds: int + :ivar traffic_delay_in_seconds: Estimated delay in seconds caused by the real-time incident(s) + according to traffic information. For routes planned with departure time in the future, delays + is always 0. To return additional travel times using different types of traffic information, + parameter computeTravelTimeFor=all needs to be added. + :vartype traffic_delay_in_seconds: int + :ivar departure_time: The estimated departure time for the route or leg. + :vartype departure_time: ~datetime.datetime + :ivar arrival_time: The estimated arrival time for the route or leg. + :vartype arrival_time: ~datetime.datetime + :ivar no_traffic_travel_time_in_seconds: Estimated travel time calculated as if there are no + delays on the route due to traffic conditions (e.g. congestion). Included only if + computeTravelTimeFor = all is used in the query. + :vartype no_traffic_travel_time_in_seconds: int + :ivar historic_traffic_travel_time_in_seconds: Estimated travel time calculated using + time-dependent historic traffic data. Included only if computeTravelTimeFor = all is used in + the query. + :vartype historic_traffic_travel_time_in_seconds: int + :ivar live_traffic_incidents_travel_time_in_seconds: Estimated travel time calculated using + real-time speed data. Included only if computeTravelTimeFor = all is used in the query. + :vartype live_traffic_incidents_travel_time_in_seconds: int + :ivar fuel_consumption_in_liters: Estimated fuel consumption in liters using the Combustion + Consumption Model. Included if vehicleEngineType is set to *combustion* and + constantSpeedConsumptionInLitersPerHundredkm is specified. The value will be non-negative. + :vartype fuel_consumption_in_liters: float + :ivar battery_consumption_in_kw_h: Estimated electric energy consumption in kilowatt hours + (kWh) using the Electric Consumption Model. Included if vehicleEngineType is set to electric + and constantSpeedConsumptionInkWhPerHundredkm is specified. The value of + batteryConsumptionInkWh includes the recuperated electric energy and can therefore be negative + (which indicates gaining energy). If both maxChargeInkWh and currentChargeInkWh are specified, + recuperation will be capped to ensure that the battery charge level never exceeds + maxChargeInkWh. If neither maxChargeInkWh nor currentChargeInkWh are specified, unconstrained + recuperation is assumed in the consumption calculation. + :vartype battery_consumption_in_kw_h: float + """ + + _validation = { + 'length_in_meters': {'readonly': True}, + 'travel_time_in_seconds': {'readonly': True}, + 'traffic_delay_in_seconds': {'readonly': True}, + 'departure_time': {'readonly': True}, + 'arrival_time': {'readonly': True}, + 'no_traffic_travel_time_in_seconds': {'readonly': True}, + 'historic_traffic_travel_time_in_seconds': {'readonly': True}, + 'live_traffic_incidents_travel_time_in_seconds': {'readonly': True}, + 'fuel_consumption_in_liters': {'readonly': True}, + 'battery_consumption_in_kw_h': {'readonly': True}, + } + + _attribute_map = { + 'length_in_meters': {'key': 'lengthInMeters', 'type': 'int'}, + 'travel_time_in_seconds': {'key': 'travelTimeInSeconds', 'type': 'int'}, + 'traffic_delay_in_seconds': {'key': 'trafficDelayInSeconds', 'type': 'int'}, + 'departure_time': {'key': 'departureTime', 'type': 'iso-8601'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'iso-8601'}, + 'no_traffic_travel_time_in_seconds': {'key': 'noTrafficTravelTimeInSeconds', 'type': 'int'}, + 'historic_traffic_travel_time_in_seconds': {'key': 'historicTrafficTravelTimeInSeconds', 'type': 'int'}, + 'live_traffic_incidents_travel_time_in_seconds': {'key': 'liveTrafficIncidentsTravelTimeInSeconds', 'type': 'int'}, + 'fuel_consumption_in_liters': {'key': 'fuelConsumptionInLiters', 'type': 'float'}, + 'battery_consumption_in_kw_h': {'key': 'batteryConsumptionInkWh', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteLegSummary, self).__init__(**kwargs) + self.length_in_meters = None + self.travel_time_in_seconds = None + self.traffic_delay_in_seconds = None + self.departure_time = None + self.arrival_time = None + self.no_traffic_travel_time_in_seconds = None + self.historic_traffic_travel_time_in_seconds = None + self.live_traffic_incidents_travel_time_in_seconds = None + self.fuel_consumption_in_liters = None + self.battery_consumption_in_kw_h = None + + +class RouteMatrix(msrest.serialization.Model): + """Matrix result object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: StatusCode property for the current cell in the input matrix. + :vartype status_code: int + :ivar response: Response object of the current cell in the input matrix. + :vartype response: ~azure.maps.route.models.RouteMatrixResultResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'RouteMatrixResultResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrix, self).__init__(**kwargs) + self.status_code = None + self.response = None + + +class RouteMatrixQuery(msrest.serialization.Model): + """An object with a matrix of coordinates. + + :param origins: A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type origins: ~azure.maps.route.models.GeoJsonMultiPoint + :param destinations: A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type destinations: ~azure.maps.route.models.GeoJsonMultiPoint + """ + + _attribute_map = { + 'origins': {'key': 'origins', 'type': 'GeoJsonMultiPoint'}, + 'destinations': {'key': 'destinations', 'type': 'GeoJsonMultiPoint'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixQuery, self).__init__(**kwargs) + self.origins = kwargs.get('origins', None) + self.destinations = kwargs.get('destinations', None) + + +class RouteMatrixResult(msrest.serialization.Model): + """This object is returned from a successful Route Matrix call. For ex, if 2 origins and 3 destinations are provided, there are going to 2 arrays with 3 elements in each. Each element's content depends on the options provided in the query. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar matrix: Results as a 2 dimensional array of route summaries. + :vartype matrix: list[list[~azure.maps.route.models.RouteMatrix]] + :ivar summary: Summary object. + :vartype summary: ~azure.maps.route.models.RouteMatrixSummary + """ + + _validation = { + 'format_version': {'readonly': True}, + 'matrix': {'readonly': True}, + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'matrix': {'key': 'matrix', 'type': '[[RouteMatrix]]'}, + 'summary': {'key': 'summary', 'type': 'RouteMatrixSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResult, self).__init__(**kwargs) + self.format_version = None + self.matrix = None + self.summary = None + + +class RouteMatrixResultResponse(msrest.serialization.Model): + """Response object of the current cell in the input matrix. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for route section. + :vartype summary: ~azure.maps.route.models.RouteLegSummary + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'routeSummary', 'type': 'RouteLegSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResultResponse, self).__init__(**kwargs) + self.summary = None + + +class RouteMatrixSummary(msrest.serialization.Model): + """Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_routes: Number of successful routes in the response. + :vartype successful_routes: int + :ivar total_routes: Total number of routes requested. Number of cells in the input matrix. + :vartype total_routes: int + """ + + _validation = { + 'successful_routes': {'readonly': True}, + 'total_routes': {'readonly': True}, + } + + _attribute_map = { + 'successful_routes': {'key': 'successfulRoutes', 'type': 'int'}, + 'total_routes': {'key': 'totalRoutes', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixSummary, self).__init__(**kwargs) + self.successful_routes = None + self.total_routes = None + + +class RouteOptimizedWaypoint(msrest.serialization.Model): + """Optimized way point object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provided_index: Way point index provided by the user. + :vartype provided_index: int + :ivar optimized_index: Optimized way point index from the system. + :vartype optimized_index: int + """ + + _validation = { + 'provided_index': {'readonly': True}, + 'optimized_index': {'readonly': True}, + } + + _attribute_map = { + 'provided_index': {'key': 'providedIndex', 'type': 'int'}, + 'optimized_index': {'key': 'optimizedIndex', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteOptimizedWaypoint, self).__init__(**kwargs) + self.provided_index = None + self.optimized_index = None + + +class RouteRange(msrest.serialization.Model): + """Reachable Range. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param center: Center point of the reachable range. + :type center: ~azure.maps.route.models.LatLongPair + :ivar boundary: Polygon boundary of the reachable range represented as a list of points. + :vartype boundary: list[~azure.maps.route.models.LatLongPair] + """ + + _validation = { + 'boundary': {'readonly': True}, + } + + _attribute_map = { + 'center': {'key': 'center', 'type': 'LatLongPair'}, + 'boundary': {'key': 'boundary', 'type': '[LatLongPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteRange, self).__init__(**kwargs) + self.center = kwargs.get('center', None) + self.boundary = None + + +class RouteRangeResult(msrest.serialization.Model): + """This object is returned from a successful Route Reachable Range call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :param reachable_range: Reachable Range. + :type reachable_range: ~azure.maps.route.models.RouteRange + :param report: Reports the effective settings used in the current call. + :type report: ~azure.maps.route.models.RouteReport + """ + + _validation = { + 'format_version': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'reachable_range': {'key': 'reachableRange', 'type': 'RouteRange'}, + 'report': {'key': 'report', 'type': 'RouteReport'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteRangeResult, self).__init__(**kwargs) + self.format_version = None + self.reachable_range = kwargs.get('reachable_range', None) + self.report = kwargs.get('report', None) + + +class RouteReport(msrest.serialization.Model): + """Reports the effective settings used in the current call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar effective_settings: Effective parameters or data used when calling this Route API. + :vartype effective_settings: list[~azure.maps.route.models.EffectiveSetting] + """ + + _validation = { + 'effective_settings': {'readonly': True}, + } + + _attribute_map = { + 'effective_settings': {'key': 'effectiveSettings', 'type': '[EffectiveSetting]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteReport, self).__init__(**kwargs) + self.effective_settings = None + + +class RouteSection(msrest.serialization.Model): + """Route sections contain additional information about parts of a route. Each section contains at least the elements ``startPointIndex``\ , ``endPointIndex``\ , and ``sectionType``. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_point_index: Index of the first point (offset 0) in the route this section applies + to. + :vartype start_point_index: int + :ivar end_point_index: Index of the last point (offset 0) in the route this section applies to. + :vartype end_point_index: int + :ivar section_type: Section types of the reported route response. Possible values include: + "CAR_TRAIN", "COUNTRY", "FERRY", "MOTORWAY", "PEDESTRIAN", "TOLL_ROAD", "TOLL_VIGNETTE", + "TRAFFIC", "TRAVEL_MODE", "TUNNEL", "CARPOOL", "URBAN". + :vartype section_type: str or ~azure.maps.route.models.ResponseSectionType + :ivar travel_mode: Travel mode for the calculated route. The value will be set to ``other`` if + the requested mode of transport is not possible in this section. Possible values include: + "car", "truck", "taxi", "bus", "van", "motorcycle", "bicycle", "pedestrian", "other". + :vartype travel_mode: str or ~azure.maps.route.models.ResponseTravelMode + :ivar simple_category: Type of the incident. Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or + OTHER. See "tec" for detailed information. Possible values include: "JAM", "ROAD_WORK", + "ROAD_CLOSURE", "OTHER". + :vartype simple_category: str or ~azure.maps.route.models.SimpleCategory + :ivar effective_speed_in_kmh: Effective speed of the incident in km/h, averaged over its entire + length. + :vartype effective_speed_in_kmh: int + :ivar delay_in_seconds: Delay in seconds caused by the incident. + :vartype delay_in_seconds: int + :ivar delay_magnitude: The magnitude of delay caused by the incident. These values correspond + to the values of the response field ty of the `Get Traffic Incident Detail API + `_. Possible values + include: "0", "1", "2", "3", "4". + :vartype delay_magnitude: str or ~azure.maps.route.models.DelayMagnitude + :param tec: Details of the traffic event, using definitions in the `TPEG2-TEC + `_ standard. Can contain effectCode and causes + elements. + :type tec: ~azure.maps.route.models.RouteSectionTec + """ + + _validation = { + 'start_point_index': {'readonly': True}, + 'end_point_index': {'readonly': True}, + 'section_type': {'readonly': True}, + 'travel_mode': {'readonly': True}, + 'simple_category': {'readonly': True}, + 'effective_speed_in_kmh': {'readonly': True}, + 'delay_in_seconds': {'readonly': True}, + 'delay_magnitude': {'readonly': True}, + } + + _attribute_map = { + 'start_point_index': {'key': 'startPointIndex', 'type': 'int'}, + 'end_point_index': {'key': 'endPointIndex', 'type': 'int'}, + 'section_type': {'key': 'sectionType', 'type': 'str'}, + 'travel_mode': {'key': 'travelMode', 'type': 'str'}, + 'simple_category': {'key': 'simpleCategory', 'type': 'str'}, + 'effective_speed_in_kmh': {'key': 'effectiveSpeedInKmh', 'type': 'int'}, + 'delay_in_seconds': {'key': 'delayInSeconds', 'type': 'int'}, + 'delay_magnitude': {'key': 'magnitudeOfDelay', 'type': 'str'}, + 'tec': {'key': 'tec', 'type': 'RouteSectionTec'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteSection, self).__init__(**kwargs) + self.start_point_index = None + self.end_point_index = None + self.section_type = None + self.travel_mode = None + self.simple_category = None + self.effective_speed_in_kmh = None + self.delay_in_seconds = None + self.delay_magnitude = None + self.tec = kwargs.get('tec', None) + + +class RouteSectionTec(msrest.serialization.Model): + """Details of the traffic event, using definitions in the `TPEG2-TEC `_ standard. Can contain effectCode and causes elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar effect_code: The effect on the traffic flow. Contains a value in the tec001:EffectCode + table, as defined in the `TPEG2-TEC `_ standard. Can + be used to color-code traffic events according to severity. + :vartype effect_code: int + :param causes: Causes array. + :type causes: list[~azure.maps.route.models.RouteSectionTecCause] + """ + + _validation = { + 'effect_code': {'readonly': True}, + } + + _attribute_map = { + 'effect_code': {'key': 'effectCode', 'type': 'int'}, + 'causes': {'key': 'causes', 'type': '[RouteSectionTecCause]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteSectionTec, self).__init__(**kwargs) + self.effect_code = None + self.causes = kwargs.get('causes', None) + + +class RouteSectionTecCause(msrest.serialization.Model): + """The cause of the traffic event. Can contain mainCauseCode and subCauseCode elements. Can be used to define iconography and descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar main_cause_code: The main cause of the traffic event. Contains a value in the + tec002:CauseCode table, as defined in the `TPEG2-TEC + `_ standard. + :vartype main_cause_code: int + :ivar sub_cause_code: The subcause of the traffic event. Contains a value in the sub cause + table defined by the mainCauseCode, as defined in the `TPEG2-TEC + `_ standard. + :vartype sub_cause_code: int + """ + + _validation = { + 'main_cause_code': {'readonly': True}, + 'sub_cause_code': {'readonly': True}, + } + + _attribute_map = { + 'main_cause_code': {'key': 'mainCauseCode', 'type': 'int'}, + 'sub_cause_code': {'key': 'subCauseCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteSectionTecCause, self).__init__(**kwargs) + self.main_cause_code = None + self.sub_cause_code = None + + +class RouteSummary(msrest.serialization.Model): + """Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar length_in_meters: Length In Meters property. + :vartype length_in_meters: int + :ivar travel_time_in_seconds: Estimated travel time in seconds property that includes the delay + due to real-time traffic. Note that even when traffic=false travelTimeInSeconds still includes + the delay due to traffic. If DepartAt is in the future, travel time is calculated using + time-dependent historic traffic data. + :vartype travel_time_in_seconds: int + :ivar traffic_delay_in_seconds: Estimated delay in seconds caused by the real-time incident(s) + according to traffic information. For routes planned with departure time in the future, delays + is always 0. To return additional travel times using different types of traffic information, + parameter computeTravelTimeFor=all needs to be added. + :vartype traffic_delay_in_seconds: int + :ivar departure_time: The estimated departure time for the route or leg. + :vartype departure_time: ~datetime.datetime + :ivar arrival_time: The estimated arrival time for the route or leg. + :vartype arrival_time: ~datetime.datetime + """ + + _validation = { + 'length_in_meters': {'readonly': True}, + 'travel_time_in_seconds': {'readonly': True}, + 'traffic_delay_in_seconds': {'readonly': True}, + 'departure_time': {'readonly': True}, + 'arrival_time': {'readonly': True}, + } + + _attribute_map = { + 'length_in_meters': {'key': 'lengthInMeters', 'type': 'int'}, + 'travel_time_in_seconds': {'key': 'travelTimeInSeconds', 'type': 'int'}, + 'traffic_delay_in_seconds': {'key': 'trafficDelayInSeconds', 'type': 'int'}, + 'departure_time': {'key': 'departureTime', 'type': 'iso-8601'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteSummary, self).__init__(**kwargs) + self.length_in_meters = None + self.travel_time_in_seconds = None + self.traffic_delay_in_seconds = None + self.departure_time = None + self.arrival_time = None diff --git a/sdk/maps/azure-maps-route/azure/maps/route/models/_models_py3.py b/sdk/maps/azure-maps-route/azure/maps/route/models/_models_py3.py new file mode 100644 index 000000000000..fcb5a22b7c92 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_models_py3.py @@ -0,0 +1,2095 @@ +# 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, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._route_client_enums import * + + +class BatchRequest(msrest.serialization.Model): + """This type represents the request body for the Batch service. + + :param batch_items: The list of queries to process. + :type batch_items: list[~azure.maps.route.models.BatchRequestItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, + } + + def __init__( + self, + *, + batch_items: Optional[List["BatchRequestItem"]] = None, + **kwargs + ): + super(BatchRequest, self).__init__(**kwargs) + self.batch_items = batch_items + + +class BatchRequestItem(msrest.serialization.Model): + """Batch request object. + + :param query: This parameter contains a query string used to perform an unstructured geocoding + operation. The query string will be passed verbatim to the search API for processing. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + **kwargs + ): + super(BatchRequestItem, self).__init__(**kwargs) + self.query = query + + +class BatchResult(msrest.serialization.Model): + """This object is returned from a successful Batch service call. Extend with 'batchItems' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.route.models.BatchResultSummary + """ + + _validation = { + 'batch_summary': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResult, self).__init__(**kwargs) + self.batch_summary = None + + +class BatchResultItem(msrest.serialization.Model): + """An item returned from Batch API. Extend with 'response' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchResultSummary(msrest.serialization.Model): + """Summary of the results for the batch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_requests: Number of successful requests in the batch. + :vartype successful_requests: int + :ivar total_requests: Total number of requests in the batch. + :vartype total_requests: int + """ + + _validation = { + 'successful_requests': {'readonly': True}, + 'total_requests': {'readonly': True}, + } + + _attribute_map = { + 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, + 'total_requests': {'key': 'totalRequests', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class EffectiveSetting(msrest.serialization.Model): + """Effective parameter or data used when calling this Route API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar key: Name of the parameter used. + :vartype key: str + :ivar value: Value of the parameter used. + :vartype value: str + """ + + _validation = { + 'key': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EffectiveSetting, self).__init__(**kwargs) + self.key = None + self.value = None + + +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.route.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.route.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.route.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 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.route.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 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.route.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 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.route.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.route.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 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.route.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 GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + 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.route.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.route.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + 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 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.route.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.route.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.route.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.route.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.route.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.route.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.route.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.route.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.route.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.route.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 LatLongPair(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + :param latitude: Latitude property. + :type latitude: float + :param longitude: Longitude property. + :type longitude: float + """ + + _attribute_map = { + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + } + + def __init__( + self, + *, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + **kwargs + ): + super(LatLongPair, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +class Route(msrest.serialization.Model): + """Route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object. + :vartype summary: ~azure.maps.route.models.RouteSummary + :ivar legs: Legs array. + :vartype legs: list[~azure.maps.route.models.RouteLeg] + :ivar sections: Sections array. + :vartype sections: list[~azure.maps.route.models.RouteSection] + :ivar guidance: Contains guidance related elements. This field is present only when guidance + was requested and is available. + :vartype guidance: ~azure.maps.route.models.RouteGuidance + """ + + _validation = { + 'summary': {'readonly': True}, + 'legs': {'readonly': True}, + 'sections': {'readonly': True}, + 'guidance': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteSummary'}, + 'legs': {'key': 'legs', 'type': '[RouteLeg]'}, + 'sections': {'key': 'sections', 'type': '[RouteSection]'}, + 'guidance': {'key': 'guidance', 'type': 'RouteGuidance'}, + } + + def __init__( + self, + **kwargs + ): + super(Route, self).__init__(**kwargs) + self.summary = None + self.legs = None + self.sections = None + self.guidance = None + + +class RouteDirectionParameters(msrest.serialization.Model): + """Post body parameters for Route directions. + + :param supporting_points: A GeoJSON Geometry collection representing sequence of coordinates + used as input for route reconstruction and for calculating zero or more alternative routes to + this reference route. + + + * The provided sequence of supporting points is used as input for route reconstruction. + * The alternative routes are calculated between the origin and destination points specified in + the base path parameter locations. + * If both *minDeviationDistance* and *minDeviationTime* are set to zero, then these origin and + destination points are + expected to be at (or very near) the beginning and end of the reference route, respectively. + * Intermediate locations (\ *waypoints*\ ) are not supported when using + :code:`<_supportingPoints_>`. + * The reference route may contain traffic incidents of type _ROAD\ *CLOSURE*\ , which are + ignored for the calculation of the reference route's travel time and traffic delay. + Please refer to `Supporting Points + `_ + for details. + :type supporting_points: ~azure.maps.route.models.GeoJsonGeometryCollection + :param avoid_vignette: This is a list of 3-character, ISO 3166-1, alpha-3 country codes of + countries in which all toll roads with vignettes are to be avoided, e.g. "AUS,CHE". Toll roads + with vignettes in countries not in the list are unaffected. Note: It is an error to specify + both **avoidVignette** and **allowVignette**. + :type avoid_vignette: list[str] + :param allow_vignette: This is a list of 3-character, ISO 3166-1, alpha-3 country codes of + countries in which toll roads with vignettes are allowed, e.g. "AUS,CHE". Specifying + **allowVignette** with some countries X is equivalent to specifying **avoidVignette** with all + countries but X. Specifying **allowVignette** with an empty list is the same as avoiding all + toll roads with vignettes. Note: It is an error to specify both **avoidVignette** and + **allowVignette**. + :type allow_vignette: list[str] + :param avoid_areas: A GeoJSON MultiPolygon representing list of areas to avoid. Only rectangle + polygons are supported. The maximum size of a rectangle is about 160x160 km. Maximum number of + avoided areas is **10**. It cannot cross the 180th meridian. It must be between -80 and +80 + degrees of latitude. + :type avoid_areas: ~azure.maps.route.models.GeoJsonMultiPolygon + """ + + _attribute_map = { + 'supporting_points': {'key': 'supportingPoints', 'type': 'GeoJsonGeometryCollection'}, + 'avoid_vignette': {'key': 'avoidVignette', 'type': '[str]'}, + 'allow_vignette': {'key': 'allowVignette', 'type': '[str]'}, + 'avoid_areas': {'key': 'avoidAreas', 'type': 'GeoJsonMultiPolygon'}, + } + + def __init__( + self, + *, + supporting_points: Optional["GeoJsonGeometryCollection"] = None, + avoid_vignette: Optional[List[str]] = None, + allow_vignette: Optional[List[str]] = None, + avoid_areas: Optional["GeoJsonMultiPolygon"] = None, + **kwargs + ): + super(RouteDirectionParameters, self).__init__(**kwargs) + self.supporting_points = supporting_points + self.avoid_vignette = avoid_vignette + self.allow_vignette = allow_vignette + self.avoid_areas = avoid_areas + + +class RouteDirections(msrest.serialization.Model): + """This object is returned from a successful Route Directions call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar routes: Routes array. + :vartype routes: list[~azure.maps.route.models.Route] + :ivar optimized_waypoints: Optimized sequence of waypoints. It shows the index from the user + provided waypoint sequence for the original and optimized list. For instance, a response: + + .. code-block:: + + + + + + + + means that the original sequence is [0, 1, 2] and optimized sequence is [1, 2, 0]. Since the + index starts by 0 the original is "first, second, third" while the optimized is "second, third, + first". + :vartype optimized_waypoints: list[~azure.maps.route.models.RouteOptimizedWaypoint] + :param report: Reports the effective settings used in the current call. + :type report: ~azure.maps.route.models.RouteReport + """ + + _validation = { + 'format_version': {'readonly': True}, + 'routes': {'readonly': True}, + 'optimized_waypoints': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[Route]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteReport'}, + } + + def __init__( + self, + *, + report: Optional["RouteReport"] = None, + **kwargs + ): + super(RouteDirections, self).__init__(**kwargs) + self.format_version = None + self.routes = None + self.optimized_waypoints = None + self.report = report + + +class RouteDirectionsBatchItem(BatchResultItem): + """An item returned from Route Directions Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. RouteDirections if the query completed successfully, + ErrorResponse otherwise. + :vartype response: ~azure.maps.route.models.RouteDirectionsBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'RouteDirectionsBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchItem, self).__init__(**kwargs) + self.response = None + + +class RouteDirectionsBatchItemResponse(ErrorResponse, RouteDirections): + """The result of the query. RouteDirections if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar routes: Routes array. + :vartype routes: list[~azure.maps.route.models.Route] + :ivar optimized_waypoints: Optimized sequence of waypoints. It shows the index from the user + provided waypoint sequence for the original and optimized list. For instance, a response: + + .. code-block:: + + + + + + + + means that the original sequence is [0, 1, 2] and optimized sequence is [1, 2, 0]. Since the + index starts by 0 the original is "first, second, third" while the optimized is "second, third, + first". + :vartype optimized_waypoints: list[~azure.maps.route.models.RouteOptimizedWaypoint] + :param report: Reports the effective settings used in the current call. + :type report: ~azure.maps.route.models.RouteReport + :param error: The error object. + :type error: ~azure.maps.route.models.ErrorDetail + """ + + _validation = { + 'format_version': {'readonly': True}, + 'routes': {'readonly': True}, + 'optimized_waypoints': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[Route]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteReport'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + report: Optional["RouteReport"] = None, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(RouteDirectionsBatchItemResponse, self).__init__(error=error, report=report, **kwargs) + self.format_version = None + self.routes = None + self.optimized_waypoints = None + self.report = report + self.error = error + + +class RouteDirectionsBatchResult(BatchResult): + """This object is returned from a successful Route Directions Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.route.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.route.models.RouteDirectionsBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[RouteDirectionsBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchResult, self).__init__(**kwargs) + self.batch_items = None + + +class RouteGuidance(msrest.serialization.Model): + """Contains guidance related elements. This field is present only when guidance was requested and is available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar instructions: A list of instructions describing maneuvers. + :vartype instructions: list[~azure.maps.route.models.RouteInstruction] + :ivar instruction_groups: Groups a sequence of instruction elements which are related to each + other. + :vartype instruction_groups: list[~azure.maps.route.models.RouteInstructionGroup] + """ + + _validation = { + 'instructions': {'readonly': True}, + 'instruction_groups': {'readonly': True}, + } + + _attribute_map = { + 'instructions': {'key': 'instructions', 'type': '[RouteInstruction]'}, + 'instruction_groups': {'key': 'instructionGroups', 'type': '[RouteInstructionGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteGuidance, self).__init__(**kwargs) + self.instructions = None + self.instruction_groups = None + + +class RouteInstruction(msrest.serialization.Model): + """A set of attributes describing a maneuver, e.g. 'Turn right', 'Keep left', 'Take the ferry', 'Take the motorway', 'Arrive'. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar route_offset_in_meters: Distance from the start of the route to the point of the + instruction. + :vartype route_offset_in_meters: int + :ivar travel_time_in_seconds: Estimated travel time up to the point corresponding to + routeOffsetInMeters. + :vartype travel_time_in_seconds: int + :param point: A location represented as a latitude and longitude. + :type point: ~azure.maps.route.models.LatLongPair + :ivar point_index: The index of the point in the list of polyline "points" corresponding to the + point of the instruction. + :vartype point_index: int + :param instruction_type: Type of the instruction, e.g., turn or change of road form. Possible + values include: "TURN", "ROAD_CHANGE", "LOCATION_DEPARTURE", "LOCATION_ARRIVAL", + "DIRECTION_INFO", "LOCATION_WAYPOINT". + :type instruction_type: str or ~azure.maps.route.models.GuidanceInstructionType + :ivar road_numbers: The road number(s) of the next significant road segment(s) after the + maneuver, or of the road(s) to be followed. Example: ["E34", "N205"]. + :vartype road_numbers: list[str] + :ivar exit_number: The number(s) of a highway exit taken by the current maneuver. If an exit + has multiple exit numbers, they will be separated by "," and possibly aggregated by "-", e.g., + "10, 13-15". + :vartype exit_number: str + :ivar street: Street name of the next significant road segment after the maneuver, or of the + street that should be followed. + :vartype street: str + :ivar signpost_text: The text on a signpost which is most relevant to the maneuver, or to the + direction that should be followed. + :vartype signpost_text: str + :ivar country_code: 3-character `ISO 3166-1 `_ + alpha-3 country code. E.g. USA. + :vartype country_code: str + :ivar state_code: A subdivision (e.g., state) of the country, represented by the second part of + an `ISO 3166-2 `_ code. This is only available for + some countries like the US, Canada, and Mexico. + :vartype state_code: str + :ivar junction_type: The type of the junction where the maneuver takes place. For larger + roundabouts, two separate instructions are generated for entering and leaving the roundabout. + Possible values include: "REGULAR", "ROUNDABOUT", "BIFURCATION". + :vartype junction_type: str or ~azure.maps.route.models.JunctionType + :ivar turn_angle_in_degrees: Indicates the direction of an instruction. If junctionType + indicates a turn instruction: + + + * 180 = U-turn + * [-179, -1] = Left turn + * 0 = Straight on (a '0 degree' turn) + * [1, 179] = Right turn + + If junctionType indicates a bifurcation instruction: + + + * <0 - keep left + * >0 - keep right. + :vartype turn_angle_in_degrees: int + :ivar roundabout_exit_number: This indicates which exit to take at a roundabout. + :vartype roundabout_exit_number: str + :ivar possible_combine_with_next: It is possible to optionally combine the instruction with the + next one. This can be used to build messages like "Turn left and then turn right". + :vartype possible_combine_with_next: bool + :ivar driving_side: Indicates left-hand vs. right-hand side driving at the point of the + maneuver. Possible values include: "LEFT", "RIGHT". + :vartype driving_side: str or ~azure.maps.route.models.DrivingSide + :ivar maneuver: A code identifying the maneuver. Possible values include: "ARRIVE", + "ARRIVE_LEFT", "ARRIVE_RIGHT", "DEPART", "STRAIGHT", "KEEP_RIGHT", "BEAR_RIGHT", "TURN_RIGHT", + "SHARP_RIGHT", "KEEP_LEFT", "BEAR_LEFT", "TURN_LEFT", "SHARP_LEFT", "MAKE_UTURN", + "ENTER_MOTORWAY", "ENTER_FREEWAY", "ENTER_HIGHWAY", "TAKE_EXIT", "MOTORWAY_EXIT_LEFT", + "MOTORWAY_EXIT_RIGHT", "TAKE_FERRY", "ROUNDABOUT_CROSS", "ROUNDABOUT_RIGHT", "ROUNDABOUT_LEFT", + "ROUNDABOUT_BACK", "TRY_MAKE_UTURN", "FOLLOW", "SWITCH_PARALLEL_ROAD", "SWITCH_MAIN_ROAD", + "ENTRANCE_RAMP", "WAYPOINT_LEFT", "WAYPOINT_RIGHT", "WAYPOINT_REACHED". + :vartype maneuver: str or ~azure.maps.route.models.GuidanceManeuver + :ivar message: A human-readable message for the maneuver. + :vartype message: str + :ivar combined_message: A human-readable message for the maneuver combined with the message + from the next instruction. Sometimes it is possible to combine two successive instructions into + a single instruction making it easier to follow. When this is the case the + possibleCombineWithNext flag will be true. For example: + + .. code-block:: + + 10. Turn left onto Einsteinweg/A10/E22 towards Ring Amsterdam + 11. Follow Einsteinweg/A10/E22 towards Ring Amsterdam + + The possibleCombineWithNext flag on instruction 10 is true. This indicates to the clients of + coded guidance that it can be combined with instruction 11. The instructions will be combined + automatically for clients requesting human-readable guidance. The combinedMessage field + contains the combined message: + + .. code-block:: + + Turn left onto Einsteinweg/A10/E22 towards Ring Amsterdam + then follow Einsteinweg/A10/E22 towards Ring Amsterdam. + :vartype combined_message: str + """ + + _validation = { + 'route_offset_in_meters': {'readonly': True}, + 'travel_time_in_seconds': {'readonly': True}, + 'point_index': {'readonly': True}, + 'road_numbers': {'readonly': True}, + 'exit_number': {'readonly': True}, + 'street': {'readonly': True}, + 'signpost_text': {'readonly': True}, + 'country_code': {'readonly': True}, + 'state_code': {'readonly': True}, + 'junction_type': {'readonly': True}, + 'turn_angle_in_degrees': {'readonly': True}, + 'roundabout_exit_number': {'readonly': True}, + 'possible_combine_with_next': {'readonly': True}, + 'driving_side': {'readonly': True}, + 'maneuver': {'readonly': True}, + 'message': {'readonly': True}, + 'combined_message': {'readonly': True}, + } + + _attribute_map = { + 'route_offset_in_meters': {'key': 'routeOffsetInMeters', 'type': 'int'}, + 'travel_time_in_seconds': {'key': 'travelTimeInSeconds', 'type': 'int'}, + 'point': {'key': 'point', 'type': 'LatLongPair'}, + 'point_index': {'key': 'pointIndex', 'type': 'int'}, + 'instruction_type': {'key': 'instructionType', 'type': 'str'}, + 'road_numbers': {'key': 'roadNumbers', 'type': '[str]'}, + 'exit_number': {'key': 'exitNumber', 'type': 'str'}, + 'street': {'key': 'street', 'type': 'str'}, + 'signpost_text': {'key': 'signpostText', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'state_code': {'key': 'stateCode', 'type': 'str'}, + 'junction_type': {'key': 'junctionType', 'type': 'str'}, + 'turn_angle_in_degrees': {'key': 'turnAngleInDecimalDegrees', 'type': 'int'}, + 'roundabout_exit_number': {'key': 'roundaboutExitNumber', 'type': 'str'}, + 'possible_combine_with_next': {'key': 'possibleCombineWithNext', 'type': 'bool'}, + 'driving_side': {'key': 'drivingSide', 'type': 'str'}, + 'maneuver': {'key': 'maneuver', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'combined_message': {'key': 'combinedMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + point: Optional["LatLongPair"] = None, + instruction_type: Optional[Union[str, "GuidanceInstructionType"]] = None, + **kwargs + ): + super(RouteInstruction, self).__init__(**kwargs) + self.route_offset_in_meters = None + self.travel_time_in_seconds = None + self.point = point + self.point_index = None + self.instruction_type = instruction_type + self.road_numbers = None + self.exit_number = None + self.street = None + self.signpost_text = None + self.country_code = None + self.state_code = None + self.junction_type = None + self.turn_angle_in_degrees = None + self.roundabout_exit_number = None + self.possible_combine_with_next = None + self.driving_side = None + self.maneuver = None + self.message = None + self.combined_message = None + + +class RouteInstructionGroup(msrest.serialization.Model): + """Groups a sequence of instruction elements which are related to each other. The sequence range is constrained with firstInstructionIndex and lastInstructionIndex. When human-readable text messages are requested for guidance (instructionType=text or tagged), then the instructionGroup has a summary message returned when available. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar first_instruction_index: Index of the first instruction in the instructions and belonging + to this group. + :vartype first_instruction_index: int + :ivar last_instruction_index: Index of the last instruction in the instructions and belonging + to this group. + :vartype last_instruction_index: int + :ivar group_length_in_meters: Length of the group. + :vartype group_length_in_meters: int + :ivar group_message: Summary message when human-readable text messages are requested for + guidance (instructionType=text or tagged). + :vartype group_message: str + """ + + _validation = { + 'first_instruction_index': {'readonly': True}, + 'last_instruction_index': {'readonly': True}, + 'group_length_in_meters': {'readonly': True}, + 'group_message': {'readonly': True}, + } + + _attribute_map = { + 'first_instruction_index': {'key': 'firstInstructionIndex', 'type': 'int'}, + 'last_instruction_index': {'key': 'lastInstructionIndex', 'type': 'int'}, + 'group_length_in_meters': {'key': 'groupLengthInMeters', 'type': 'int'}, + 'group_message': {'key': 'groupMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteInstructionGroup, self).__init__(**kwargs) + self.first_instruction_index = None + self.last_instruction_index = None + self.group_length_in_meters = None + self.group_message = None + + +class RouteLeg(msrest.serialization.Model): + """A description of a part of a route, comprised of a list of points. Each additional waypoint provided in the request will result in an additional leg in the returned route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for route section. + :vartype summary: ~azure.maps.route.models.RouteLegSummary + :ivar points: Points array. + :vartype points: list[~azure.maps.route.models.LatLongPair] + """ + + _validation = { + 'summary': {'readonly': True}, + 'points': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteLegSummary'}, + 'points': {'key': 'points', 'type': '[LatLongPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteLeg, self).__init__(**kwargs) + self.summary = None + self.points = None + + +class RouteLegSummary(msrest.serialization.Model): + """Summary object for route section. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar length_in_meters: Length In Meters property. + :vartype length_in_meters: int + :ivar travel_time_in_seconds: Estimated travel time in seconds property that includes the delay + due to real-time traffic. Note that even when traffic=false travelTimeInSeconds still includes + the delay due to traffic. If DepartAt is in the future, travel time is calculated using + time-dependent historic traffic data. + :vartype travel_time_in_seconds: int + :ivar traffic_delay_in_seconds: Estimated delay in seconds caused by the real-time incident(s) + according to traffic information. For routes planned with departure time in the future, delays + is always 0. To return additional travel times using different types of traffic information, + parameter computeTravelTimeFor=all needs to be added. + :vartype traffic_delay_in_seconds: int + :ivar departure_time: The estimated departure time for the route or leg. + :vartype departure_time: ~datetime.datetime + :ivar arrival_time: The estimated arrival time for the route or leg. + :vartype arrival_time: ~datetime.datetime + :ivar no_traffic_travel_time_in_seconds: Estimated travel time calculated as if there are no + delays on the route due to traffic conditions (e.g. congestion). Included only if + computeTravelTimeFor = all is used in the query. + :vartype no_traffic_travel_time_in_seconds: int + :ivar historic_traffic_travel_time_in_seconds: Estimated travel time calculated using + time-dependent historic traffic data. Included only if computeTravelTimeFor = all is used in + the query. + :vartype historic_traffic_travel_time_in_seconds: int + :ivar live_traffic_incidents_travel_time_in_seconds: Estimated travel time calculated using + real-time speed data. Included only if computeTravelTimeFor = all is used in the query. + :vartype live_traffic_incidents_travel_time_in_seconds: int + :ivar fuel_consumption_in_liters: Estimated fuel consumption in liters using the Combustion + Consumption Model. Included if vehicleEngineType is set to *combustion* and + constantSpeedConsumptionInLitersPerHundredkm is specified. The value will be non-negative. + :vartype fuel_consumption_in_liters: float + :ivar battery_consumption_in_kw_h: Estimated electric energy consumption in kilowatt hours + (kWh) using the Electric Consumption Model. Included if vehicleEngineType is set to electric + and constantSpeedConsumptionInkWhPerHundredkm is specified. The value of + batteryConsumptionInkWh includes the recuperated electric energy and can therefore be negative + (which indicates gaining energy). If both maxChargeInkWh and currentChargeInkWh are specified, + recuperation will be capped to ensure that the battery charge level never exceeds + maxChargeInkWh. If neither maxChargeInkWh nor currentChargeInkWh are specified, unconstrained + recuperation is assumed in the consumption calculation. + :vartype battery_consumption_in_kw_h: float + """ + + _validation = { + 'length_in_meters': {'readonly': True}, + 'travel_time_in_seconds': {'readonly': True}, + 'traffic_delay_in_seconds': {'readonly': True}, + 'departure_time': {'readonly': True}, + 'arrival_time': {'readonly': True}, + 'no_traffic_travel_time_in_seconds': {'readonly': True}, + 'historic_traffic_travel_time_in_seconds': {'readonly': True}, + 'live_traffic_incidents_travel_time_in_seconds': {'readonly': True}, + 'fuel_consumption_in_liters': {'readonly': True}, + 'battery_consumption_in_kw_h': {'readonly': True}, + } + + _attribute_map = { + 'length_in_meters': {'key': 'lengthInMeters', 'type': 'int'}, + 'travel_time_in_seconds': {'key': 'travelTimeInSeconds', 'type': 'int'}, + 'traffic_delay_in_seconds': {'key': 'trafficDelayInSeconds', 'type': 'int'}, + 'departure_time': {'key': 'departureTime', 'type': 'iso-8601'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'iso-8601'}, + 'no_traffic_travel_time_in_seconds': {'key': 'noTrafficTravelTimeInSeconds', 'type': 'int'}, + 'historic_traffic_travel_time_in_seconds': {'key': 'historicTrafficTravelTimeInSeconds', 'type': 'int'}, + 'live_traffic_incidents_travel_time_in_seconds': {'key': 'liveTrafficIncidentsTravelTimeInSeconds', 'type': 'int'}, + 'fuel_consumption_in_liters': {'key': 'fuelConsumptionInLiters', 'type': 'float'}, + 'battery_consumption_in_kw_h': {'key': 'batteryConsumptionInkWh', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteLegSummary, self).__init__(**kwargs) + self.length_in_meters = None + self.travel_time_in_seconds = None + self.traffic_delay_in_seconds = None + self.departure_time = None + self.arrival_time = None + self.no_traffic_travel_time_in_seconds = None + self.historic_traffic_travel_time_in_seconds = None + self.live_traffic_incidents_travel_time_in_seconds = None + self.fuel_consumption_in_liters = None + self.battery_consumption_in_kw_h = None + + +class RouteMatrix(msrest.serialization.Model): + """Matrix result object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: StatusCode property for the current cell in the input matrix. + :vartype status_code: int + :ivar response: Response object of the current cell in the input matrix. + :vartype response: ~azure.maps.route.models.RouteMatrixResultResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'RouteMatrixResultResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrix, self).__init__(**kwargs) + self.status_code = None + self.response = None + + +class RouteMatrixQuery(msrest.serialization.Model): + """An object with a matrix of coordinates. + + :param origins: A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type origins: ~azure.maps.route.models.GeoJsonMultiPoint + :param destinations: A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type destinations: ~azure.maps.route.models.GeoJsonMultiPoint + """ + + _attribute_map = { + 'origins': {'key': 'origins', 'type': 'GeoJsonMultiPoint'}, + 'destinations': {'key': 'destinations', 'type': 'GeoJsonMultiPoint'}, + } + + def __init__( + self, + *, + origins: Optional["GeoJsonMultiPoint"] = None, + destinations: Optional["GeoJsonMultiPoint"] = None, + **kwargs + ): + super(RouteMatrixQuery, self).__init__(**kwargs) + self.origins = origins + self.destinations = destinations + + +class RouteMatrixResult(msrest.serialization.Model): + """This object is returned from a successful Route Matrix call. For ex, if 2 origins and 3 destinations are provided, there are going to 2 arrays with 3 elements in each. Each element's content depends on the options provided in the query. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :ivar matrix: Results as a 2 dimensional array of route summaries. + :vartype matrix: list[list[~azure.maps.route.models.RouteMatrix]] + :ivar summary: Summary object. + :vartype summary: ~azure.maps.route.models.RouteMatrixSummary + """ + + _validation = { + 'format_version': {'readonly': True}, + 'matrix': {'readonly': True}, + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'matrix': {'key': 'matrix', 'type': '[[RouteMatrix]]'}, + 'summary': {'key': 'summary', 'type': 'RouteMatrixSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResult, self).__init__(**kwargs) + self.format_version = None + self.matrix = None + self.summary = None + + +class RouteMatrixResultResponse(msrest.serialization.Model): + """Response object of the current cell in the input matrix. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for route section. + :vartype summary: ~azure.maps.route.models.RouteLegSummary + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'routeSummary', 'type': 'RouteLegSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResultResponse, self).__init__(**kwargs) + self.summary = None + + +class RouteMatrixSummary(msrest.serialization.Model): + """Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_routes: Number of successful routes in the response. + :vartype successful_routes: int + :ivar total_routes: Total number of routes requested. Number of cells in the input matrix. + :vartype total_routes: int + """ + + _validation = { + 'successful_routes': {'readonly': True}, + 'total_routes': {'readonly': True}, + } + + _attribute_map = { + 'successful_routes': {'key': 'successfulRoutes', 'type': 'int'}, + 'total_routes': {'key': 'totalRoutes', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixSummary, self).__init__(**kwargs) + self.successful_routes = None + self.total_routes = None + + +class RouteOptimizedWaypoint(msrest.serialization.Model): + """Optimized way point object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provided_index: Way point index provided by the user. + :vartype provided_index: int + :ivar optimized_index: Optimized way point index from the system. + :vartype optimized_index: int + """ + + _validation = { + 'provided_index': {'readonly': True}, + 'optimized_index': {'readonly': True}, + } + + _attribute_map = { + 'provided_index': {'key': 'providedIndex', 'type': 'int'}, + 'optimized_index': {'key': 'optimizedIndex', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteOptimizedWaypoint, self).__init__(**kwargs) + self.provided_index = None + self.optimized_index = None + + +class RouteRange(msrest.serialization.Model): + """Reachable Range. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param center: Center point of the reachable range. + :type center: ~azure.maps.route.models.LatLongPair + :ivar boundary: Polygon boundary of the reachable range represented as a list of points. + :vartype boundary: list[~azure.maps.route.models.LatLongPair] + """ + + _validation = { + 'boundary': {'readonly': True}, + } + + _attribute_map = { + 'center': {'key': 'center', 'type': 'LatLongPair'}, + 'boundary': {'key': 'boundary', 'type': '[LatLongPair]'}, + } + + def __init__( + self, + *, + center: Optional["LatLongPair"] = None, + **kwargs + ): + super(RouteRange, self).__init__(**kwargs) + self.center = center + self.boundary = None + + +class RouteRangeResult(msrest.serialization.Model): + """This object is returned from a successful Route Reachable Range call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar format_version: Format Version property. + :vartype format_version: str + :param reachable_range: Reachable Range. + :type reachable_range: ~azure.maps.route.models.RouteRange + :param report: Reports the effective settings used in the current call. + :type report: ~azure.maps.route.models.RouteReport + """ + + _validation = { + 'format_version': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'reachable_range': {'key': 'reachableRange', 'type': 'RouteRange'}, + 'report': {'key': 'report', 'type': 'RouteReport'}, + } + + def __init__( + self, + *, + reachable_range: Optional["RouteRange"] = None, + report: Optional["RouteReport"] = None, + **kwargs + ): + super(RouteRangeResult, self).__init__(**kwargs) + self.format_version = None + self.reachable_range = reachable_range + self.report = report + + +class RouteReport(msrest.serialization.Model): + """Reports the effective settings used in the current call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar effective_settings: Effective parameters or data used when calling this Route API. + :vartype effective_settings: list[~azure.maps.route.models.EffectiveSetting] + """ + + _validation = { + 'effective_settings': {'readonly': True}, + } + + _attribute_map = { + 'effective_settings': {'key': 'effectiveSettings', 'type': '[EffectiveSetting]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteReport, self).__init__(**kwargs) + self.effective_settings = None + + +class RouteSection(msrest.serialization.Model): + """Route sections contain additional information about parts of a route. Each section contains at least the elements ``startPointIndex``\ , ``endPointIndex``\ , and ``sectionType``. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_point_index: Index of the first point (offset 0) in the route this section applies + to. + :vartype start_point_index: int + :ivar end_point_index: Index of the last point (offset 0) in the route this section applies to. + :vartype end_point_index: int + :ivar section_type: Section types of the reported route response. Possible values include: + "CAR_TRAIN", "COUNTRY", "FERRY", "MOTORWAY", "PEDESTRIAN", "TOLL_ROAD", "TOLL_VIGNETTE", + "TRAFFIC", "TRAVEL_MODE", "TUNNEL", "CARPOOL", "URBAN". + :vartype section_type: str or ~azure.maps.route.models.ResponseSectionType + :ivar travel_mode: Travel mode for the calculated route. The value will be set to ``other`` if + the requested mode of transport is not possible in this section. Possible values include: + "car", "truck", "taxi", "bus", "van", "motorcycle", "bicycle", "pedestrian", "other". + :vartype travel_mode: str or ~azure.maps.route.models.ResponseTravelMode + :ivar simple_category: Type of the incident. Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or + OTHER. See "tec" for detailed information. Possible values include: "JAM", "ROAD_WORK", + "ROAD_CLOSURE", "OTHER". + :vartype simple_category: str or ~azure.maps.route.models.SimpleCategory + :ivar effective_speed_in_kmh: Effective speed of the incident in km/h, averaged over its entire + length. + :vartype effective_speed_in_kmh: int + :ivar delay_in_seconds: Delay in seconds caused by the incident. + :vartype delay_in_seconds: int + :ivar delay_magnitude: The magnitude of delay caused by the incident. These values correspond + to the values of the response field ty of the `Get Traffic Incident Detail API + `_. Possible values + include: "0", "1", "2", "3", "4". + :vartype delay_magnitude: str or ~azure.maps.route.models.DelayMagnitude + :param tec: Details of the traffic event, using definitions in the `TPEG2-TEC + `_ standard. Can contain effectCode and causes + elements. + :type tec: ~azure.maps.route.models.RouteSectionTec + """ + + _validation = { + 'start_point_index': {'readonly': True}, + 'end_point_index': {'readonly': True}, + 'section_type': {'readonly': True}, + 'travel_mode': {'readonly': True}, + 'simple_category': {'readonly': True}, + 'effective_speed_in_kmh': {'readonly': True}, + 'delay_in_seconds': {'readonly': True}, + 'delay_magnitude': {'readonly': True}, + } + + _attribute_map = { + 'start_point_index': {'key': 'startPointIndex', 'type': 'int'}, + 'end_point_index': {'key': 'endPointIndex', 'type': 'int'}, + 'section_type': {'key': 'sectionType', 'type': 'str'}, + 'travel_mode': {'key': 'travelMode', 'type': 'str'}, + 'simple_category': {'key': 'simpleCategory', 'type': 'str'}, + 'effective_speed_in_kmh': {'key': 'effectiveSpeedInKmh', 'type': 'int'}, + 'delay_in_seconds': {'key': 'delayInSeconds', 'type': 'int'}, + 'delay_magnitude': {'key': 'magnitudeOfDelay', 'type': 'str'}, + 'tec': {'key': 'tec', 'type': 'RouteSectionTec'}, + } + + def __init__( + self, + *, + tec: Optional["RouteSectionTec"] = None, + **kwargs + ): + super(RouteSection, self).__init__(**kwargs) + self.start_point_index = None + self.end_point_index = None + self.section_type = None + self.travel_mode = None + self.simple_category = None + self.effective_speed_in_kmh = None + self.delay_in_seconds = None + self.delay_magnitude = None + self.tec = tec + + +class RouteSectionTec(msrest.serialization.Model): + """Details of the traffic event, using definitions in the `TPEG2-TEC `_ standard. Can contain effectCode and causes elements. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar effect_code: The effect on the traffic flow. Contains a value in the tec001:EffectCode + table, as defined in the `TPEG2-TEC `_ standard. Can + be used to color-code traffic events according to severity. + :vartype effect_code: int + :param causes: Causes array. + :type causes: list[~azure.maps.route.models.RouteSectionTecCause] + """ + + _validation = { + 'effect_code': {'readonly': True}, + } + + _attribute_map = { + 'effect_code': {'key': 'effectCode', 'type': 'int'}, + 'causes': {'key': 'causes', 'type': '[RouteSectionTecCause]'}, + } + + def __init__( + self, + *, + causes: Optional[List["RouteSectionTecCause"]] = None, + **kwargs + ): + super(RouteSectionTec, self).__init__(**kwargs) + self.effect_code = None + self.causes = causes + + +class RouteSectionTecCause(msrest.serialization.Model): + """The cause of the traffic event. Can contain mainCauseCode and subCauseCode elements. Can be used to define iconography and descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar main_cause_code: The main cause of the traffic event. Contains a value in the + tec002:CauseCode table, as defined in the `TPEG2-TEC + `_ standard. + :vartype main_cause_code: int + :ivar sub_cause_code: The subcause of the traffic event. Contains a value in the sub cause + table defined by the mainCauseCode, as defined in the `TPEG2-TEC + `_ standard. + :vartype sub_cause_code: int + """ + + _validation = { + 'main_cause_code': {'readonly': True}, + 'sub_cause_code': {'readonly': True}, + } + + _attribute_map = { + 'main_cause_code': {'key': 'mainCauseCode', 'type': 'int'}, + 'sub_cause_code': {'key': 'subCauseCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteSectionTecCause, self).__init__(**kwargs) + self.main_cause_code = None + self.sub_cause_code = None + + +class RouteSummary(msrest.serialization.Model): + """Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar length_in_meters: Length In Meters property. + :vartype length_in_meters: int + :ivar travel_time_in_seconds: Estimated travel time in seconds property that includes the delay + due to real-time traffic. Note that even when traffic=false travelTimeInSeconds still includes + the delay due to traffic. If DepartAt is in the future, travel time is calculated using + time-dependent historic traffic data. + :vartype travel_time_in_seconds: int + :ivar traffic_delay_in_seconds: Estimated delay in seconds caused by the real-time incident(s) + according to traffic information. For routes planned with departure time in the future, delays + is always 0. To return additional travel times using different types of traffic information, + parameter computeTravelTimeFor=all needs to be added. + :vartype traffic_delay_in_seconds: int + :ivar departure_time: The estimated departure time for the route or leg. + :vartype departure_time: ~datetime.datetime + :ivar arrival_time: The estimated arrival time for the route or leg. + :vartype arrival_time: ~datetime.datetime + """ + + _validation = { + 'length_in_meters': {'readonly': True}, + 'travel_time_in_seconds': {'readonly': True}, + 'traffic_delay_in_seconds': {'readonly': True}, + 'departure_time': {'readonly': True}, + 'arrival_time': {'readonly': True}, + } + + _attribute_map = { + 'length_in_meters': {'key': 'lengthInMeters', 'type': 'int'}, + 'travel_time_in_seconds': {'key': 'travelTimeInSeconds', 'type': 'int'}, + 'traffic_delay_in_seconds': {'key': 'trafficDelayInSeconds', 'type': 'int'}, + 'departure_time': {'key': 'departureTime', 'type': 'iso-8601'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteSummary, self).__init__(**kwargs) + self.length_in_meters = None + self.travel_time_in_seconds = None + self.traffic_delay_in_seconds = None + self.departure_time = None + self.arrival_time = None diff --git a/sdk/maps/azure-maps-route/azure/maps/route/models/_route_client_enums.py b/sdk/maps/azure-maps-route/azure/maps/route/models/_route_client_enums.py new file mode 100644 index 000000000000..5f386bf71f0d --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_route_client_enums.py @@ -0,0 +1,445 @@ +# 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 AlternativeRouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Allow any alternative route to be returned irrespective of how it compares to the reference + #: route in terms of optimality. + ANY_ROUTE = "anyRoute" + #: Return an alternative route only if it is better than the reference route according to the + #: given planning criteria. + BETTER_ROUTE = "betterRoute" + +class ComputeTravelTime(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Does not compute additional travel times. + NONE = "none" + #: Computes travel times for all types of traffic information and specifies all results in the + #: fields noTrafficTravelTimeInSeconds, historicTrafficTravelTimeInSeconds and + #: liveTrafficIncidentsTravelTimeInSeconds being included in the summaries in the route response. + ALL = "all" + +class DelayMagnitude(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The magnitude of delay caused by the incident. These values correspond to the values of the + response field ty of the `Get Traffic Incident Detail API + `_. + """ + + #: Unknown. + UNKNOWN = "0" + #: Minor. + MINOR = "1" + #: Moderate. + MODERATE = "2" + #: Major. + MAJOR = "3" + #: Undefined, used for road closures and other indefinite delays. + UNDEFINED = "4" + +class DrivingSide(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates left-hand vs. right-hand side driving at the point of the maneuver. + """ + + #: Left side. + LEFT = "LEFT" + #: Right side. + RIGHT = "RIGHT" + +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 GuidanceInstructionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the instruction, e.g., turn or change of road form. + """ + + #: Turn. + TURN = "TURN" + #: Road Change. + ROAD_CHANGE = "ROAD_CHANGE" + #: Departure location. + LOCATION_DEPARTURE = "LOCATION_DEPARTURE" + #: Arrival location. + LOCATION_ARRIVAL = "LOCATION_ARRIVAL" + #: Direction information. + DIRECTION_INFO = "DIRECTION_INFO" + #: Way point location. + LOCATION_WAYPOINT = "LOCATION_WAYPOINT" + +class GuidanceManeuver(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """A code identifying the maneuver. + """ + + #: You have arrived. + ARRIVE = "ARRIVE" + #: You have arrived. Your destination is on the left. + ARRIVE_LEFT = "ARRIVE_LEFT" + #: You have arrived. Your destination is on the right. + ARRIVE_RIGHT = "ARRIVE_RIGHT" + #: Leave. + DEPART = "DEPART" + #: Keep straight on. + STRAIGHT = "STRAIGHT" + #: Keep right. + KEEP_RIGHT = "KEEP_RIGHT" + #: Bear right. + BEAR_RIGHT = "BEAR_RIGHT" + #: Turn right. + TURN_RIGHT = "TURN_RIGHT" + #: Turn sharp right. + SHARP_RIGHT = "SHARP_RIGHT" + #: Keep left. + KEEP_LEFT = "KEEP_LEFT" + #: Bear left. + BEAR_LEFT = "BEAR_LEFT" + #: Turn left. + TURN_LEFT = "TURN_LEFT" + #: Turn sharp left. + SHARP_LEFT = "SHARP_LEFT" + #: Make a U-turn. + MAKE_U_TURN = "MAKE_UTURN" + #: Take the motorway. + ENTER_MOTORWAY = "ENTER_MOTORWAY" + #: Take the freeway. + ENTER_FREEWAY = "ENTER_FREEWAY" + #: Take the highway. + ENTER_HIGHWAY = "ENTER_HIGHWAY" + #: Take the exit. + TAKE_EXIT = "TAKE_EXIT" + #: Take the left exit. + MOTORWAY_EXIT_LEFT = "MOTORWAY_EXIT_LEFT" + #: Take the right exit. + MOTORWAY_EXIT_RIGHT = "MOTORWAY_EXIT_RIGHT" + #: Take the ferry. + TAKE_FERRY = "TAKE_FERRY" + #: Cross the roundabout. + ROUNDABOUT_CROSS = "ROUNDABOUT_CROSS" + #: At the roundabout take the exit on the right. + ROUNDABOUT_RIGHT = "ROUNDABOUT_RIGHT" + #: At the roundabout take the exit on the left. + ROUNDABOUT_LEFT = "ROUNDABOUT_LEFT" + #: Go around the roundabout. + ROUNDABOUT_BACK = "ROUNDABOUT_BACK" + #: Try to make a U-turn. + TRY_MAKE_U_TURN = "TRY_MAKE_UTURN" + #: Follow. + FOLLOW = "FOLLOW" + #: Switch to the parallel road. + SWITCH_PARALLEL_ROAD = "SWITCH_PARALLEL_ROAD" + #: Switch to the main road. + SWITCH_MAIN_ROAD = "SWITCH_MAIN_ROAD" + #: Take the ramp. + ENTRANCE_RAMP = "ENTRANCE_RAMP" + #: You have reached the waypoint. It is on the left. + WAYPOINT_LEFT = "WAYPOINT_LEFT" + #: You have reached the waypoint. It is on the right. + WAYPOINT_RIGHT = "WAYPOINT_RIGHT" + #: You have reached the waypoint. + WAYPOINT_REACHED = "WAYPOINT_REACHED" + +class InclineLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: low. + LOW = "low" + #: normal. + NORMAL = "normal" + #: high. + HIGH = "high" + +class JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class JunctionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the junction where the maneuver takes place. For larger roundabouts, two separate + instructions are generated for entering and leaving the roundabout. + """ + + #: regular. + REGULAR = "REGULAR" + #: roundabout. + ROUNDABOUT = "ROUNDABOUT" + #: bifurcation. + BIFURCATION = "BIFURCATION" + +class Report(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Reports the effective parameters or data used when calling the API. + EFFECTIVE_SETTINGS = "effectiveSettings" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +class ResponseSectionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Section types of the reported route response + """ + + #: Sections of the route that are cars or trains. + CAR_OR_TRAIN = "CAR_TRAIN" + #: Sections indicating which countries the route is in. + COUNTRY = "COUNTRY" + #: Sections of the route that are ferries. + FERRY = "FERRY" + #: Sections of the route that are motorways. + MOTORWAY = "MOTORWAY" + #: Sections of the route that are only suited for pedestrians. + PEDESTRIAN = "PEDESTRIAN" + #: Sections of the route that require a toll to be payed. + TOLL_ROAD = "TOLL_ROAD" + #: Sections of the route that require a toll vignette to be present. + TOLL_VIGNETTE = "TOLL_VIGNETTE" + #: Sections of the route that contain traffic information. + TRAFFIC = "TRAFFIC" + #: Sections in relation to the request parameter ``travelMode``. + TRAVEL_MODE = "TRAVEL_MODE" + #: Sections of the route that are tunnels. + TUNNEL = "TUNNEL" + #: Sections of the route that require use of carpool (HOV/High Occupancy Vehicle) lanes. + CARPOOL = "CARPOOL" + #: Sections of the route that are located within urban areas. + URBAN = "URBAN" + +class ResponseTravelMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Travel mode for the calculated route. The value will be set to ``other`` if the requested mode + of transport is not possible in this section + """ + + #: The returned routes are optimized for cars. + CAR = "car" + #: The returned routes are optimized for commercial vehicles, like for trucks. + TRUCK = "truck" + #: The returned routes are optimized for taxis. BETA functionality. + TAXI = "taxi" + #: The returned routes are optimized for buses, including the use of bus only lanes. BETA + #: functionality. + BUS = "bus" + #: The returned routes are optimized for vans. BETA functionality. + VAN = "van" + #: The returned routes are optimized for motorcycles. BETA functionality. + MOTORCYCLE = "motorcycle" + #: The returned routes are optimized for bicycles, including use of bicycle lanes. + BICYCLE = "bicycle" + #: The returned routes are optimized for pedestrians, including the use of sidewalks. + PEDESTRIAN = "pedestrian" + #: The given mode of transport is not possible in this section. + OTHER = "other" + +class RouteAvoidType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Avoids toll roads. + TOLL_ROADS = "tollRoads" + #: Avoids motorways. + MOTORWAYS = "motorways" + #: Avoids ferries. + FERRIES = "ferries" + #: Avoids unpaved roads. + UNPAVED_ROADS = "unpavedRoads" + #: Avoids routes that require the use of carpool (HOV/High Occupancy Vehicle) lanes. + CARPOOLS = "carpools" + #: Avoids using the same road multiple times. Most useful in conjunction with ``routeType``\ + #: =thrilling. + ALREADY_USED_ROADS = "alreadyUsedRoads" + #: Avoids border crossings in route calculation. + BORDER_CROSSINGS = "borderCrossings" + +class RouteInstructionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Returns raw instruction data without human-readable messages. + CODED = "coded" + #: Returns raw instructions data with human-readable messages in plain text. + TEXT = "text" + #: Returns raw instruction data with tagged human-readable messages to permit formatting. A + #: human-readable message is built up from repeatable identified elements. These are tagged to + #: allow client applications to format them correctly. The following message components are tagged + #: when instructionsType=tagged: street, roadNumber, signpostText, exitNumber, + #: roundaboutExitNumber. + #: + #: Example of tagged 'Turn left' message:​ + #: + #: .. code-block:: + #: + #: Turn left onto A4/E19 + #: towards Den Haag. + TAGGED = "tagged" + +class RouteRepresentationForBestOrder(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Includes route geometry in the response. + POLYLINE = "polyline" + #: Summary as per polyline but excluding the point geometry elements for the routes in the + #: response. + SUMMARY_ONLY = "summaryOnly" + #: Includes only the optimized waypoint indices but does not include the route geometry in the + #: response. + NONE = "none" + +class RouteType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: The fastest route. + FASTEST = "fastest" + #: The shortest route by distance. + SHORTEST = "shortest" + #: A route balanced by economy and speed. + ECONOMY = "eco" + #: Includes interesting or challenging roads and uses as few motorways as possible. You can choose + #: the level of turns included and also the degree of hilliness. See the hilliness and windingness + #: parameters for how to set this. There is a limit of 900 km on routes planned with + #: ``routeType``\ =thrilling. + THRILLING = "thrilling" + +class SectionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Sections of the route that are cars or trains. + CAR_OR_TRAIN = "carTrain" + #: Sections indicating which countries the route is in. + COUNTRY = "country" + #: Sections of the route that are ferries. + FERRY = "ferry" + #: Sections of the route that are motorways. + MOTORWAY = "motorway" + #: Sections of the route that are only suited for pedestrians. + PEDESTRIAN = "pedestrian" + #: Sections of the route that require a toll to be payed. + TOLL_ROAD = "tollRoad" + #: Sections of the route that require a toll vignette to be present. + TOLL_VIGNETTE = "tollVignette" + #: Sections of the route that contain traffic information. + TRAFFIC = "traffic" + #: Sections in relation to the request parameter ``travelMode``. + TRAVEL_MODE = "travelMode" + #: Sections of the route that are tunnels. + TUNNEL = "tunnel" + #: Sections of the route that require use of carpool (HOV/High Occupancy Vehicle) lanes. + CARPOOL = "carpool" + #: Sections of the route that are located within urban areas. + URBAN = "urban" + +class SimpleCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Type of the incident. Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or OTHER. See "tec" for + detailed information. + """ + + #: Traffic jam. + JAM = "JAM" + #: Road work. + ROAD_WORK = "ROAD_WORK" + #: Road closure. + ROAD_CLOSURE = "ROAD_CLOSURE" + #: Other. + OTHER = "OTHER" + +class TravelMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: The returned routes are optimized for cars. + CAR = "car" + #: The returned routes are optimized for commercial vehicles, like for trucks. + TRUCK = "truck" + #: The returned routes are optimized for taxis. BETA functionality. + TAXI = "taxi" + #: The returned routes are optimized for buses, including the use of bus only lanes. BETA + #: functionality. + BUS = "bus" + #: The returned routes are optimized for vans. BETA functionality. + VAN = "van" + #: The returned routes are optimized for motorcycles. BETA functionality. + MOTORCYCLE = "motorcycle" + #: The returned routes are optimized for bicycles, including use of bicycle lanes. + BICYCLE = "bicycle" + #: The returned routes are optimized for pedestrians, including the use of sidewalks. + PEDESTRIAN = "pedestrian" + +class VehicleEngineType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Internal combustion engine. + COMBUSTION = "combustion" + #: Electric engine. + ELECTRIC = "electric" + +class VehicleLoadType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Explosives. + US_HAZMAT_CLASS1 = "USHazmatClass1" + #: Compressed gas. + US_HAZMAT_CLASS2 = "USHazmatClass2" + #: Flammable liquids. + US_HAZMAT_CLASS3 = "USHazmatClass3" + #: Flammable solids. + US_HAZMAT_CLASS4 = "USHazmatClass4" + #: Oxidizers. + US_HAZMAT_CLASS5 = "USHazmatClass5" + #: Poisons. + US_HAZMAT_CLASS6 = "USHazmatClass6" + #: Radioactive. + US_HAZMAT_CLASS7 = "USHazmatClass7" + #: Corrosives. + US_HAZMAT_CLASS8 = "USHazmatClass8" + #: Miscellaneous. + US_HAZMAT_CLASS9 = "USHazmatClass9" + #: Explosives. + OTHER_HAZMAT_EXPLOSIVE = "otherHazmatExplosive" + #: Miscellaneous. + OTHER_HAZMAT_GENERAL = "otherHazmatGeneral" + #: Harmful to water. + OTHER_HAZMAT_HARMFUL_TO_WATER = "otherHazmatHarmfulToWater" + +class WindingnessLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: low. + LOW = "low" + #: normal. + NORMAL = "normal" + #: high. + HIGH = "high" diff --git a/sdk/maps/azure-maps-route/azure/maps/route/operations/__init__.py b/sdk/maps/azure-maps-route/azure/maps/route/operations/__init__.py new file mode 100644 index 000000000000..5388780d333b --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._route_operations import RouteOperations + +__all__ = [ + 'RouteOperations', +] diff --git a/sdk/maps/azure-maps-route/azure/maps/route/operations/_route_operations.py b/sdk/maps/azure-maps-route/azure/maps/route/operations/_route_operations.py new file mode 100644 index 000000000000..0f30f454f200 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/operations/_route_operations.py @@ -0,0 +1,3242 @@ +# 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 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class RouteOperations(object): + """RouteOperations 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.route.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 _request_route_matrix_initial( + self, + route_matrix_query, # type: "_models.RouteMatrixQuery" + format="json", # type: Union[str, "_models.JsonFormat"] + wait_for_results=None, # type: Optional[bool] + compute_travel_time=None, # type: Optional[Union[str, "_models.ComputeTravelTime"]] + filter_section_type=None, # type: Optional[Union[str, "_models.SectionType"]] + arrive_at=None, # type: Optional[datetime.datetime] + depart_at=None, # type: Optional[datetime.datetime] + vehicle_axle_weight=0, # type: Optional[int] + vehicle_length=0, # type: Optional[float] + vehicle_height=0, # type: Optional[float] + vehicle_width=0, # type: Optional[float] + vehicle_max_speed=0, # type: Optional[int] + vehicle_weight=0, # type: Optional[int] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + incline_level=None, # type: Optional[Union[str, "_models.InclineLevel"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + use_traffic_data=None, # type: Optional[bool] + route_type=None, # type: Optional[Union[str, "_models.RouteType"]] + vehicle_load_type=None, # type: Optional[Union[str, "_models.VehicleLoadType"]] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteMatrixResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResult"]] + 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._request_route_matrix_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_matrix_query, 'RouteMatrixQuery') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _request_route_matrix_initial.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + def begin_request_route_matrix( + self, + route_matrix_query, # type: "_models.RouteMatrixQuery" + format="json", # type: Union[str, "_models.JsonFormat"] + wait_for_results=None, # type: Optional[bool] + compute_travel_time=None, # type: Optional[Union[str, "_models.ComputeTravelTime"]] + filter_section_type=None, # type: Optional[Union[str, "_models.SectionType"]] + arrive_at=None, # type: Optional[datetime.datetime] + depart_at=None, # type: Optional[datetime.datetime] + vehicle_axle_weight=0, # type: Optional[int] + vehicle_length=0, # type: Optional[float] + vehicle_height=0, # type: Optional[float] + vehicle_width=0, # type: Optional[float] + vehicle_max_speed=0, # type: Optional[int] + vehicle_weight=0, # type: Optional[int] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + incline_level=None, # type: Optional[Union[str, "_models.InclineLevel"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + use_traffic_data=None, # type: Optional[bool] + route_type=None, # type: Optional[Union[str, "_models.RouteType"]] + vehicle_load_type=None, # type: Optional[Union[str, "_models.VehicleLoadType"]] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteMatrixResult"] + """**Applies to**\ : S1 pricing tier. + + The Matrix Routing service allows calculation of a matrix of route summaries for a set of + routes defined by origin and destination locations by using an asynchronous (async) or + synchronous (sync) POST request. For every given origin, the service calculates the cost of + routing from that origin to every given destination. The set of origins and the set of + destinations can be thought of as the column and row headers of a table and each cell in the + table contains the costs of routing from the origin to the destination for that cell. As an + example, let's say a food delivery company has 20 drivers and they need to find the closest + driver to pick up the delivery from the restaurant. To solve this use case, they can call + Matrix Route API. + + For each route, the travel times and distances are returned. You can use the computed costs to + determine which detailed routes to calculate using the Route Directions API. + + The maximum size of a matrix for async request is **700** and for sync request it's **100** + (the number of origins multiplied by the number of destinations). + + Submit Synchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + If your scenario requires synchronous requests and the maximum size of the matrix is less than + or equal to 100, you might want to make synchronous request. The maximum size of a matrix for + this API is **100** (the number of origins multiplied by the number of destinations). With that + constraint in mind, examples of possible matrix dimensions are: 10x10, 6x8, 9x8 (it does not + need to be square). + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex routing + requests. When you make a request by using async request, by default the service returns a 202 + response code along a redirect URL in the Location field of the response header. This URL + should be checked periodically until the response data or error information is available. If + ``waitForResults`` parameter in the request is set to true, user will get a 200 response if the + request is finished under 120 seconds. + + The maximum size of a matrix for this API is **700** (the number of origins multiplied by the + number of destinations). With that constraint in mind, examples of possible matrix dimensions + are: 50x10, 10x10, 28x25. 10x70 (it does not need to be square). + + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/json?api-version=1.0&subscription-key={subscription-key} + + Here's a typical sequence of asynchronous operations: + + + #. + Client sends a Route Matrix POST request to Azure Maps + + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Route Matrix request has been accepted. + + HTTP ``Error`` - There was an error processing your Route Matrix request. This could + either be a 400 Bad Request or any other Error status code. + + + + #. + If the Matrix Route request was accepted successfully, the Location header in the response + contains the URL to download the results of the request. This status URI looks like the + following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + + #. Client issues a GET request on the download URL obtained in Step 3 to download the results + + Download Sync Results + ^^^^^^^^^^^^^^^^^^^^^ + + When you make a POST request for Route Matrix Sync API, the service returns 200 response code + for successful request and a response array. The response body will contain the data and there + will be no possibility to retrieve the results later. + + Download Async Results + ^^^^^^^^^^^^^^^^^^^^^^ + + When a request issues a ``202 Accepted`` response, the request is being processed using our + async pipeline. You will be given a URL to check the progress of your async request in the + location header of the response. This status URI looks like the following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + The URL provided by the location header will return the following responses when a ``GET`` + request is issued. + + .. + + HTTP ``202 Accepted`` - Matrix request was accepted but is still being processed. Please try + again in some time. + + HTTP ``200 OK`` - Matrix request successfully processed. The response body contains all of + the results. + + :param route_matrix_query: The matrix of origin and destination coordinates to compute the + route distance, travel time and other summary for each cell of the matrix based on the input + parameters. The minimum and the maximum cell count supported are 1 and **700** for async and + **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 + origins and 25 destinations for async API. + :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :param wait_for_results: Boolean to indicate whether to execute the request synchronously. If + set to true, user will get a 200 response if the request is finished under 120 seconds. + Otherwise, user will get a 202 response right away. Please refer to the API description for + more details on 202 response. **Supported only for async request**. + :type wait_for_results: bool + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + :type vehicle_weight: int + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :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 RouteMatrixResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteMatrixResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResult"] + 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._request_route_matrix_initial( + route_matrix_query=route_matrix_query, + format=format, + wait_for_results=wait_for_results, + compute_travel_time=compute_travel_time, + filter_section_type=filter_section_type, + arrive_at=arrive_at, + depart_at=depart_at, + vehicle_axle_weight=vehicle_axle_weight, + vehicle_length=vehicle_length, + vehicle_height=vehicle_height, + vehicle_width=vehicle_width, + vehicle_max_speed=vehicle_max_speed, + vehicle_weight=vehicle_weight, + windingness=windingness, + incline_level=incline_level, + travel_mode=travel_mode, + avoid=avoid, + use_traffic_data=use_traffic_data, + route_type=route_type, + vehicle_load_type=vehicle_load_type, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_request_route_matrix.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + def _get_route_matrix_initial( + self, + matrix_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteMatrixResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResult"]] + 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_route_matrix_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("matrix_id", matrix_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_route_matrix_initial.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + def begin_get_route_matrix( + self, + matrix_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteMatrixResult"] + """If the Matrix Route request was accepted successfully, the Location header in the response + contains the URL to download the results of the request. This status URI looks like the + following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + + #. Client issues a GET request on the download URL obtained in Step 3 to download the results + + Download Sync Results + ^^^^^^^^^^^^^^^^^^^^^ + + When you make a POST request for Route Matrix Sync API, the service returns 200 response code + for successful request and a response array. The response body will contain the data and there + will be no possibility to retrieve the results later. + + Download Async Results + ^^^^^^^^^^^^^^^^^^^^^^ + + When a request issues a ``202 Accepted`` response, the request is being processed using our + async pipeline. You will be given a URL to check the progress of your async request in the + location header of the response. This status URI looks like the following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + The URL provided by the location header will return the following responses when a ``GET`` + request is issued. + + .. + + HTTP ``202 Accepted`` - Matrix request was accepted but is still being processed. Please try + again in some time. + + HTTP ``200 OK`` - Matrix request successfully processed. The response body contains all of + the results. + + :param matrix_id: Matrix id received after the Matrix Route request was accepted successfully. + :type matrix_id: 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 RouteMatrixResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteMatrixResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResult"] + 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._get_route_matrix_initial( + matrix_id=matrix_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteMatrixResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("matrix_id", matrix_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_route_matrix.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + def request_route_matrix_sync( + self, + route_matrix_query, # type: "_models.RouteMatrixQuery" + format="json", # type: Union[str, "_models.JsonFormat"] + wait_for_results=None, # type: Optional[bool] + compute_travel_time=None, # type: Optional[Union[str, "_models.ComputeTravelTime"]] + filter_section_type=None, # type: Optional[Union[str, "_models.SectionType"]] + arrive_at=None, # type: Optional[datetime.datetime] + depart_at=None, # type: Optional[datetime.datetime] + vehicle_axle_weight=0, # type: Optional[int] + vehicle_length=0, # type: Optional[float] + vehicle_height=0, # type: Optional[float] + vehicle_width=0, # type: Optional[float] + vehicle_max_speed=0, # type: Optional[int] + vehicle_weight=0, # type: Optional[int] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + incline_level=None, # type: Optional[Union[str, "_models.InclineLevel"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + use_traffic_data=None, # type: Optional[bool] + route_type=None, # type: Optional[Union[str, "_models.RouteType"]] + vehicle_load_type=None, # type: Optional[Union[str, "_models.VehicleLoadType"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteMatrixResult" + """**Applies to**\ : S1 pricing tier. + + The Matrix Routing service allows calculation of a matrix of route summaries for a set of + routes defined by origin and destination locations by using an asynchronous (async) or + synchronous (sync) POST request. For every given origin, the service calculates the cost of + routing from that origin to every given destination. The set of origins and the set of + destinations can be thought of as the column and row headers of a table and each cell in the + table contains the costs of routing from the origin to the destination for that cell. As an + example, let's say a food delivery company has 20 drivers and they need to find the closest + driver to pick up the delivery from the restaurant. To solve this use case, they can call + Matrix Route API. + + For each route, the travel times and distances are returned. You can use the computed costs to + determine which detailed routes to calculate using the Route Directions API. + + The maximum size of a matrix for async request is **700** and for sync request it's **100** + (the number of origins multiplied by the number of destinations). + + Submit Synchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + If your scenario requires synchronous requests and the maximum size of the matrix is less than + or equal to 100, you might want to make synchronous request. The maximum size of a matrix for + this API is **100** (the number of origins multiplied by the number of destinations). With that + constraint in mind, examples of possible matrix dimensions are: 10x10, 6x8, 9x8 (it does not + need to be square). + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Route Matrix Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex routing + requests. When you make a request by using async request, by default the service returns a 202 + response code along a redirect URL in the Location field of the response header. This URL + should be checked periodically until the response data or error information is available. If + ``waitForResults`` parameter in the request is set to true, user will get a 200 response if the + request is finished under 120 seconds. + + The maximum size of a matrix for this API is **700** (the number of origins multiplied by the + number of destinations). With that constraint in mind, examples of possible matrix dimensions + are: 50x10, 10x10, 28x25. 10x70 (it does not need to be square). + + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + .. code-block:: + + POST + https://atlas.microsoft.com/route/matrix/json?api-version=1.0&subscription-key={subscription-key} + + Here's a typical sequence of asynchronous operations: + + + #. + Client sends a Route Matrix POST request to Azure Maps + + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Route Matrix request has been accepted. + + HTTP ``Error`` - There was an error processing your Route Matrix request. This could + either be a 400 Bad Request or any other Error status code. + + + + #. + If the Matrix Route request was accepted successfully, the Location header in the response + contains the URL to download the results of the request. This status URI looks like the + following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + + #. Client issues a GET request on the download URL obtained in Step 3 to download the results + + Download Sync Results + ^^^^^^^^^^^^^^^^^^^^^ + + When you make a POST request for Route Matrix Sync API, the service returns 200 response code + for successful request and a response array. The response body will contain the data and there + will be no possibility to retrieve the results later. + + Download Async Results + ^^^^^^^^^^^^^^^^^^^^^^ + + When a request issues a ``202 Accepted`` response, the request is being processed using our + async pipeline. You will be given a URL to check the progress of your async request in the + location header of the response. This status URI looks like the following: + + .. code-block:: + + GET + https://atlas.microsoft.com/route/matrix/{matrixId}?api-version=1.0?subscription-key={subscription-key} + + The URL provided by the location header will return the following responses when a ``GET`` + request is issued. + + .. + + HTTP ``202 Accepted`` - Matrix request was accepted but is still being processed. Please try + again in some time. + + HTTP ``200 OK`` - Matrix request successfully processed. The response body contains all of + the results. + + :param route_matrix_query: The matrix of origin and destination coordinates to compute the + route distance, travel time and other summary for each cell of the matrix based on the input + parameters. The minimum and the maximum cell count supported are 1 and **700** for async and + **100** for sync respectively. For example, it can be 35 origins and 20 destinations or 25 + origins and 25 destinations for async API. + :type route_matrix_query: ~azure.maps.route.models.RouteMatrixQuery + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :param wait_for_results: Boolean to indicate whether to execute the request synchronously. If + set to true, user will get a 200 response if the request is finished under 120 seconds. + Otherwise, user will get a 202 response right away. Please refer to the API description for + more details on 202 response. **Supported only for async request**. + :type wait_for_results: bool + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + :type vehicle_weight: int + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteMatrixResult, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteMatrixResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.request_route_matrix_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_matrix_query, 'RouteMatrixQuery') + 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('RouteMatrixResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + request_route_matrix_sync.metadata = {'url': '/route/matrix/sync/{format}'} # type: ignore + + def get_route_directions( + self, + route_points, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + max_alternatives=None, # type: Optional[int] + alternative_type=None, # type: Optional[Union[str, "_models.AlternativeRouteType"]] + min_deviation_distance=None, # type: Optional[int] + arrive_at=None, # type: Optional[datetime.datetime] + depart_at=None, # type: Optional[datetime.datetime] + min_deviation_time=None, # type: Optional[int] + instructions_type=None, # type: Optional[Union[str, "_models.RouteInstructionsType"]] + language=None, # type: Optional[str] + compute_best_waypoint_order=None, # type: Optional[bool] + route_representation_for_best_order=None, # type: Optional[Union[str, "_models.RouteRepresentationForBestOrder"]] + compute_travel_time=None, # type: Optional[Union[str, "_models.ComputeTravelTime"]] + vehicle_heading=None, # type: Optional[int] + report=None, # type: Optional[Union[str, "_models.Report"]] + filter_section_type=None, # type: Optional[Union[str, "_models.SectionType"]] + vehicle_axle_weight=0, # type: Optional[int] + vehicle_width=0, # type: Optional[float] + vehicle_height=0, # type: Optional[float] + vehicle_length=0, # type: Optional[float] + vehicle_max_speed=0, # type: Optional[int] + vehicle_weight=0, # type: Optional[int] + is_commercial_vehicle=False, # type: Optional[bool] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + incline_level=None, # type: Optional[Union[str, "_models.InclineLevel"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + use_traffic_data=None, # type: Optional[bool] + route_type=None, # type: Optional[Union[str, "_models.RouteType"]] + vehicle_load_type=None, # type: Optional[Union[str, "_models.VehicleLoadType"]] + vehicle_engine_type=None, # type: Optional[Union[str, "_models.VehicleEngineType"]] + constant_speed_consumption_in_liters_per_hundred_km=None, # type: Optional[str] + current_fuel_in_liters=None, # type: Optional[float] + auxiliary_power_in_liters_per_hour=None, # type: Optional[float] + fuel_energy_density_in_megajoules_per_liter=None, # type: Optional[float] + acceleration_efficiency=None, # type: Optional[float] + deceleration_efficiency=None, # type: Optional[float] + uphill_efficiency=None, # type: Optional[float] + downhill_efficiency=None, # type: Optional[float] + constant_speed_consumption_in_kw_h_per_hundred_km=None, # type: Optional[str] + current_charge_in_kw_h=None, # type: Optional[float] + max_charge_in_kw_h=None, # type: Optional[float] + auxiliary_power_in_kw=None, # type: Optional[float] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteDirections" + """**Applies to**\ : S0 and S1 pricing tiers. + + Returns a route between an origin and a destination, passing through waypoints if they are + specified. The route will take into account factors such as current traffic and the typical + road speeds on the requested day of the week and time of day. + + Information returned includes the distance, estimated travel time, and a representation of the + route geometry. Additional routing information such as optimized waypoint order or turn by turn + instructions is also available, depending on the options selected. + + Routing service provides a set of parameters for a detailed description of vehicle-specific + Consumption Model. Please check `Consumption Model + `_ for detailed explanation of + the concepts and parameters involved. + + :param route_points: The Coordinates through which the route is calculated, delimited by a + colon. A minimum of two coordinates is required. The first one is the origin and the last is + the destination of the route. Optional coordinates in-between act as WayPoints in the route. + You can pass up to 150 WayPoints. + :type route_points: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param max_alternatives: Number of desired alternative routes to be calculated. Default: 0, + minimum: 0 and maximum: 5. + :type max_alternatives: int + :param alternative_type: Controls the optimality, with respect to the given planning criteria, + of the calculated alternatives compared to the reference route. + :type alternative_type: str or ~azure.maps.route.models.AlternativeRouteType + :param min_deviation_distance: All alternative routes returned will follow the reference route + (see section POST Requests) from the origin point of the calculateRoute request for at least + this number of meters. Can only be used when reconstructing a route. The minDeviationDistance + parameter cannot be used in conjunction with arriveAt. + :type min_deviation_distance: int + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param min_deviation_time: All alternative routes returned will follow the reference route (see + section POST Requests) from the origin point of the calculateRoute request for at least this + number of seconds. Can only be used when reconstructing a route. The minDeviationTime parameter + cannot be used in conjunction with arriveAt. Default value is 0. Setting )minDeviationTime_ to + a value greater than zero has the following consequences: + + + * The origin point of the *calculateRoute* Request must be on + (or very near) the input reference route. + + * If this is not the case, an error is returned. + * However, the origin point does not need to be at the beginning + of the input reference route (it can be thought of as the current + vehicle position on the reference route). + + * The reference route, returned as the first route in the *calculateRoute* + Response, will start at the origin point specified in the *calculateRoute* + Request. The initial part of the input reference route up until the origin + point will be excluded from the Response. + * The values of *minDeviationDistance* and *minDeviationTime* determine + how far alternative routes will be guaranteed to follow the reference + route from the origin point onwards. + * The route must use *departAt*. + * The *vehicleHeading* is ignored. + :type min_deviation_time: int + :param instructions_type: If specified, guidance instructions will be returned. Note that the + instructionsType parameter cannot be used in conjunction with routeRepresentation=none. + :type instructions_type: str or ~azure.maps.route.models.RouteInstructionsType + :param language: The language parameter determines the language of the guidance messages. + Proper nouns (the names of streets, plazas, etc.) are returned in the specified language, or + if that is not available, they are returned in an available language that is close to it. + Allowed values are (a subset of) the IETF language tags. The currently supported languages are + listed in the `Supported languages section + `_. + + Default value: en-GB. + :type language: str + :param compute_best_waypoint_order: Re-order the route waypoints using a fast heuristic + algorithm to reduce the route length. Yields best results when used in conjunction with + routeType *shortest*. Notice that origin and destination are excluded from the optimized + waypoint indices. To include origin and destination in the response, please increase all the + indices by 1 to account for the origin, and then add the destination as the final index. + Possible values are true or false. True computes a better order if possible, but is not allowed + to be used in conjunction with maxAlternatives value greater than 0 or in conjunction with + circle waypoints. False will use the locations in the given order and not allowed to be used in + conjunction with routeRepresentation *none*. + :type compute_best_waypoint_order: bool + :param route_representation_for_best_order: Specifies the representation of the set of routes + provided as response. This parameter value can only be used in conjunction with + computeBestOrder=true. + :type route_representation_for_best_order: str or ~azure.maps.route.models.RouteRepresentationForBestOrder + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param vehicle_heading: The directional heading of the vehicle in degrees starting at true + North and continuing in clockwise direction. North is 0 degrees, east is 90 degrees, south is + 180 degrees, west is 270 degrees. Possible values 0-359. + :type vehicle_heading: int + :param report: Specifies which data should be reported for diagnosis purposes. The only + possible value is *effectiveSettings*. Reports the effective parameters or data used when + calling the API. In the case of defaulted parameters the default will be reflected where the + parameter was not specified by the caller. + :type report: str or ~azure.maps.route.models.Report + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + + + * + It is mandatory if any of the *Efficiency parameters are set. + + * + It must be strictly positive when used in the context of the Consumption Model. Weight + restrictions are considered. + + * + If no detailed **Consumption Model** is specified and the value of **vehicleWeight** is + non-zero, then weight restrictions are considered. + + * + In all other cases, this parameter is ignored. + + Sensible Values : for **Combustion Model** : 1600, for **Electric Model** : 1900. + :type vehicle_weight: int + :param is_commercial_vehicle: Whether the vehicle is used for commercial purposes. Commercial + vehicles may not be allowed to drive on some roads. + :type is_commercial_vehicle: bool + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :param vehicle_engine_type: Engine type of the vehicle. When a detailed Consumption Model is + specified, it must be consistent with the value of **vehicleEngineType**. + :type vehicle_engine_type: str or ~azure.maps.route.models.VehicleEngineType + :param constant_speed_consumption_in_liters_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of colon-delimited speed & consumption-rate pairs. The list + defines points on a consumption curve. Consumption rates for speeds not in the list are found + as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in l/100km) is between 0.01 and 100000.0. + + Sensible Values : 50,6.3:130,11.5 + + **Note** : This parameter is required for **The Combustion Consumption Model**. + :type constant_speed_consumption_in_liters_per_hundred_km: str + :param current_fuel_in_liters: Specifies the current supply of fuel in liters. + + Sensible Values : 55. + :type current_fuel_in_liters: float + :param auxiliary_power_in_liters_per_hour: Specifies the amount of fuel consumed for sustaining + auxiliary systems of the vehicle, in liters per hour. + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 0.2. + :type auxiliary_power_in_liters_per_hour: float + :param fuel_energy_density_in_megajoules_per_liter: Specifies the amount of chemical energy + stored in one liter of fuel in megajoules (MJ). It is used in conjunction with the + ***Efficiency** parameters for conversions between saved or consumed energy and fuel. For + example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel. + + This parameter is required if any ***Efficiency** parameter is set. + + Sensible Values : 34.2. + :type fuel_energy_density_in_megajoules_per_liter: float + :param acceleration_efficiency: Specifies the efficiency of converting chemical energy stored + in fuel to kinetic energy when the vehicle accelerates *(i.e. + KineticEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by converting + consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **decelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **decelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.33, for **Electric Model** : 0.66. + :type acceleration_efficiency: float + :param deceleration_efficiency: Specifies the efficiency of converting kinetic energy to saved + (not consumed) fuel when the vehicle decelerates *(i.e. ChemicalEnergySaved/KineticEnergyLost). + ChemicalEnergySaved* is obtained by converting saved (not consumed) fuel to energy using + **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **accelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **accelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.83, for **Electric Model** : 0.91. + :type deceleration_efficiency: float + :param uphill_efficiency: Specifies the efficiency of converting chemical energy stored in fuel + to potential energy when the vehicle gains elevation *(i.e. + PotentialEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by + converting consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **downhillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **downhillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.27, for **Electric Model** : 0.74. + :type uphill_efficiency: float + :param downhill_efficiency: Specifies the efficiency of converting potential energy to saved + (not consumed) fuel when the vehicle loses elevation *(i.e. + ChemicalEnergySaved/PotentialEnergyLost). ChemicalEnergySaved* is obtained by converting saved + (not consumed) fuel to energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **uphillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **uphillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.51, for **Electric Model** : 0.73. + :type downhill_efficiency: float + :param constant_speed_consumption_in_kw_h_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a + consumption curve. Consumption rates for speeds not in the list are found as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in kWh/100km) is between 0.01 and + 100000.0. + + Sensible Values : 50,8.2:130,21.3 + + This parameter is required for **Electric consumption model**. + :type constant_speed_consumption_in_kw_h_per_hundred_km: str + :param current_charge_in_kw_h: Specifies the current electric energy supply in kilowatt hours + (kWh). + + This parameter co-exists with **maxChargeInkWh** parameter. + + The range of values allowed are 0.0 to **maxChargeInkWh**. + + Sensible Values : 43. + :type current_charge_in_kw_h: float + :param max_charge_in_kw_h: Specifies the maximum electric energy supply in kilowatt hours (kWh) + that may be stored in the vehicle's battery. + + This parameter co-exists with **currentChargeInkWh** parameter. + + Minimum value has to be greater than or equal to **currentChargeInkWh**. + + Sensible Values : 85. + :type max_charge_in_kw_h: float + :param auxiliary_power_in_kw: Specifies the amount of power consumed for sustaining auxiliary + systems, in kilowatts (kW). + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 1.7. + :type auxiliary_power_in_kw: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirections, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirections + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirections"] + 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_route_directions.metadata['url'] # type: ignore + path_format_arguments = { + '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("route_points", route_points, 'str') + if max_alternatives is not None: + query_parameters['maxAlternatives'] = self._serialize.query("max_alternatives", max_alternatives, 'int', maximum=5, minimum=0) + if alternative_type is not None: + query_parameters['alternativeType'] = self._serialize.query("alternative_type", alternative_type, 'str') + if min_deviation_distance is not None: + query_parameters['minDeviationDistance'] = self._serialize.query("min_deviation_distance", min_deviation_distance, 'int') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if min_deviation_time is not None: + query_parameters['minDeviationTime'] = self._serialize.query("min_deviation_time", min_deviation_time, 'int') + if instructions_type is not None: + query_parameters['instructionsType'] = self._serialize.query("instructions_type", instructions_type, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if compute_best_waypoint_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_waypoint_order", compute_best_waypoint_order, 'bool') + if route_representation_for_best_order is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation_for_best_order", route_representation_for_best_order, 'str') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if vehicle_heading is not None: + query_parameters['vehicleHeading'] = self._serialize.query("vehicle_heading", vehicle_heading, 'int', maximum=359, minimum=0) + if report is not None: + query_parameters['report'] = self._serialize.query("report", report, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if is_commercial_vehicle is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("is_commercial_vehicle", is_commercial_vehicle, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + if vehicle_engine_type is not None: + query_parameters['vehicleEngineType'] = self._serialize.query("vehicle_engine_type", vehicle_engine_type, 'str') + if constant_speed_consumption_in_liters_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundred_km", constant_speed_consumption_in_liters_per_hundred_km, 'str') + if current_fuel_in_liters is not None: + query_parameters['currentFuelInLiters'] = self._serialize.query("current_fuel_in_liters", current_fuel_in_liters, 'float') + if auxiliary_power_in_liters_per_hour is not None: + query_parameters['auxiliaryPowerInLitersPerHour'] = self._serialize.query("auxiliary_power_in_liters_per_hour", auxiliary_power_in_liters_per_hour, 'float') + if fuel_energy_density_in_megajoules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_megajoules_per_liter", fuel_energy_density_in_megajoules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float', maximum=1, minimum=0) + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float', maximum=1, minimum=0) + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float', maximum=1, minimum=0) + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float', maximum=1, minimum=0) + if constant_speed_consumption_in_kw_h_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_kw_h_per_hundred_km", constant_speed_consumption_in_kw_h_per_hundred_km, 'str') + if current_charge_in_kw_h is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_in_kw_h", current_charge_in_kw_h, 'float') + if max_charge_in_kw_h is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_in_kw_h", max_charge_in_kw_h, 'float') + if auxiliary_power_in_kw is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_in_kw", auxiliary_power_in_kw, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('RouteDirections', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_directions.metadata = {'url': '/route/directions/{format}'} # type: ignore + + def get_route_directions_with_additional_parameters( + self, + route_points, # type: str + route_direction_parameters, # type: "_models.RouteDirectionParameters" + format="json", # type: Union[str, "_models.ResponseFormat"] + max_alternatives=None, # type: Optional[int] + alternative_type=None, # type: Optional[Union[str, "_models.AlternativeRouteType"]] + min_deviation_distance=None, # type: Optional[int] + min_deviation_time=None, # type: Optional[int] + instructions_type=None, # type: Optional[Union[str, "_models.RouteInstructionsType"]] + language=None, # type: Optional[str] + compute_best_waypoint_order=None, # type: Optional[bool] + route_representation_for_best_order=None, # type: Optional[Union[str, "_models.RouteRepresentationForBestOrder"]] + compute_travel_time=None, # type: Optional[Union[str, "_models.ComputeTravelTime"]] + vehicle_heading=None, # type: Optional[int] + report=None, # type: Optional[Union[str, "_models.Report"]] + filter_section_type=None, # type: Optional[Union[str, "_models.SectionType"]] + arrive_at=None, # type: Optional[datetime.datetime] + depart_at=None, # type: Optional[datetime.datetime] + vehicle_axle_weight=0, # type: Optional[int] + vehicle_length=0, # type: Optional[float] + vehicle_height=0, # type: Optional[float] + vehicle_width=0, # type: Optional[float] + vehicle_max_speed=0, # type: Optional[int] + vehicle_weight=0, # type: Optional[int] + is_commercial_vehicle=False, # type: Optional[bool] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + incline_level=None, # type: Optional[Union[str, "_models.InclineLevel"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + use_traffic_data=None, # type: Optional[bool] + route_type=None, # type: Optional[Union[str, "_models.RouteType"]] + vehicle_load_type=None, # type: Optional[Union[str, "_models.VehicleLoadType"]] + vehicle_engine_type=None, # type: Optional[Union[str, "_models.VehicleEngineType"]] + constant_speed_consumption_in_liters_per_hundred_km=None, # type: Optional[str] + current_fuel_in_liters=None, # type: Optional[float] + auxiliary_power_in_liters_per_hour=None, # type: Optional[float] + fuel_energy_density_in_megajoules_per_liter=None, # type: Optional[float] + acceleration_efficiency=None, # type: Optional[float] + deceleration_efficiency=None, # type: Optional[float] + uphill_efficiency=None, # type: Optional[float] + downhill_efficiency=None, # type: Optional[float] + constant_speed_consumption_in_kw_h_per_hundred_km=None, # type: Optional[str] + current_charge_in_kw_h=None, # type: Optional[float] + max_charge_in_kw_h=None, # type: Optional[float] + auxiliary_power_in_kw=None, # type: Optional[float] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteDirections" + """**Applies to**\ : S0 and S1 pricing tiers. + + Returns a route between an origin and a destination, passing through waypoints if they are + specified. The route will take into account factors such as current traffic and the typical + road speeds on the requested day of the week and time of day. + + Information returned includes the distance, estimated travel time, and a representation of the + route geometry. Additional routing information such as optimized waypoint order or turn by turn + instructions is also available, depending on the options selected. + + Routing service provides a set of parameters for a detailed description of a vehicle-specific + Consumption Model. Please check `Consumption Model + `_ for detailed explanation of + the concepts and parameters involved. + + :param route_points: The Coordinates through which the route is calculated, delimited by a + colon. A minimum of two coordinates is required. The first one is the origin and the last is + the destination of the route. Optional coordinates in-between act as WayPoints in the route. + You can pass up to 150 WayPoints. + :type route_points: str + :param route_direction_parameters: Used for reconstructing a route and for calculating zero or + more alternative routes to this reference route. The provided sequence of coordinates is used + as input for route reconstruction. The alternative routes are calculated between the origin + and destination points specified in the base path parameter locations. If both + minDeviationDistance and minDeviationTime are set to zero, then these origin and destination + points are expected to be at (or very near) the beginning and end of the reference route, + respectively. Intermediate locations (waypoints) are not supported when using + supportingPoints. + + Setting at least one of minDeviationDistance or minDeviationTime to a value greater than zero + has the following consequences: + + + * The origin point of the calculateRoute request must be on (or very near) the input reference + route. If this is not the case, an error is returned. However, the origin point does not need + to be at the beginning of the input reference route (it can be thought of as the current + vehicle position on the reference route). + * The reference route, returned as the first route in the calculateRoute response, will start + at the origin point specified in the calculateRoute request. The initial part of the input + reference route up until the origin point will be excluded from the response. + * The values of minDeviationDistance and minDeviationTime determine how far alternative routes + will be guaranteed to follow the reference route from the origin point onwards. + * The route must use departAt. + * The vehicleHeading is ignored. + :type route_direction_parameters: ~azure.maps.route.models.RouteDirectionParameters + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param max_alternatives: Number of desired alternative routes to be calculated. Default: 0, + minimum: 0 and maximum: 5. + :type max_alternatives: int + :param alternative_type: Controls the optimality, with respect to the given planning criteria, + of the calculated alternatives compared to the reference route. + :type alternative_type: str or ~azure.maps.route.models.AlternativeRouteType + :param min_deviation_distance: All alternative routes returned will follow the reference route + (see section POST Requests) from the origin point of the calculateRoute request for at least + this number of meters. Can only be used when reconstructing a route. The minDeviationDistance + parameter cannot be used in conjunction with arriveAt. + :type min_deviation_distance: int + :param min_deviation_time: All alternative routes returned will follow the reference route (see + section POST Requests) from the origin point of the calculateRoute request for at least this + number of seconds. Can only be used when reconstructing a route. The minDeviationTime parameter + cannot be used in conjunction with arriveAt. Default value is 0. Setting )minDeviationTime_ to + a value greater than zero has the following consequences: + + + * The origin point of the *calculateRoute* Request must be on + (or very near) the input reference route. + + * If this is not the case, an error is returned. + * However, the origin point does not need to be at the beginning + of the input reference route (it can be thought of as the current + vehicle position on the reference route). + + * The reference route, returned as the first route in the *calculateRoute* + Response, will start at the origin point specified in the *calculateRoute* + Request. The initial part of the input reference route up until the origin + point will be excluded from the Response. + * The values of *minDeviationDistance* and *minDeviationTime* determine + how far alternative routes will be guaranteed to follow the reference + route from the origin point onwards. + * The route must use *departAt*. + * The *vehicleHeading* is ignored. + :type min_deviation_time: int + :param instructions_type: If specified, guidance instructions will be returned. Note that the + instructionsType parameter cannot be used in conjunction with routeRepresentation=none. + :type instructions_type: str or ~azure.maps.route.models.RouteInstructionsType + :param language: The language parameter determines the language of the guidance messages. It + does not affect proper nouns (the names of streets, plazas, etc.) It has no effect when + instructionsType=coded. Allowed values are (a subset of) the IETF language tags described. + :type language: str + :param compute_best_waypoint_order: Re-order the route waypoints using a fast heuristic + algorithm to reduce the route length. Yields best results when used in conjunction with + routeType *shortest*. Notice that origin and destination are excluded from the optimized + waypoint indices. To include origin and destination in the response, please increase all the + indices by 1 to account for the origin, and then add the destination as the final index. + Possible values are true or false. True computes a better order if possible, but is not allowed + to be used in conjunction with maxAlternatives value greater than 0 or in conjunction with + circle waypoints. False will use the locations in the given order and not allowed to be used in + conjunction with routeRepresentation *none*. + :type compute_best_waypoint_order: bool + :param route_representation_for_best_order: Specifies the representation of the set of routes + provided as response. This parameter value can only be used in conjunction with + computeBestOrder=true. + :type route_representation_for_best_order: str or ~azure.maps.route.models.RouteRepresentationForBestOrder + :param compute_travel_time: Specifies whether to return additional travel times using different + types of traffic information (none, historic, live) as well as the default best-estimate travel + time. + :type compute_travel_time: str or ~azure.maps.route.models.ComputeTravelTime + :param vehicle_heading: The directional heading of the vehicle in degrees starting at true + North and continuing in clockwise direction. North is 0 degrees, east is 90 degrees, south is + 180 degrees, west is 270 degrees. Possible values 0-359. + :type vehicle_heading: int + :param report: Specifies which data should be reported for diagnosis purposes. The only + possible value is *effectiveSettings*. Reports the effective parameters or data used when + calling the API. In the case of defaulted parameters the default will be reflected where the + parameter was not specified by the caller. + :type report: str or ~azure.maps.route.models.Report + :param filter_section_type: Specifies which of the section types is reported in the route + response. :code:`
`:code:`
`For example if sectionType = pedestrian the sections which + are suited for pedestrians only are returned. Multiple types can be used. The default + sectionType refers to the travelMode input. By default travelMode is set to car. + :type filter_section_type: str or ~azure.maps.route.models.SectionType + :param arrive_at: The date and time of arrival at the destination point. It must be specified + as a dateTime. When a time zone offset is not specified it will be assumed to be that of the + destination point. The arriveAt value must be in the future. The arriveAt parameter cannot be + used in conjunction with departAt, minDeviationDistance or minDeviationTime. + :type arrive_at: ~datetime.datetime + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + + + * + It is mandatory if any of the *Efficiency parameters are set. + + * + It must be strictly positive when used in the context of the Consumption Model. Weight + restrictions are considered. + + * + If no detailed **Consumption Model** is specified and the value of **vehicleWeight** is + non-zero, then weight restrictions are considered. + + * + In all other cases, this parameter is ignored. + + Sensible Values : for **Combustion Model** : 1600, for **Electric Model** : 1900. + :type vehicle_weight: int + :param is_commercial_vehicle: Whether the vehicle is used for commercial purposes. Commercial + vehicles may not be allowed to drive on some roads. + :type is_commercial_vehicle: bool + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :param vehicle_engine_type: Engine type of the vehicle. When a detailed Consumption Model is + specified, it must be consistent with the value of **vehicleEngineType**. + :type vehicle_engine_type: str or ~azure.maps.route.models.VehicleEngineType + :param constant_speed_consumption_in_liters_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of colon-delimited speed & consumption-rate pairs. The list + defines points on a consumption curve. Consumption rates for speeds not in the list are found + as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in l/100km) is between 0.01 and 100000.0. + + Sensible Values : 50,6.3:130,11.5 + + **Note** : This parameter is required for **The Combustion Consumption Model**. + :type constant_speed_consumption_in_liters_per_hundred_km: str + :param current_fuel_in_liters: Specifies the current supply of fuel in liters. + + Sensible Values : 55. + :type current_fuel_in_liters: float + :param auxiliary_power_in_liters_per_hour: Specifies the amount of fuel consumed for sustaining + auxiliary systems of the vehicle, in liters per hour. + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 0.2. + :type auxiliary_power_in_liters_per_hour: float + :param fuel_energy_density_in_megajoules_per_liter: Specifies the amount of chemical energy + stored in one liter of fuel in megajoules (MJ). It is used in conjunction with the + ***Efficiency** parameters for conversions between saved or consumed energy and fuel. For + example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel. + + This parameter is required if any ***Efficiency** parameter is set. + + Sensible Values : 34.2. + :type fuel_energy_density_in_megajoules_per_liter: float + :param acceleration_efficiency: Specifies the efficiency of converting chemical energy stored + in fuel to kinetic energy when the vehicle accelerates *(i.e. + KineticEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by converting + consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **decelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **decelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.33, for **Electric Model** : 0.66. + :type acceleration_efficiency: float + :param deceleration_efficiency: Specifies the efficiency of converting kinetic energy to saved + (not consumed) fuel when the vehicle decelerates *(i.e. ChemicalEnergySaved/KineticEnergyLost). + ChemicalEnergySaved* is obtained by converting saved (not consumed) fuel to energy using + **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **accelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **accelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.83, for **Electric Model** : 0.91. + :type deceleration_efficiency: float + :param uphill_efficiency: Specifies the efficiency of converting chemical energy stored in fuel + to potential energy when the vehicle gains elevation *(i.e. + PotentialEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by + converting consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **downhillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **downhillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.27, for **Electric Model** : 0.74. + :type uphill_efficiency: float + :param downhill_efficiency: Specifies the efficiency of converting potential energy to saved + (not consumed) fuel when the vehicle loses elevation *(i.e. + ChemicalEnergySaved/PotentialEnergyLost). ChemicalEnergySaved* is obtained by converting saved + (not consumed) fuel to energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **uphillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **uphillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.51, for **Electric Model** : 0.73. + :type downhill_efficiency: float + :param constant_speed_consumption_in_kw_h_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a + consumption curve. Consumption rates for speeds not in the list are found as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in kWh/100km) is between 0.01 and + 100000.0. + + Sensible Values : 50,8.2:130,21.3 + + This parameter is required for **Electric consumption model**. + :type constant_speed_consumption_in_kw_h_per_hundred_km: str + :param current_charge_in_kw_h: Specifies the current electric energy supply in kilowatt hours + (kWh). + + This parameter co-exists with **maxChargeInkWh** parameter. + + The range of values allowed are 0.0 to **maxChargeInkWh**. + + Sensible Values : 43. + :type current_charge_in_kw_h: float + :param max_charge_in_kw_h: Specifies the maximum electric energy supply in kilowatt hours (kWh) + that may be stored in the vehicle's battery. + + This parameter co-exists with **currentChargeInkWh** parameter. + + Minimum value has to be greater than or equal to **currentChargeInkWh**. + + Sensible Values : 85. + :type max_charge_in_kw_h: float + :param auxiliary_power_in_kw: Specifies the amount of power consumed for sustaining auxiliary + systems, in kilowatts (kW). + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 1.7. + :type auxiliary_power_in_kw: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirections, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirections + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirections"] + 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.get_route_directions_with_additional_parameters.metadata['url'] # type: ignore + path_format_arguments = { + '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("route_points", route_points, 'str') + if max_alternatives is not None: + query_parameters['maxAlternatives'] = self._serialize.query("max_alternatives", max_alternatives, 'int', maximum=5, minimum=0) + if alternative_type is not None: + query_parameters['alternativeType'] = self._serialize.query("alternative_type", alternative_type, 'str') + if min_deviation_distance is not None: + query_parameters['minDeviationDistance'] = self._serialize.query("min_deviation_distance", min_deviation_distance, 'int') + if min_deviation_time is not None: + query_parameters['minDeviationTime'] = self._serialize.query("min_deviation_time", min_deviation_time, 'int') + if instructions_type is not None: + query_parameters['instructionsType'] = self._serialize.query("instructions_type", instructions_type, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if compute_best_waypoint_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_waypoint_order", compute_best_waypoint_order, 'bool') + if route_representation_for_best_order is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation_for_best_order", route_representation_for_best_order, 'str') + if compute_travel_time is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time", compute_travel_time, 'str') + if vehicle_heading is not None: + query_parameters['vehicleHeading'] = self._serialize.query("vehicle_heading", vehicle_heading, 'int', maximum=359, minimum=0) + if report is not None: + query_parameters['report'] = self._serialize.query("report", report, 'str') + if filter_section_type is not None: + query_parameters['sectionType'] = self._serialize.query("filter_section_type", filter_section_type, 'str') + if arrive_at is not None: + query_parameters['arriveAt'] = self._serialize.query("arrive_at", arrive_at, 'iso-8601') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if is_commercial_vehicle is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("is_commercial_vehicle", is_commercial_vehicle, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + if vehicle_engine_type is not None: + query_parameters['vehicleEngineType'] = self._serialize.query("vehicle_engine_type", vehicle_engine_type, 'str') + if constant_speed_consumption_in_liters_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundred_km", constant_speed_consumption_in_liters_per_hundred_km, 'str') + if current_fuel_in_liters is not None: + query_parameters['currentFuelInLiters'] = self._serialize.query("current_fuel_in_liters", current_fuel_in_liters, 'float') + if auxiliary_power_in_liters_per_hour is not None: + query_parameters['auxiliaryPowerInLitersPerHour'] = self._serialize.query("auxiliary_power_in_liters_per_hour", auxiliary_power_in_liters_per_hour, 'float') + if fuel_energy_density_in_megajoules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_megajoules_per_liter", fuel_energy_density_in_megajoules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float', maximum=1, minimum=0) + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float', maximum=1, minimum=0) + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float', maximum=1, minimum=0) + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float', maximum=1, minimum=0) + if constant_speed_consumption_in_kw_h_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_kw_h_per_hundred_km", constant_speed_consumption_in_kw_h_per_hundred_km, 'str') + if current_charge_in_kw_h is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_in_kw_h", current_charge_in_kw_h, 'float') + if max_charge_in_kw_h is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_in_kw_h", max_charge_in_kw_h, 'float') + if auxiliary_power_in_kw is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_in_kw", auxiliary_power_in_kw, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_direction_parameters, 'RouteDirectionParameters') + 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('RouteDirections', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_directions_with_additional_parameters.metadata = {'url': '/route/directions/{format}'} # type: ignore + + def get_route_range( + self, + query, # type: List[float] + format="json", # type: Union[str, "_models.ResponseFormat"] + fuel_budget_in_liters=None, # type: Optional[float] + energy_budget_in_kw_h=None, # type: Optional[float] + time_budget_in_sec=None, # type: Optional[float] + distance_budget_in_meters=None, # type: Optional[float] + depart_at=None, # type: Optional[datetime.datetime] + route_type=None, # type: Optional[Union[str, "_models.RouteType"]] + use_traffic_data=None, # type: Optional[bool] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + incline_level=None, # type: Optional[Union[str, "_models.InclineLevel"]] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + vehicle_axle_weight=0, # type: Optional[int] + vehicle_width=0, # type: Optional[float] + vehicle_height=0, # type: Optional[float] + vehicle_length=0, # type: Optional[float] + vehicle_max_speed=0, # type: Optional[int] + vehicle_weight=0, # type: Optional[int] + is_commercial_vehicle=False, # type: Optional[bool] + vehicle_load_type=None, # type: Optional[Union[str, "_models.VehicleLoadType"]] + vehicle_engine_type=None, # type: Optional[Union[str, "_models.VehicleEngineType"]] + constant_speed_consumption_in_liters_per_hundred_km=None, # type: Optional[str] + current_fuel_in_liters=None, # type: Optional[float] + auxiliary_power_in_liters_per_hour=None, # type: Optional[float] + fuel_energy_density_in_megajoules_per_liter=None, # type: Optional[float] + acceleration_efficiency=None, # type: Optional[float] + deceleration_efficiency=None, # type: Optional[float] + uphill_efficiency=None, # type: Optional[float] + downhill_efficiency=None, # type: Optional[float] + constant_speed_consumption_in_kw_h_per_hundred_km=None, # type: Optional[str] + current_charge_in_kw_h=None, # type: Optional[float] + max_charge_in_kw_h=None, # type: Optional[float] + auxiliary_power_in_kw=None, # type: Optional[float] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteRangeResult" + """**Route Range (Isochrone) API** + + **Applies to**\ : S1 pricing tier. + + This service will calculate a set of locations that can be reached from the origin point based + on fuel, energy, time or distance budget that is specified. A polygon boundary (or Isochrone) + is returned in a counterclockwise orientation as well as the precise polygon center which was + the result of the origin point. + + The returned polygon can be used for further processing such as `Search Inside Geometry + `_ to search for + POIs within the provided Isochrone. + + :param query: The Coordinate from which the range calculation should start. + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param fuel_budget_in_liters: Fuel budget in liters that determines maximal range which can be + travelled using the specified Combustion Consumption Model.:code:`
` When fuelBudgetInLiters + is used, it is mandatory to specify a detailed Combustion Consumption Model.:code:`
` + Exactly one budget (fuelBudgetInLiters, energyBudgetInkWh, timeBudgetInSec, or + distanceBudgetInMeters) must be used. + :type fuel_budget_in_liters: float + :param energy_budget_in_kw_h: Electric energy budget in kilowatt hours (kWh) that determines + maximal range which can be travelled using the specified Electric Consumption + Model.:code:`
` When energyBudgetInkWh is used, it is mandatory to specify a detailed + Electric Consumption Model.:code:`
` Exactly one budget (fuelBudgetInLiters, + energyBudgetInkWh, timeBudgetInSec, or distanceBudgetInMeters) must be used. + :type energy_budget_in_kw_h: float + :param time_budget_in_sec: Time budget in seconds that determines maximal range which can be + travelled using driving time. The Consumption Model will only affect the range when routeType + is eco.:code:`
` Exactly one budget (fuelBudgetInLiters, energyBudgetInkWh, timeBudgetInSec, + or distanceBudgetInMeters) must be used. + :type time_budget_in_sec: float + :param distance_budget_in_meters: Distance budget in meters that determines maximal range which + can be travelled using driving distance. The Consumption Model will only affect the range when + routeType is eco.:code:`
` Exactly one budget (fuelBudgetInLiters, energyBudgetInkWh, + timeBudgetInSec, or distanceBudgetInMeters) must be used. + :type distance_budget_in_meters: float + :param depart_at: The date and time of departure from the origin point. Departure times apart + from now must be specified as a dateTime. When a time zone offset is not specified, it will be + assumed to be that of the origin point. The departAt value must be in the future in the + date-time format (1996-12-19T16:39:57-08:00). + :type depart_at: ~datetime.datetime + :param route_type: The type of route requested. + :type route_type: str or ~azure.maps.route.models.RouteType + :param use_traffic_data: Possible values: + + + * true - Do consider all available traffic information during routing + * false - Ignore current traffic data during routing. Note that although the current traffic + data is ignored + during routing, the effect of historic traffic on effective road speeds is still + incorporated. + :type use_traffic_data: bool + :param avoid: Specifies something that the route calculation should try to avoid when + determining the route. Can be specified multiple times in one request, for example, + '&avoid=motorways&avoid=tollRoads&avoid=ferries'. In calculateReachableRange requests, the + value alreadyUsedRoads must not be used. + :type avoid: list[str or ~azure.maps.route.models.RouteAvoidType] + :param travel_mode: The mode of travel for the requested route. If not defined, default is + 'car'. Note that the requested travelMode may not be available for the entire route. Where the + requested travelMode is not available for a particular section, the travelMode element of the + response for that section will be "other". Note that travel modes bus, motorcycle, taxi and van + are BETA functionality. Full restriction data is not available in all areas. In + **calculateReachableRange** requests, the values bicycle and pedestrian must not be used. + :type travel_mode: str or ~azure.maps.route.models.TravelMode + :param incline_level: Degree of hilliness for thrilling route. This parameter can only be used + in conjunction with ``routeType``\ =thrilling. + :type incline_level: str or ~azure.maps.route.models.InclineLevel + :param windingness: Level of turns for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type windingness: str or ~azure.maps.route.models.WindingnessLevel + :param vehicle_axle_weight: Weight per axle of the vehicle in kg. A value of 0 means that + weight restrictions per axle are not considered. + :type vehicle_axle_weight: int + :param vehicle_width: Width of the vehicle in meters. A value of 0 means that width + restrictions are not considered. + :type vehicle_width: float + :param vehicle_height: Height of the vehicle in meters. A value of 0 means that height + restrictions are not considered. + :type vehicle_height: float + :param vehicle_length: Length of the vehicle in meters. A value of 0 means that length + restrictions are not considered. + :type vehicle_length: float + :param vehicle_max_speed: Maximum speed of the vehicle in km/hour. The max speed in the vehicle + profile is used to check whether a vehicle is allowed on motorways. + + + * + A value of 0 means that an appropriate value for the vehicle will be determined and applied + during route planning. + + * + A non-zero value may be overridden during route planning. For example, the current traffic + flow is 60 km/hour. If the vehicle maximum speed is set to 50 km/hour, the routing engine will + consider 60 km/hour as this is the current situation. If the maximum speed of the vehicle is + provided as 80 km/hour but the current traffic flow is 60 km/hour, then routing engine will + again use 60 km/hour. + :type vehicle_max_speed: int + :param vehicle_weight: Weight of the vehicle in kilograms. + + + * + It is mandatory if any of the *Efficiency parameters are set. + + * + It must be strictly positive when used in the context of the Consumption Model. Weight + restrictions are considered. + + * + If no detailed **Consumption Model** is specified and the value of **vehicleWeight** is + non-zero, then weight restrictions are considered. + + * + In all other cases, this parameter is ignored. + + Sensible Values : for **Combustion Model** : 1600, for **Electric Model** : 1900. + :type vehicle_weight: int + :param is_commercial_vehicle: Whether the vehicle is used for commercial purposes. Commercial + vehicles may not be allowed to drive on some roads. + :type is_commercial_vehicle: bool + :param vehicle_load_type: Types of cargo that may be classified as hazardous materials and + restricted from some roads. Available vehicleLoadType values are US Hazmat classes 1 through 9, + plus generic classifications for use in other countries. Values beginning with USHazmat are for + US routing while otherHazmat should be used for all other countries. vehicleLoadType can be + specified multiple times. This parameter is currently only considered for travelMode=truck. + :type vehicle_load_type: str or ~azure.maps.route.models.VehicleLoadType + :param vehicle_engine_type: Engine type of the vehicle. When a detailed Consumption Model is + specified, it must be consistent with the value of **vehicleEngineType**. + :type vehicle_engine_type: str or ~azure.maps.route.models.VehicleEngineType + :param constant_speed_consumption_in_liters_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of colon-delimited speed & consumption-rate pairs. The list + defines points on a consumption curve. Consumption rates for speeds not in the list are found + as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in l/100km) is between 0.01 and 100000.0. + + Sensible Values : 50,6.3:130,11.5 + + **Note** : This parameter is required for **The Combustion Consumption Model**. + :type constant_speed_consumption_in_liters_per_hundred_km: str + :param current_fuel_in_liters: Specifies the current supply of fuel in liters. + + Sensible Values : 55. + :type current_fuel_in_liters: float + :param auxiliary_power_in_liters_per_hour: Specifies the amount of fuel consumed for sustaining + auxiliary systems of the vehicle, in liters per hour. + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 0.2. + :type auxiliary_power_in_liters_per_hour: float + :param fuel_energy_density_in_megajoules_per_liter: Specifies the amount of chemical energy + stored in one liter of fuel in megajoules (MJ). It is used in conjunction with the + ***Efficiency** parameters for conversions between saved or consumed energy and fuel. For + example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel. + + This parameter is required if any ***Efficiency** parameter is set. + + Sensible Values : 34.2. + :type fuel_energy_density_in_megajoules_per_liter: float + :param acceleration_efficiency: Specifies the efficiency of converting chemical energy stored + in fuel to kinetic energy when the vehicle accelerates *(i.e. + KineticEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by converting + consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **decelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **decelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.33, for **Electric Model** : 0.66. + :type acceleration_efficiency: float + :param deceleration_efficiency: Specifies the efficiency of converting kinetic energy to saved + (not consumed) fuel when the vehicle decelerates *(i.e. ChemicalEnergySaved/KineticEnergyLost). + ChemicalEnergySaved* is obtained by converting saved (not consumed) fuel to energy using + **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **accelerationEfficiency**. + + The range of values allowed are 0.0 to 1/\ **accelerationEfficiency**. + + Sensible Values : for **Combustion Model** : 0.83, for **Electric Model** : 0.91. + :type deceleration_efficiency: float + :param uphill_efficiency: Specifies the efficiency of converting chemical energy stored in fuel + to potential energy when the vehicle gains elevation *(i.e. + PotentialEnergyGained/ChemicalEnergyConsumed). ChemicalEnergyConsumed* is obtained by + converting consumed fuel to chemical energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **downhillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **downhillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.27, for **Electric Model** : 0.74. + :type uphill_efficiency: float + :param downhill_efficiency: Specifies the efficiency of converting potential energy to saved + (not consumed) fuel when the vehicle loses elevation *(i.e. + ChemicalEnergySaved/PotentialEnergyLost). ChemicalEnergySaved* is obtained by converting saved + (not consumed) fuel to energy using **fuelEnergyDensityInMJoulesPerLiter**. + + Must be paired with **uphillEfficiency**. + + The range of values allowed are 0.0 to 1/\ **uphillEfficiency**. + + Sensible Values : for **Combustion Model** : 0.51, for **Electric Model** : 0.73. + :type downhill_efficiency: float + :param constant_speed_consumption_in_kw_h_per_hundred_km: Specifies the speed-dependent + component of consumption. + + Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a + consumption curve. Consumption rates for speeds not in the list are found as follows: + + + * + by linear interpolation, if the given speed lies in between two speeds in the list + + * + by linear extrapolation otherwise, assuming a constant (ΔConsumption/ΔSpeed) determined by + the nearest two points in the list + + The list must contain between 1 and 25 points (inclusive), and may not contain duplicate + points for the same speed. If it only contains a single point, then the consumption rate of + that point is used without further processing. + + Consumption specified for the largest speed must be greater than or equal to that of the + penultimate largest speed. This ensures that extrapolation does not lead to negative + consumption rates. + + Similarly, consumption values specified for the two smallest speeds in the list cannot lead to + a negative consumption rate for any smaller speed. + + The valid range for the consumption values(expressed in kWh/100km) is between 0.01 and + 100000.0. + + Sensible Values : 50,8.2:130,21.3 + + This parameter is required for **Electric consumption model**. + :type constant_speed_consumption_in_kw_h_per_hundred_km: str + :param current_charge_in_kw_h: Specifies the current electric energy supply in kilowatt hours + (kWh). + + This parameter co-exists with **maxChargeInkWh** parameter. + + The range of values allowed are 0.0 to **maxChargeInkWh**. + + Sensible Values : 43. + :type current_charge_in_kw_h: float + :param max_charge_in_kw_h: Specifies the maximum electric energy supply in kilowatt hours (kWh) + that may be stored in the vehicle's battery. + + This parameter co-exists with **currentChargeInkWh** parameter. + + Minimum value has to be greater than or equal to **currentChargeInkWh**. + + Sensible Values : 85. + :type max_charge_in_kw_h: float + :param auxiliary_power_in_kw: Specifies the amount of power consumed for sustaining auxiliary + systems, in kilowatts (kW). + + It can be used to specify consumption due to devices and systems such as AC systems, radio, + heating, etc. + + Sensible Values : 1.7. + :type auxiliary_power_in_kw: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteRangeResult, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteRangeResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteRangeResult"] + 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_route_range.metadata['url'] # type: ignore + path_format_arguments = { + '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, '[float]', div=',') + if fuel_budget_in_liters is not None: + query_parameters['fuelBudgetInLiters'] = self._serialize.query("fuel_budget_in_liters", fuel_budget_in_liters, 'float') + if energy_budget_in_kw_h is not None: + query_parameters['energyBudgetInkWh'] = self._serialize.query("energy_budget_in_kw_h", energy_budget_in_kw_h, 'float') + if time_budget_in_sec is not None: + query_parameters['timeBudgetInSec'] = self._serialize.query("time_budget_in_sec", time_budget_in_sec, 'float') + if distance_budget_in_meters is not None: + query_parameters['distanceBudgetInMeters'] = self._serialize.query("distance_budget_in_meters", distance_budget_in_meters, 'float') + if depart_at is not None: + query_parameters['departAt'] = self._serialize.query("depart_at", depart_at, 'iso-8601') + if route_type is not None: + query_parameters['routeType'] = self._serialize.query("route_type", route_type, 'str') + if use_traffic_data is not None: + query_parameters['traffic'] = self._serialize.query("use_traffic_data", use_traffic_data, 'bool') + if avoid is not None: + query_parameters['avoid'] = [self._serialize.query("avoid", q, 'str') if q is not None else '' for q in avoid] + if travel_mode is not None: + query_parameters['travelMode'] = self._serialize.query("travel_mode", travel_mode, 'str') + if incline_level is not None: + query_parameters['hilliness'] = self._serialize.query("incline_level", incline_level, 'str') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if vehicle_axle_weight is not None: + query_parameters['vehicleAxleWeight'] = self._serialize.query("vehicle_axle_weight", vehicle_axle_weight, 'int') + if vehicle_width is not None: + query_parameters['vehicleWidth'] = self._serialize.query("vehicle_width", vehicle_width, 'float') + if vehicle_height is not None: + query_parameters['vehicleHeight'] = self._serialize.query("vehicle_height", vehicle_height, 'float') + if vehicle_length is not None: + query_parameters['vehicleLength'] = self._serialize.query("vehicle_length", vehicle_length, 'float') + if vehicle_max_speed is not None: + query_parameters['vehicleMaxSpeed'] = self._serialize.query("vehicle_max_speed", vehicle_max_speed, 'int') + if vehicle_weight is not None: + query_parameters['vehicleWeight'] = self._serialize.query("vehicle_weight", vehicle_weight, 'int') + if is_commercial_vehicle is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("is_commercial_vehicle", is_commercial_vehicle, 'bool') + if vehicle_load_type is not None: + query_parameters['vehicleLoadType'] = self._serialize.query("vehicle_load_type", vehicle_load_type, 'str') + if vehicle_engine_type is not None: + query_parameters['vehicleEngineType'] = self._serialize.query("vehicle_engine_type", vehicle_engine_type, 'str') + if constant_speed_consumption_in_liters_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundred_km", constant_speed_consumption_in_liters_per_hundred_km, 'str') + if current_fuel_in_liters is not None: + query_parameters['currentFuelInLiters'] = self._serialize.query("current_fuel_in_liters", current_fuel_in_liters, 'float') + if auxiliary_power_in_liters_per_hour is not None: + query_parameters['auxiliaryPowerInLitersPerHour'] = self._serialize.query("auxiliary_power_in_liters_per_hour", auxiliary_power_in_liters_per_hour, 'float') + if fuel_energy_density_in_megajoules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_megajoules_per_liter", fuel_energy_density_in_megajoules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float', maximum=1, minimum=0) + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float', maximum=1, minimum=0) + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float', maximum=1, minimum=0) + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float', maximum=1, minimum=0) + if constant_speed_consumption_in_kw_h_per_hundred_km is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_kw_h_per_hundred_km", constant_speed_consumption_in_kw_h_per_hundred_km, 'str') + if current_charge_in_kw_h is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_in_kw_h", current_charge_in_kw_h, 'float') + if max_charge_in_kw_h is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_in_kw_h", max_charge_in_kw_h, 'float') + if auxiliary_power_in_kw is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_in_kw", auxiliary_power_in_kw, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('RouteRangeResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_range.metadata = {'url': '/route/range/{format}'} # type: ignore + + def _request_route_directions_batch_initial( + self, + route_directions_batch_queries, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteDirectionsBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResult"]] + 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._request_route_directions_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_directions_batch_queries, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _request_route_directions_batch_initial.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + def begin_request_route_directions_batch( + self, + route_directions_batch_queries, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteDirectionsBatchResult"] + """**Route Directions Batch API** + + **Applies to**\ : S1 pricing tier. + + The Route Directions Batch API sends batches of queries to `Route Directions API + `_ using just a single API + call. You can call Route Directions Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **700** queries and sync API + up to **100** queries. + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex route + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **700** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Route Directions Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + ``GET https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0`` + Note:- Please remember to add AUTH information (subscription-key/azure_auth - See `Security + <#security>`_\ ) to the *status URI* before running it. :code:`
` + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *route directions* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 3 *route directions* + queries: + + .. code-block:: json + + { + "batchItems": [ + { "query": + "?query=47.620659,-122.348934:47.610101,-122.342015&travelMode=bicycle&routeType=eco&traffic=false" + }, + { "query": + "?query=40.759856,-73.985108:40.771136,-73.973506&travelMode=pedestrian&routeType=shortest" }, + { "query": "?query=48.923159,-122.557362:32.621279,-116.840362" } + ] + } + + A *route directions* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *route directions* + `URI parameters + `_. The + string values in the *route directions* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **700** queries and sync API up to **100** queries, + and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``RouteDirections`` + `_ - If the + query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 1 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 1, + "totalRequests": 2 + }, + "batchItems": [ + { + "statusCode": 200, + "response": { + "routes": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "legs": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "points": [ + { + "latitude": 47.62094, + "longitude": -122.34892 + }, + { + "latitude": 47.62094, + "longitude": -122.3485 + }, + { + "latitude": 47.62095, + "longitude": -122.3476 + } + ] + } + ], + "sections": [ + { + "startPointIndex": 0, + "endPointIndex": 40, + "sectionType": "TRAVEL_MODE", + "travelMode": "bicycle" + } + ] + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param route_directions_batch_queries: The list of route directions queries/requests to + process. The list can contain a max of 700 queries for async and 100 queries for sync version + and must contain at least 1 query. + :type route_directions_batch_queries: ~azure.maps.route.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :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 RouteDirectionsBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResult"] + 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._request_route_directions_batch_initial( + route_directions_batch_queries=route_directions_batch_queries, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_request_route_directions_batch.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + def _get_route_directions_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteDirectionsBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResult"]] + 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_route_directions_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_route_directions_batch_initial.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + def begin_get_route_directions_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteDirectionsBatchResult"] + """Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``RouteDirections`` + `_ - If the + query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 1 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 1, + "totalRequests": 2 + }, + "batchItems": [ + { + "statusCode": 200, + "response": { + "routes": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "legs": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "points": [ + { + "latitude": 47.62094, + "longitude": -122.34892 + }, + { + "latitude": 47.62094, + "longitude": -122.3485 + }, + { + "latitude": 47.62095, + "longitude": -122.3476 + } + ] + } + ], + "sections": [ + { + "startPointIndex": 0, + "endPointIndex": 40, + "sectionType": "TRAVEL_MODE", + "travelMode": "bicycle" + } + ] + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 RouteDirectionsBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteDirectionsBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResult"] + 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._get_route_directions_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RouteDirectionsBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_route_directions_batch.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + def request_route_directions_batch_sync( + self, + route_directions_batch_queries, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteDirectionsBatchResult" + """**Route Directions Batch API** + + **Applies to**\ : S1 pricing tier. + + The Route Directions Batch API sends batches of queries to `Route Directions API + `_ using just a single API + call. You can call Route Directions Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **700** queries and sync API + up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/route/directions/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``RouteDirections`` + `_ - If the + query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 1 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 1, + "totalRequests": 2 + }, + "batchItems": [ + { + "statusCode": 200, + "response": { + "routes": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "legs": [ + { + "summary": { + "lengthInMeters": 1758, + "travelTimeInSeconds": 387, + "trafficDelayInSeconds": 0, + "departureTime": "2018-07-17T00:49:56+00:00", + "arrivalTime": "2018-07-17T00:56:22+00:00" + }, + "points": [ + { + "latitude": 47.62094, + "longitude": -122.34892 + }, + { + "latitude": 47.62094, + "longitude": -122.3485 + }, + { + "latitude": 47.62095, + "longitude": -122.3476 + } + ] + } + ], + "sections": [ + { + "startPointIndex": 0, + "endPointIndex": 40, + "sectionType": "TRAVEL_MODE", + "travelMode": "bicycle" + } + ] + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param route_directions_batch_queries: The list of route directions queries/requests to + process. The list can contain a max of 700 queries for async and 100 queries for sync version + and must contain at least 1 query. + :type route_directions_batch_queries: ~azure.maps.route.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsBatchResult, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.request_route_directions_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route_directions_batch_queries, 'BatchRequest') + 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('RouteDirectionsBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + request_route_directions_batch_sync.metadata = {'url': '/route/directions/batch/sync/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-route/azure/maps/route/py.typed b/sdk/maps/azure-maps-route/azure/maps/route/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-route/sdk_packaging.toml b/sdk/maps/azure-maps-route/sdk_packaging.toml new file mode 100644 index 000000000000..7f0d7d7f77e9 --- /dev/null +++ b/sdk/maps/azure-maps-route/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-route" +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-route/setup.cfg b/sdk/maps/azure-maps-route/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-route/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-route/setup.py b/sdk/maps/azure-maps-route/setup.py new file mode 100644 index 000000000000..fb0b3e552b39 --- /dev/null +++ b/sdk/maps/azure-maps-route/setup.py @@ -0,0 +1,90 @@ +#!/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-route" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-search/CHANGELOG.md b/sdk/maps/azure-maps-search/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-search/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-search/LICENSE.txt b/sdk/maps/azure-maps-search/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-search/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-search/MANIFEST.in b/sdk/maps/azure-maps-search/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-search/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-search/README.md b/sdk/maps/azure-maps-search/README.md new file mode 100644 index 000000000000..6d03aa262433 --- /dev/null +++ b/sdk/maps/azure-maps-search/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.6+. +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-search%2FREADME.png) diff --git a/sdk/maps/azure-maps-search/_meta.json b/sdk/maps/azure-maps-search/_meta.json new file mode 100644 index 000000000000..e6ba42eee346 --- /dev/null +++ b/sdk/maps/azure-maps-search/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Search/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/Search/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/azure/__init__.py b/sdk/maps/azure-maps-search/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-search/azure/maps/__init__.py b/sdk/maps/azure-maps-search/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/__init__.py new file mode 100644 index 000000000000..0697d1ca3e8a --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/__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 ._search_client import SearchClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['SearchClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py new file mode 100644 index 000000000000..502f16c09817 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class SearchClientConfiguration(Configuration): + """Configuration for SearchClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(SearchClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-search/{}'.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-search/azure/maps/search/_metadata.json b/sdk/maps/azure-maps-search/azure/maps/search/_metadata.json new file mode 100644 index 000000000000..66437a23b07c --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "SearchClient", + "filename": "_search_client", + "description": "Azure Maps Search REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"SearchClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"SearchClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "search": "SearchOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py new file mode 100644 index 000000000000..6d9d96805220 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py @@ -0,0 +1,86 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import SearchClientConfiguration +from .operations import SearchOperations +from . import models + + +class SearchClient(object): + """Azure Maps Search REST APIs. + + :ivar search: SearchOperations operations + :vartype search: azure.maps.search.operations.SearchOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = SearchClientConfiguration(credential, client_id, **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.search = SearchOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> SearchClient + 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-search/azure/maps/search/_version.py b/sdk/maps/azure-maps-search/azure/maps/search/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/__init__.py new file mode 100644 index 000000000000..ec41d54fc046 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/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 ._search_client import SearchClient +__all__ = ['SearchClient'] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py new file mode 100644 index 000000000000..3b8316242ee9 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 SearchClientConfiguration(Configuration): + """Configuration for SearchClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(SearchClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-search/{}'.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-search/azure/maps/search/aio/_search_client.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py new file mode 100644 index 000000000000..8677420ee1b5 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 SearchClientConfiguration +from .operations import SearchOperations +from .. import models + + +class SearchClient(object): + """Azure Maps Search REST APIs. + + :ivar search: SearchOperations operations + :vartype search: azure.maps.search.aio.operations.SearchOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = SearchClientConfiguration(credential, client_id, **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.search = SearchOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "SearchClient": + 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-search/azure/maps/search/aio/operations/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py new file mode 100644 index 000000000000..c7f640e252e1 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._search_operations import SearchOperations + +__all__ = [ + 'SearchOperations', +] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py new file mode 100644 index 000000000000..a84a09537740 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py @@ -0,0 +1,5256 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.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 SearchOperations: + """SearchOperations 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.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_polygons( + self, + geometry_ids: List[str], + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.PolygonResult": + """**Get Polygon** + + **Applies to**\ : S1 pricing tier. + + The Get Polygon service allows you to request the geometry data such as a city or country + outline for a set of entities, previously retrieved from an Online Search request in GeoJSON + format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in + either a Search Address or Search Fuzzy call. + + Please note that any geometry ID retrieved from an Online Search endpoint has a limited + lifetime. The client should not store geometry IDs in persistent storage for later referral, + as the stability of these identifiers is not guaranteed for a long period of time. It is + expected that a request to the Polygon method is made within a few minutes of the request to + the Online Search method that provided the ID. The service allows for batch requests up to 20 + identifiers. + + :param geometry_ids: Comma separated list of geometry UUIDs, previously retrieved from an + Online Search request. + :type geometry_ids: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolygonResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolygonResult"] + 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.list_polygons.metadata['url'] # type: ignore + path_format_arguments = { + '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['geometries'] = self._serialize.query("geometry_ids", geometry_ids, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_polygons.metadata = {'url': '/search/polygon/{format}'} # type: ignore + + async def fuzzy_search( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + min_fuzzy_level: Optional[int] = None, + max_fuzzy_level: Optional[int] = None, + index_filter: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Free Form Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + The basic default API is Free Form Search which handles the most fuzzy of inputs handling any + combination of address or POI tokens. This search API is the canonical 'single line search'. + The Free Form Search API is a seamless combination of POI search and geocoding. The API can + also be weighted with a contextual position (lat./lon. pair), or fully constrained by a + coordinate and radius, or it can be executed more generally without any geo biasing anchor + point.:code:`
`:code:`
`We strongly advise you to use the 'countrySet' parameter to + specify only the countries for which your application needs coverage, as the default behavior + will be to search the entire world, potentially returning unnecessary + results.:code:`
`:code:`
` E.g.: ``countrySet``\ =US,FR :code:`
`:code:`
`Please + see `Search Coverage + `_ for a complete + list of all the supported countries.:code:`
`:code:`
`Most Search queries default to + ``maxFuzzyLevel``\ =2 to gain performance and also reduce unusual results. This new default can + be overridden as needed per request by passing in the query param ``maxFuzzyLevel``\ =3 or 4. + + :param query: The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified + as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, + -122.125679"). Must be properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param min_fuzzy_level: Minimum fuzziness level to be used. Default: 1, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type min_fuzzy_level: int + :param max_fuzzy_level: Maximum fuzziness level to be used. Default: 2, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type max_fuzzy_level: int + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.fuzzy_search.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if min_fuzzy_level is not None: + query_parameters['minFuzzyLevel'] = self._serialize.query("min_fuzzy_level", min_fuzzy_level, 'int', maximum=4, minimum=1) + if max_fuzzy_level is not None: + query_parameters['maxFuzzyLevel'] = self._serialize.query("max_fuzzy_level", max_fuzzy_level, 'int', maximum=4, minimum=1) + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore + + async def search_point_of_interest( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.PointOfInterestExtendedPostalCodes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Get POI by Name** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Search allows you to request POI results by name. Search supports + additional query parameters such as language and filtering results by area of interest driven + by country or bounding box. Endpoint will return only POI results matching the query string. + Response includes POI details such as address, coordinate location and category. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **POI** = Points of Interest + + Value should be **POI** or **None** to disable extended postal codes. + + By default extended postal codes are included. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest.metadata = {'url': '/search/poi/{format}'} # type: ignore + + async def search_nearby_point_of_interest( + self, + lat: float, + lon: float, + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + radius_in_meters: Optional[int] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Nearby Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + If you have a use case for only retrieving POI results around a specific location, the nearby + search method may be the right choice. This endpoint will only return POI results, and does not + take in a search query parameter. + + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area, Min value is 1, Max Value is 50000. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_nearby_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + '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("lat", lat, 'float') + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_nearby_point_of_interest.metadata = {'url': '/search/nearby/{format}'} # type: ignore + + async def search_point_of_interest_category( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + category_filter: Optional[List[int]] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + brand_filter: Optional[List[str]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Get POI by Category** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Category Search allows you to request POI results from given category. + Search allows to query POIs from one category at a time. Endpoint will only return POI results + which are categorized as specified. Response includes POI details such as address, coordinate + location and classification. + + :param query: The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly + URL encoded. Supported main categories can be requested by calling `Get Search POI Category + Tree API `_. List of available categories can also be + found `here `_. We + recommend to use POI Search Category Tree API to request the supported categories. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_point_of_interest_category.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore + + async def get_point_of_interest_category_tree( + self, + format: Union[str, "_models.JsonFormat"] = "json", + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.PointOfInterestCategoryTreeResult": + """**Get POI Category Tree** + + **Applies to**\ : S0 and S1 pricing tiers. + + POI Category API provides a full list of supported Points of Interest (POI) categories and + subcategories together with their translations and synonyms. The returned content can be used + to provide more meaningful results through other Search Service APIs, like `Get Search POI + `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When + data in specified language is not available for a specific field, default language is used + (English). + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointOfInterestCategoryTreeResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PointOfInterestCategoryTreeResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointOfInterestCategoryTreeResult"] + 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_of_interest_category_tree.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PointOfInterestCategoryTreeResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_of_interest_category_tree.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore + + async def search_address( + self, + query: str, + format: Union[str, "_models.ResponseFormat"] = "json", + is_type_ahead: Optional[bool] = None, + top: Optional[int] = None, + skip: Optional[int] = None, + country_filter: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius_in_meters: Optional[int] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + In many cases, the complete search service might be too much, for instance if you are only + interested in traditional geocoding. Search can also be accessed for address look up + exclusively. The geocoding is performed by hitting the geocode endpoint with just the address + or partial address in question. The geocoding search index will be queried for everything above + the street level data. No POIs will be returned. Note that the geocoder is very tolerant of + typos and incomplete addresses. It will also handle everything from exact street addresses or + street or intersections as well as higher level geographies such as city centers, counties, + states etc. + + :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_address.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address.metadata = {'url': '/search/address/{format}'} # type: ignore + + async def reverse_search_address( + self, + query: List[float], + format: Union[str, "_models.ResponseFormat"] = "json", + language: Optional[str] = None, + include_speed_limit: Optional[bool] = None, + heading: Optional[int] = None, + radius_in_meters: Optional[int] = None, + number: Optional[str] = None, + include_road_use: Optional[bool] = None, + road_use: Optional[List[Union[str, "_models.RoadUseType"]]] = None, + allow_freeform_newline: Optional[bool] = None, + include_match_type: Optional[bool] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.ReverseSearchAddressResult": + """**Reverse Geocode to an Address** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable street address. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. This endpoint will return address information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param include_speed_limit: Boolean. To enable return of the posted speed limit. + :type include_speed_limit: bool + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param number: If a number is sent in along with the request, the response may include the side + of the street (Left/Right) and also an offset position for that number. + :type number: str + :param include_road_use: Boolean. To enable return of the road use array for reverse geocodes + at street level. + :type include_road_use: bool + :param road_use: To restrict reverse geocodes to a certain type of road use. The road use array + for reverse geocodes can be one or more of LimitedAccess, Arterial, Terminal, Ramp, Rotary, + LocalStreet. + :type road_use: list[str or ~azure.maps.search.models.RoadUseType] + :param allow_freeform_newline: Format of newlines in the formatted address. + + If true, the address will contain newlines. + If false, newlines will be converted to commas. + :type allow_freeform_newline: bool + :param include_match_type: Include information on the type of match the geocoder achieved in + the response. + :type include_match_type: bool + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressResult"] + 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.reverse_search_address.metadata['url'] # type: ignore + path_format_arguments = { + '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, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if include_speed_limit is not None: + query_parameters['returnSpeedLimit'] = self._serialize.query("include_speed_limit", include_speed_limit, 'bool') + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if number is not None: + query_parameters['number'] = self._serialize.query("number", number, 'str') + if include_road_use is not None: + query_parameters['returnRoadUse'] = self._serialize.query("include_road_use", include_road_use, 'bool') + if road_use is not None: + query_parameters['roadUse'] = self._serialize.query("road_use", road_use, '[str]', div=',') + if allow_freeform_newline is not None: + query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') + if include_match_type is not None: + query_parameters['returnMatchType'] = self._serialize.query("include_match_type", include_match_type, 'bool') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ReverseSearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore + + async def reverse_search_cross_street_address( + self, + query: List[float], + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + heading: Optional[int] = None, + radius_in_meters: Optional[int] = None, + language: Optional[str] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.ReverseSearchCrossStreetAddressResult": + """**Reverse Geocode to a Cross Street** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable cross street. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. + This endpoint will return cross street information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchCrossStreetAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchCrossStreetAddressResult"] + 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.reverse_search_cross_street_address.metadata['url'] # type: ignore + path_format_arguments = { + '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, '[float]', div=',') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ReverseSearchCrossStreetAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_cross_street_address.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore + + async def search_structured_address( + self, + format: Union[str, "_models.ResponseFormat"] = "json", + language: Optional[str] = None, + country_code: str = "US", + top: Optional[int] = None, + skip: Optional[int] = None, + street_number: Optional[str] = None, + street_name: Optional[str] = None, + cross_street: Optional[str] = None, + municipality: Optional[str] = None, + municipality_subdivision: Optional[str] = None, + country_tertiary_subdivision: Optional[str] = None, + country_secondary_subdivision: Optional[str] = None, + country_subdivision: Optional[str] = None, + postal_code: Optional[str] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + entity_type: Optional[Union[str, "_models.GeographicEntityType"]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Structured Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + Azure Address Geocoding can also be accessed for structured address look up exclusively. The + geocoding search index will be queried for everything above the street level data. No POIs + will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. + It will also handle everything from exact street addresses or street or intersections as well + as higher level geographies such as city centers, counties, states etc. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param country_code: The 2 or 3 letter `ISO3166-1 + `_ country code portion of an address. E.g. + US. + :type country_code: str + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param street_number: The street number portion of an address. + :type street_number: str + :param street_name: The street name portion of an address. + :type street_name: str + :param cross_street: The cross street name for the structured address. + :type cross_street: str + :param municipality: The municipality portion of an address. + :type municipality: str + :param municipality_subdivision: The municipality subdivision (sub/super city) for the + structured address. + :type municipality_subdivision: str + :param country_tertiary_subdivision: The named area for the structured address. + :type country_tertiary_subdivision: str + :param country_secondary_subdivision: The county for the structured address. + :type country_secondary_subdivision: str + :param country_subdivision: The country subdivision portion of an address. + :type country_subdivision: str + :param postal_code: The postal code portion of an address. + :type postal_code: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_structured_address.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if street_number is not None: + query_parameters['streetNumber'] = self._serialize.query("street_number", street_number, 'str') + if street_name is not None: + query_parameters['streetName'] = self._serialize.query("street_name", street_name, 'str') + if cross_street is not None: + query_parameters['crossStreet'] = self._serialize.query("cross_street", cross_street, 'str') + if municipality is not None: + query_parameters['municipality'] = self._serialize.query("municipality", municipality, 'str') + if municipality_subdivision is not None: + query_parameters['municipalitySubdivision'] = self._serialize.query("municipality_subdivision", municipality_subdivision, 'str') + if country_tertiary_subdivision is not None: + query_parameters['countryTertiarySubdivision'] = self._serialize.query("country_tertiary_subdivision", country_tertiary_subdivision, 'str') + if country_secondary_subdivision is not None: + query_parameters['countrySecondarySubdivision'] = self._serialize.query("country_secondary_subdivision", country_secondary_subdivision, 'str') + if country_subdivision is not None: + query_parameters['countrySubdivision'] = self._serialize.query("country_subdivision", country_subdivision, 'str') + if postal_code is not None: + query_parameters['postalCode'] = self._serialize.query("postal_code", postal_code, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_structured_address.metadata = {'url': '/search/address/structured/{format}'} # type: ignore + + async def search_inside_geometry( + self, + query: str, + geometry: "_models.SearchInsideGeometryRequest", + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + language: Optional[str] = None, + category_filter: Optional[List[int]] = None, + extended_postal_codes_for: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + index_filter: Optional[List[Union[str, "_models.SearchIndexes"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Geometry endpoint allows you to perform a free form search inside a single geometry + or many of them. The search results that fall inside the geometry/geometries will be + returned.:code:`
`:code:`
`To send the geometry you will use a ``POST`` request where the + request body will contain the ``geometry`` object represented as a ``GeoJSON`` type and the + ``Content-Type`` header will be set to ``application/json``. The geographical features to be + searched can be modeled as Polygon and/or Circle geometries represented using any one of the + following ``GeoJSON`` types::code:`
  • **GeoJSON FeatureCollection**
    The `geometry` can + be represented as a `GeoJSON FeatureCollection` object. This is the recommended option if the + geometry contains both Polygons and Circles. The `FeatureCollection` can contain a max of 50 + `GeoJSON Feature` objects. Each `Feature` object should represent either a Polygon or a Circle + with the following conditions:
    • A `Feature` object for the + Polygon geometry can have a max of 50 coordinates and it's properties must be empty.
    • A + `Feature` object for the Circle geometry is composed of a _center_ represented using a `GeoJSON + Point` type and a _radius_ value (in meters) which must be specified in the object's properties + along with the _subType_ property whose value should be 'Circle'.
    `:code:`
    ` Please + see the Examples section below for a sample ``FeatureCollection`` + representation.:code:`
    `:code:`
    `
  • :code:`
  • **GeoJSON GeometryCollection**
    The + `geometry` can be represented as a `GeoJSON GeometryCollection` object. This is the recommended + option if the geometry contains a list of Polygons only. The `GeometryCollection` can contain a + max of 50 `GeoJSON Polygon` objects. Each `Polygon` object can have a max of 50 coordinates. + Please see the Examples section below for a sample `GeometryCollection` + representation.

  • `:code:`
  • **GeoJSON Polygon**
    The `geometry` can be + represented as a `GeoJSON Polygon` object. This is the recommended option if the geometry + contains a single Polygon. The `Polygon` object can have a max of 50 coordinates. Please see + the Examples section below for a sample `Polygon` + representation.

  • `
.:code:`
`:code:`
`. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param geometry: This represents the geometry for one or more geographical features (parks, + state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to `RFC + 7946 `_ for details. + :type geometry: ~azure.maps.search.models.SearchInsideGeometryRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_inside_geometry.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(geometry, 'SearchInsideGeometryRequest') + 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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore + + async def search_along_route( + self, + query: str, + max_detour_time: int, + route: "_models.SearchAlongRouteRequest", + format: Union[str, "_models.ResponseFormat"] = "json", + top: Optional[int] = None, + brand_filter: Optional[List[str]] = None, + category_filter: Optional[List[int]] = None, + electric_vehicle_connector_filter: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] = None, + localized_map_view: Optional[Union[str, "_models.LocalizedMapView"]] = None, + operating_hours: Optional[Union[str, "_models.OperatingHoursRange"]] = None, + **kwargs: Any + ) -> "_models.SearchAddressResult": + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified + route. This search is constrained by specifying the ``maxDetourTime`` limiting + measure.:code:`
`:code:`
`To send the route-points you will use a ``POST`` request where + the request body will contain the ``route`` object represented as a ``GeoJSON LineString`` type + and the ``Content-Type`` header will be set to ``application/json``. Each route-point in + ``route`` is represented as a ``GeoJSON Position`` type i.e. an array where the *longitude* + value is followed by the *latitude* value and the *altitude* value is ignored. The ``route`` + should contain at least 2 route-points.:code:`
`:code:`
`It is possible that original + route will be altered, some of it's points may be skipped. If the route that passes through the + found point is faster than the original one, the ``detourTime`` value in the response is + negative. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param max_detour_time: Maximum detour time of the point of interest in seconds. Max value is + 3600 seconds. + :type max_detour_time: int + :param route: This represents the route to search along and should be a valid ``GeoJSON + LineString`` type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.SearchAlongRouteRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default value is 10. Max value + is 20. + :type top: int + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_along_route.metadata['url'] # type: ignore + path_format_arguments = { + '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') + query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=20) + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route, 'SearchAlongRouteRequest') + 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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore + + async def fuzzy_search_batch_sync( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.SearchAddressBatchResult": + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.fuzzy_search_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + 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('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore + + async def _fuzzy_search_batch_initial( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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._fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def begin_fuzzy_search_batch( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._fuzzy_search_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def _get_fuzzy_search_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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_fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def begin_get_fuzzy_search_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._get_fuzzy_search_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def search_address_batch_sync( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.SearchAddressBatchResult": + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + 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('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore + + async def _search_address_batch_initial( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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._search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def begin_search_address_batch( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def _get_search_address_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def begin_get_search_address_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResult"]: + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._get_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def reverse_search_address_batch_sync( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.ReverseSearchAddressBatchProcessResult": + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressBatchProcessResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.reverse_search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + 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('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore + + async def _reverse_search_address_batch_initial( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> Optional["_models.ReverseSearchAddressBatchProcessResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + 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._reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def begin_reverse_search_address_batch( + self, + batch_request: "_models.BatchRequest", + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> AsyncLROPoller["_models.ReverseSearchAddressBatchProcessResult"]: + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :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 ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + 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._reverse_search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def _get_reverse_search_address_batch_initial( + self, + batch_id: str, + **kwargs: Any + ) -> Optional["_models.ReverseSearchAddressBatchProcessResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + 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_reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def begin_get_reverse_search_address_batch( + self, + batch_id: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ReverseSearchAddressBatchProcessResult"]: + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + 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._get_reverse_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py new file mode 100644 index 000000000000..8ea3ff907483 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py @@ -0,0 +1,233 @@ +# 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 Address + from ._models_py3 import AddressRanges + from ._models_py3 import BatchRequest + from ._models_py3 import BatchRequestItem + from ._models_py3 import BatchResult + from ._models_py3 import BatchResultItem + from ._models_py3 import BatchResultSummary + from ._models_py3 import BoundingBox + from ._models_py3 import BrandName + from ._models_py3 import Classification + from ._models_py3 import ClassificationName + from ._models_py3 import DataSource + from ._models_py3 import EntryPoint + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + 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 GeometryIdentifier + from ._models_py3 import LatLongPairAbbreviated + from ._models_py3 import OperatingHours + from ._models_py3 import OperatingHoursTime + from ._models_py3 import OperatingHoursTimeRange + from ._models_py3 import PointOfInterest + from ._models_py3 import PointOfInterestCategory + from ._models_py3 import PointOfInterestCategorySet + from ._models_py3 import PointOfInterestCategoryTreeResult + from ._models_py3 import Polygon + from ._models_py3 import PolygonResult + from ._models_py3 import ReverseSearchAddressBatchItem + from ._models_py3 import ReverseSearchAddressBatchItemResponse + from ._models_py3 import ReverseSearchAddressBatchProcessResult + from ._models_py3 import ReverseSearchAddressResult + from ._models_py3 import ReverseSearchAddressResultItem + from ._models_py3 import ReverseSearchCrossStreetAddressResult + from ._models_py3 import ReverseSearchCrossStreetAddressResultItem + from ._models_py3 import SearchAddressBatchItem + from ._models_py3 import SearchAddressBatchItemResponse + from ._models_py3 import SearchAddressBatchResult + from ._models_py3 import SearchAddressResult + from ._models_py3 import SearchAddressResultItem + from ._models_py3 import SearchAlongRouteRequest + from ._models_py3 import SearchInsideGeometryRequest + from ._models_py3 import SearchSummary + from ._models_py3 import Viewport +except (SyntaxError, ImportError): + from ._models import Address # type: ignore + from ._models import AddressRanges # type: ignore + from ._models import BatchRequest # type: ignore + from ._models import BatchRequestItem # type: ignore + from ._models import BatchResult # type: ignore + from ._models import BatchResultItem # type: ignore + from ._models import BatchResultSummary # type: ignore + from ._models import BoundingBox # type: ignore + from ._models import BrandName # type: ignore + from ._models import Classification # type: ignore + from ._models import ClassificationName # type: ignore + from ._models import DataSource # type: ignore + from ._models import EntryPoint # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # 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 GeometryIdentifier # type: ignore + from ._models import LatLongPairAbbreviated # type: ignore + from ._models import OperatingHours # type: ignore + from ._models import OperatingHoursTime # type: ignore + from ._models import OperatingHoursTimeRange # type: ignore + from ._models import PointOfInterest # type: ignore + from ._models import PointOfInterestCategory # type: ignore + from ._models import PointOfInterestCategorySet # type: ignore + from ._models import PointOfInterestCategoryTreeResult # type: ignore + from ._models import Polygon # type: ignore + from ._models import PolygonResult # type: ignore + from ._models import ReverseSearchAddressBatchItem # type: ignore + from ._models import ReverseSearchAddressBatchItemResponse # type: ignore + from ._models import ReverseSearchAddressBatchProcessResult # type: ignore + from ._models import ReverseSearchAddressResult # type: ignore + from ._models import ReverseSearchAddressResultItem # type: ignore + from ._models import ReverseSearchCrossStreetAddressResult # type: ignore + from ._models import ReverseSearchCrossStreetAddressResultItem # type: ignore + from ._models import SearchAddressBatchItem # type: ignore + from ._models import SearchAddressBatchItemResponse # type: ignore + from ._models import SearchAddressBatchResult # type: ignore + from ._models import SearchAddressResult # type: ignore + from ._models import SearchAddressResultItem # type: ignore + from ._models import SearchAlongRouteRequest # type: ignore + from ._models import SearchInsideGeometryRequest # type: ignore + from ._models import SearchSummary # type: ignore + from ._models import Viewport # type: ignore + +from ._search_client_enums import ( + ElectricVehicleConnector, + EntryPointType, + GeoJsonObjectType, + GeographicEntityType, + JsonFormat, + LocalizedMapView, + MatchType, + OperatingHoursRange, + PointOfInterestExtendedPostalCodes, + QueryType, + ResponseFormat, + RoadUseType, + SearchAddressResultType, + SearchIndexes, +) + +__all__ = [ + 'Address', + 'AddressRanges', + 'BatchRequest', + 'BatchRequestItem', + 'BatchResult', + 'BatchResultItem', + 'BatchResultSummary', + 'BoundingBox', + 'BrandName', + 'Classification', + 'ClassificationName', + 'DataSource', + 'EntryPoint', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'GeometryIdentifier', + 'LatLongPairAbbreviated', + 'OperatingHours', + 'OperatingHoursTime', + 'OperatingHoursTimeRange', + 'PointOfInterest', + 'PointOfInterestCategory', + 'PointOfInterestCategorySet', + 'PointOfInterestCategoryTreeResult', + 'Polygon', + 'PolygonResult', + 'ReverseSearchAddressBatchItem', + 'ReverseSearchAddressBatchItemResponse', + 'ReverseSearchAddressBatchProcessResult', + 'ReverseSearchAddressResult', + 'ReverseSearchAddressResultItem', + 'ReverseSearchCrossStreetAddressResult', + 'ReverseSearchCrossStreetAddressResultItem', + 'SearchAddressBatchItem', + 'SearchAddressBatchItemResponse', + 'SearchAddressBatchResult', + 'SearchAddressResult', + 'SearchAddressResultItem', + 'SearchAlongRouteRequest', + 'SearchInsideGeometryRequest', + 'SearchSummary', + 'Viewport', + 'ElectricVehicleConnector', + 'EntryPointType', + 'GeoJsonObjectType', + 'GeographicEntityType', + 'JsonFormat', + 'LocalizedMapView', + 'MatchType', + 'OperatingHoursRange', + 'PointOfInterestExtendedPostalCodes', + 'QueryType', + 'ResponseFormat', + 'RoadUseType', + 'SearchAddressResultType', + 'SearchIndexes', +] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py new file mode 100644 index 000000000000..0685797302fa --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py @@ -0,0 +1,2154 @@ +# 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 Address(msrest.serialization.Model): + """The address of the result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar building_number: The building number on the street. DEPRECATED, use streetNumber instead. + :vartype building_number: str + :ivar street: The street name. DEPRECATED, use streetName instead. + :vartype street: str + :ivar cross_street: The name of the street being crossed. + :vartype cross_street: str + :ivar street_number: The building number on the street. + :vartype street_number: str + :ivar route_numbers: The codes used to unambiguously identify the street. + :vartype route_numbers: list[int] + :ivar street_name: The street name. + :vartype street_name: str + :ivar street_name_and_number: The street name and number. + :vartype street_name_and_number: str + :ivar municipality: City / Town. + :vartype municipality: str + :ivar municipality_subdivision: Sub / Super City. + :vartype municipality_subdivision: str + :ivar country_tertiary_subdivision: Named Area. + :vartype country_tertiary_subdivision: str + :ivar country_secondary_subdivision: County. + :vartype country_secondary_subdivision: str + :ivar country_subdivision: State or Province. + :vartype country_subdivision: str + :ivar postal_code: Postal Code / Zip Code. + :vartype postal_code: str + :ivar extended_postal_code: Extended postal code (availability is dependent on the region). + :vartype extended_postal_code: str + :ivar country_code: Country (Note: This is a two-letter code, not a country name.). + :vartype country_code: str + :ivar country: Country name. + :vartype country: str + :ivar country_code_iso3: ISO alpha-3 country code. + :vartype country_code_iso3: str + :ivar freeform_address: An address line formatted according to the formatting rules of a + Result's country of origin, or in the case of a country, its full country name. + :vartype freeform_address: str + :ivar country_subdivision_name: The full name of a first level of country administrative + hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated + form. Only supported for USA, Canada, and Great Britain. + :vartype country_subdivision_name: str + :ivar local_name: An address component which represents the name of a geographic area or + locality that groups a number of addressable objects for addressing purposes, without being an + administrative unit. This field is used to build the ``freeformAddress`` property. + :vartype local_name: str + :ivar bounding_box: Bounding box coordinates. + :vartype bounding_box: any + """ + + _validation = { + 'building_number': {'readonly': True}, + 'street': {'readonly': True}, + 'cross_street': {'readonly': True}, + 'street_number': {'readonly': True}, + 'route_numbers': {'readonly': True}, + 'street_name': {'readonly': True}, + 'street_name_and_number': {'readonly': True}, + 'municipality': {'readonly': True}, + 'municipality_subdivision': {'readonly': True}, + 'country_tertiary_subdivision': {'readonly': True}, + 'country_secondary_subdivision': {'readonly': True}, + 'country_subdivision': {'readonly': True}, + 'postal_code': {'readonly': True}, + 'extended_postal_code': {'readonly': True}, + 'country_code': {'readonly': True}, + 'country': {'readonly': True}, + 'country_code_iso3': {'readonly': True}, + 'freeform_address': {'readonly': True}, + 'country_subdivision_name': {'readonly': True}, + 'local_name': {'readonly': True}, + 'bounding_box': {'readonly': True}, + } + + _attribute_map = { + 'building_number': {'key': 'buildingNumber', 'type': 'str'}, + 'street': {'key': 'street', 'type': 'str'}, + 'cross_street': {'key': 'crossStreet', 'type': 'str'}, + 'street_number': {'key': 'streetNumber', 'type': 'str'}, + 'route_numbers': {'key': 'routeNumbers', 'type': '[int]'}, + 'street_name': {'key': 'streetName', 'type': 'str'}, + 'street_name_and_number': {'key': 'streetNameAndNumber', 'type': 'str'}, + 'municipality': {'key': 'municipality', 'type': 'str'}, + 'municipality_subdivision': {'key': 'municipalitySubdivision', 'type': 'str'}, + 'country_tertiary_subdivision': {'key': 'countryTertiarySubdivision', 'type': 'str'}, + 'country_secondary_subdivision': {'key': 'countrySecondarySubdivision', 'type': 'str'}, + 'country_subdivision': {'key': 'countrySubdivision', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'extended_postal_code': {'key': 'extendedPostalCode', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'country_code_iso3': {'key': 'countryCodeISO3', 'type': 'str'}, + 'freeform_address': {'key': 'freeformAddress', 'type': 'str'}, + 'country_subdivision_name': {'key': 'countrySubdivisionName', 'type': 'str'}, + 'local_name': {'key': 'localName', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Address, self).__init__(**kwargs) + self.building_number = None + self.street = None + self.cross_street = None + self.street_number = None + self.route_numbers = None + self.street_name = None + self.street_name_and_number = None + self.municipality = None + self.municipality_subdivision = None + self.country_tertiary_subdivision = None + self.country_secondary_subdivision = None + self.country_subdivision = None + self.postal_code = None + self.extended_postal_code = None + self.country_code = None + self.country = None + self.country_code_iso3 = None + self.freeform_address = None + self.country_subdivision_name = None + self.local_name = None + self.bounding_box = None + + +class AddressRanges(msrest.serialization.Model): + """Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. + + :param range_left: Address range on the left side of the street. + :type range_left: str + :param range_right: Address range on the right side of the street. + :type range_right: str + :param from_property: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type from_property: ~azure.maps.search.models.LatLongPairAbbreviated + :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. + :type to: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'range_left': {'key': 'rangeLeft', 'type': 'str'}, + 'range_right': {'key': 'rangeRight', 'type': 'str'}, + 'from_property': {'key': 'from', 'type': 'LatLongPairAbbreviated'}, + 'to': {'key': 'to', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(AddressRanges, self).__init__(**kwargs) + self.range_left = kwargs.get('range_left', None) + self.range_right = kwargs.get('range_right', None) + self.from_property = kwargs.get('from_property', None) + self.to = kwargs.get('to', None) + + +class BatchRequest(msrest.serialization.Model): + """This type represents the request body for the Batch service. + + :param batch_items: The list of queries to process. + :type batch_items: list[~azure.maps.search.models.BatchRequestItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequest, self).__init__(**kwargs) + self.batch_items = kwargs.get('batch_items', None) + + +class BatchRequestItem(msrest.serialization.Model): + """Batch request object. + + :param query: This parameter contains a query string used to perform an unstructured geocoding + operation. The query string will be passed verbatim to the search API for processing. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestItem, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + + +class BatchResult(msrest.serialization.Model): + """This object is returned from a successful Batch service call. Extend with 'batchItems' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + """ + + _validation = { + 'batch_summary': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResult, self).__init__(**kwargs) + self.batch_summary = None + + +class BatchResultItem(msrest.serialization.Model): + """An item returned from Batch API. Extend with 'response' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchResultSummary(msrest.serialization.Model): + """Summary of the results for the batch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_requests: Number of successful requests in the batch. + :vartype successful_requests: int + :ivar total_requests: Total number of requests in the batch. + :vartype total_requests: int + """ + + _validation = { + 'successful_requests': {'readonly': True}, + 'total_requests': {'readonly': True}, + } + + _attribute_map = { + 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, + 'total_requests': {'key': 'totalRequests', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class BoundingBox(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type top_left: ~azure.maps.search.models.LatLongPairAbbreviated + :param bottom_right: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type bottom_right: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'bottom_right': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(BoundingBox, self).__init__(**kwargs) + self.top_left = kwargs.get('top_left', None) + self.bottom_right = kwargs.get('bottom_right', None) + + +class BrandName(msrest.serialization.Model): + """The name of the brand for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the brand. + :vartype name: str + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BrandName, self).__init__(**kwargs) + self.name = None + + +class Classification(msrest.serialization.Model): + """The classification for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code property. + :vartype code: str + :ivar names: Names array. + :vartype names: list[~azure.maps.search.models.ClassificationName] + """ + + _validation = { + 'code': {'readonly': True}, + 'names': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[ClassificationName]'}, + } + + def __init__( + self, + **kwargs + ): + super(Classification, self).__init__(**kwargs) + self.code = None + self.names = None + + +class ClassificationName(msrest.serialization.Model): + """Name for the classification. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_locale: Name Locale property. + :vartype name_locale: str + :ivar name: Name property. + :vartype name: str + """ + + _validation = { + 'name_locale': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name_locale': {'key': 'nameLocale', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClassificationName, self).__init__(**kwargs) + self.name_locale = None + self.name = None + + +class DataSource(msrest.serialization.Model): + """Optional section. Reference ids for use with the `Get Search Polygon `_ API. + + :param geometry: Information about the geometric shape of the result. Only present if type == + Geography. + :type geometry: ~azure.maps.search.models.GeometryIdentifier + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeometryIdentifier'}, + } + + def __init__( + self, + **kwargs + ): + super(DataSource, self).__init__(**kwargs) + self.geometry = kwargs.get('geometry', None) + + +class EntryPoint(msrest.serialization.Model): + """The entry point for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of entry point. Value can be either *main* or *minor*. Possible values + include: "main", "minor". + :vartype type: str or ~azure.maps.search.models.EntryPointType + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(EntryPoint, self).__init__(**kwargs) + self.type = None + self.position = kwargs.get('position', None) + + +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.search.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.search.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.search.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 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.search.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 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.search.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 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.search.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.search.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 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.search.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 GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + 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.search.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.search.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(**kwargs) + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # 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.search.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.search.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.search.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.search.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.search.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.search.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.search.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.search.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.search.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.search.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 GeometryIdentifier(msrest.serialization.Model): + """Information about the geometric shape of the result. Only present if type == Geography. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Pass this as geometryId to the `Get Search Polygon + `_ API to fetch geometry + information for this result. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeometryIdentifier, self).__init__(**kwargs) + self.id = None + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = kwargs.get('lat', None) + self.lon = kwargs.get('lon', None) + + +class OperatingHours(msrest.serialization.Model): + """Opening hours for a POI (Points of Interest). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mode: Value used in the request: none or "nextSevenDays". + :vartype mode: str + :ivar time_ranges: List of time ranges for the next 7 days. + :vartype time_ranges: list[~azure.maps.search.models.OperatingHoursTimeRange] + """ + + _validation = { + 'mode': {'readonly': True}, + 'time_ranges': {'readonly': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'time_ranges': {'key': 'timeRanges', 'type': '[OperatingHoursTimeRange]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHours, self).__init__(**kwargs) + self.mode = None + self.time_ranges = None + + +class OperatingHoursTime(msrest.serialization.Model): + """Represents a date and time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar date: Represents current calendar date in POI time zone, e.g. "2019-02-07". + :vartype date: str + :ivar hour: Hours are in the 24 hour format in the local time of a POI; possible values are 0 - + 23. + :vartype hour: int + :ivar minute: Minutes are in the local time of a POI; possible values are 0 - 59. + :vartype minute: int + """ + + _validation = { + 'date': {'readonly': True}, + 'hour': {'readonly': True}, + 'minute': {'readonly': True}, + } + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'hour': {'key': 'hour', 'type': 'int'}, + 'minute': {'key': 'minute', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHoursTime, self).__init__(**kwargs) + self.date = None + self.hour = None + self.minute = None + + +class OperatingHoursTimeRange(msrest.serialization.Model): + """Open time range for a day. + + :param start_time: The point in the next 7 days range when a given POI is being opened, or the + beginning of the range if it was opened before the range. + :type start_time: ~azure.maps.search.models.OperatingHoursTime + :param end_time: The point in the next 7 days range when a given POI is being closed, or the + beginning of the range if it was closed before the range. + :type end_time: ~azure.maps.search.models.OperatingHoursTime + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'OperatingHoursTime'}, + 'end_time': {'key': 'endTime', 'type': 'OperatingHoursTime'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHoursTimeRange, self).__init__(**kwargs) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + + +class PointOfInterest(msrest.serialization.Model): + """Details of the returned POI including information such as the name, phone, url address, and classifications. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the POI property. + :vartype name: str + :ivar phone: Telephone number property. + :vartype phone: str + :ivar url: Website URL property. + :vartype url: str + :ivar category_set: The list of the most specific POI categories. + :vartype category_set: list[~azure.maps.search.models.PointOfInterestCategorySet] + :ivar classifications: Classification array. + :vartype classifications: list[~azure.maps.search.models.Classification] + :ivar brands: Brands array. The name of the brand for the POI being returned. + :vartype brands: list[~azure.maps.search.models.BrandName] + :param operating_hours: Opening hours for a POI (Points of Interest). + :type operating_hours: ~azure.maps.search.models.OperatingHours + """ + + _validation = { + 'name': {'readonly': True}, + 'phone': {'readonly': True}, + 'url': {'readonly': True}, + 'category_set': {'readonly': True}, + 'classifications': {'readonly': True}, + 'brands': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'category_set': {'key': 'categorySet', 'type': '[PointOfInterestCategorySet]'}, + 'classifications': {'key': 'classifications', 'type': '[Classification]'}, + 'brands': {'key': 'brands', 'type': '[BrandName]'}, + 'operating_hours': {'key': 'openingHours', 'type': 'OperatingHours'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterest, self).__init__(**kwargs) + self.name = None + self.phone = None + self.url = None + self.category_set = None + self.classifications = None + self.brands = None + self.operating_hours = kwargs.get('operating_hours', None) + + +class PointOfInterestCategory(msrest.serialization.Model): + """POI category result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique ID for the category. ID can be used to restrict search results to specific + categories through other Search Service APIs, like `Get Search POI + `_. + :vartype id: int + :ivar name: Name of the category. + :vartype name: str + :ivar child_ids: Array of child category ids. + :vartype child_ids: list[int] + :ivar synonyms: Array of alternative names of the category. + :vartype synonyms: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'child_ids': {'readonly': True}, + 'synonyms': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'child_ids': {'key': 'childCategoryIds', 'type': '[int]'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategory, self).__init__(**kwargs) + self.id = None + self.name = None + self.child_ids = None + self.synonyms = None + + +class PointOfInterestCategorySet(msrest.serialization.Model): + """POI category. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Category ID. + :vartype id: int + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategorySet, self).__init__(**kwargs) + self.id = None + + +class PointOfInterestCategoryTreeResult(msrest.serialization.Model): + """This object is returned from a successful POI Category Tree call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar categories: Categories array. + :vartype categories: list[~azure.maps.search.models.PointOfInterestCategory] + """ + + _validation = { + 'categories': {'readonly': True}, + } + + _attribute_map = { + 'categories': {'key': 'poiCategories', 'type': '[PointOfInterestCategory]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategoryTreeResult, self).__init__(**kwargs) + self.categories = None + + +class Polygon(msrest.serialization.Model): + """Polygon. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider_id: ID of the returned entity. + :vartype provider_id: str + :param geometry_data: Geometry data in GeoJSON format. Please refer to `RFC 7946 + `_ for details. Present only if "error" is not present. + :type geometry_data: ~azure.maps.search.models.GeoJsonObject + """ + + _validation = { + 'provider_id': {'readonly': True}, + } + + _attribute_map = { + 'provider_id': {'key': 'providerID', 'type': 'str'}, + 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + **kwargs + ): + super(Polygon, self).__init__(**kwargs) + self.provider_id = None + self.geometry_data = kwargs.get('geometry_data', None) + + +class PolygonResult(msrest.serialization.Model): + """This object is returned from a successful Search Polygon call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar polygons: Results array. + :vartype polygons: list[~azure.maps.search.models.Polygon] + """ + + _validation = { + 'polygons': {'readonly': True}, + } + + _attribute_map = { + 'polygons': {'key': 'additionalData', 'type': '[Polygon]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolygonResult, self).__init__(**kwargs) + self.polygons = None + + +class ReverseSearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressReverseResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'ReverseSearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class ReverseSearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchAddressBatchItemResponse(ErrorResponse, ReverseSearchAddressResult): + """The result of the query. SearchAddressReverseResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchItemResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + self.error = kwargs.get('error', None) + + +class ReverseSearchAddressBatchProcessResult(BatchResult): + """This object is returned from a successful Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.ReverseSearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[ReverseSearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchProcessResult, self).__init__(**kwargs) + self.batch_items = None + + +class ReverseSearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + :ivar road_use: + :vartype road_use: list[str or ~azure.maps.search.models.RoadUseType] + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + 'road_use': {'readonly': True}, + 'match_type': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + 'road_use': {'key': 'roadUse', 'type': '[str]'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + self.road_use = None + self.match_type = None + + +class ReverseSearchCrossStreetAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse CrossStreet call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse Cross Street response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchCrossStreetAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchCrossStreetAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchCrossStreetAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse Cross Street response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + + +class SearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search calls. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.results = None + + +class SearchAddressBatchItemResponse(ErrorResponse, SearchAddressResult): + """The result of the query. SearchAddressResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItemResponse, self).__init__(**kwargs) + self.summary = None + self.results = None + self.error = kwargs.get('error', None) + + +class SearchAddressBatchResult(BatchResult): + """This object is returned from a successful Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchResult, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: One of: + + + * POI + * Street + * Geography + * Point Address + * Address Range + * Cross Street. Possible values include: "POI", "Street", "Geography", "Point Address", + "Address Range", "Cross Street". + :vartype type: str or ~azure.maps.search.models.SearchAddressResultType + :ivar id: Id property. + :vartype id: str + :ivar score: The value within a result set to indicate the relative matching score between + results. You can use this to determine that result x is twice as likely to be as relevant as + result y if the value of x is 2x the value of y. The values vary between queries and is only + meant as a relative value for one result set. + :vartype score: float + :ivar distance_in_meters: Straight line distance between the result and geobias location in + meters. + :vartype distance_in_meters: float + :ivar info: Information about the original data source of the Result. Used for support + requests. + :vartype info: str + :param entity_type: Possible values include: "Country", "CountrySubdivision", + "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", + "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :ivar point_of_interest: Details of the returned POI including information such as the name, + phone, url address, and classifications. + :vartype point_of_interest: ~azure.maps.search.models.PointOfInterest + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + :ivar viewport: The viewport that covers the result represented by the top-left and + bottom-right coordinates of the viewport. + :vartype viewport: ~azure.maps.search.models.BoundingBox + :ivar entry_points: Array of EntryPoints. Those describe the types of entrances available at + the location. The type can be "main" for main entrances such as a front door, or a lobby, and + "minor", for side and back doors. + :vartype entry_points: list[~azure.maps.search.models.EntryPoint] + :ivar address_ranges: Describes the address range on both sides of the street for a search + result. Coordinates for the start and end locations of the address range are included. + :vartype address_ranges: ~azure.maps.search.models.AddressRanges + :ivar data_sources: Optional section. Reference geometry id for use with the `Get Search + Polygon `_ API. + :vartype data_sources: ~azure.maps.search.models.DataSource + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + :ivar detour_time: Detour time in seconds. Only returned for calls to the Search Along Route + API. + :vartype detour_time: int + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'score': {'readonly': True}, + 'distance_in_meters': {'readonly': True}, + 'info': {'readonly': True}, + 'point_of_interest': {'readonly': True}, + 'address': {'readonly': True}, + 'viewport': {'readonly': True}, + 'entry_points': {'readonly': True}, + 'address_ranges': {'readonly': True}, + 'data_sources': {'readonly': True}, + 'match_type': {'readonly': True}, + 'detour_time': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'distance_in_meters': {'key': 'dist', 'type': 'float'}, + 'info': {'key': 'info', 'type': 'str'}, + 'entity_type': {'key': 'entityType', 'type': 'str'}, + 'point_of_interest': {'key': 'poi', 'type': 'PointOfInterest'}, + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + 'viewport': {'key': 'viewport', 'type': 'BoundingBox'}, + 'entry_points': {'key': 'entryPoints', 'type': '[EntryPoint]'}, + 'address_ranges': {'key': 'addressRanges', 'type': 'AddressRanges'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSource'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + 'detour_time': {'key': 'detourTime', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressResultItem, self).__init__(**kwargs) + self.type = None + self.id = None + self.score = None + self.distance_in_meters = None + self.info = None + self.entity_type = kwargs.get('entity_type', None) + self.point_of_interest = None + self.address = None + self.position = kwargs.get('position', None) + self.viewport = None + self.entry_points = None + self.address_ranges = None + self.data_sources = None + self.match_type = None + self.detour_time = None + + +class SearchAlongRouteRequest(msrest.serialization.Model): + """This type represents the request body for the Search Along Route service. + + :param route: A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.GeoJsonLineString + """ + + _attribute_map = { + 'route': {'key': 'route', 'type': 'GeoJsonLineString'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAlongRouteRequest, self).__init__(**kwargs) + self.route = kwargs.get('route', None) + + +class SearchInsideGeometryRequest(msrest.serialization.Model): + """This type represents the request body for the Search Inside Geometry service. + + :param geometry: A valid ``GeoJSON`` object. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonObject + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchInsideGeometryRequest, self).__init__(**kwargs) + self.geometry = kwargs.get('geometry', None) + + +class SearchSummary(msrest.serialization.Model): + """Summary object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar query: The query parameter that was used to produce these search results. + :vartype query: str + :ivar query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values + include: "NEARBY", "NON_NEAR". + :vartype query_type: str or ~azure.maps.search.models.QueryType + :ivar query_time: Time spent resolving the query, in milliseconds. + :vartype query_time: int + :ivar num_results: Number of results in the response. + :vartype num_results: int + :ivar top: Maximum number of responses that will be returned. + :vartype top: int + :ivar skip: The starting offset of the returned Results within the full Result set. + :vartype skip: int + :ivar total_results: The total number of Results found. + :vartype total_results: int + :ivar fuzzy_level: The maximum fuzzy level required to provide Results. + :vartype fuzzy_level: int + :ivar geo_bias: Indication when the internal search engine has applied a geospatial bias to + improve the ranking of results. In some methods, this can be affected by setting the lat and + lon parameters where available. In other cases it is purely internal. + :vartype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'query': {'readonly': True}, + 'query_type': {'readonly': True}, + 'query_time': {'readonly': True}, + 'num_results': {'readonly': True}, + 'top': {'readonly': True}, + 'skip': {'readonly': True}, + 'total_results': {'readonly': True}, + 'fuzzy_level': {'readonly': True}, + 'geo_bias': {'readonly': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'query_time': {'key': 'queryTime', 'type': 'int'}, + 'num_results': {'key': 'numResults', 'type': 'int'}, + 'top': {'key': 'limit', 'type': 'int'}, + 'skip': {'key': 'offset', 'type': 'int'}, + 'total_results': {'key': 'totalResults', 'type': 'int'}, + 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, + 'geo_bias': {'key': 'geoBias', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchSummary, self).__init__(**kwargs) + self.query = None + self.query_type = None + self.query_time = None + self.num_results = None + self.top = None + self.skip = None + self.total_results = None + self.fuzzy_level = None + self.geo_bias = None + + +class Viewport(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type top_left_point: ~azure.maps.search.models.LatLongPairAbbreviated + :param btm_right_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type btm_right_point: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left_point': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'btm_right_point': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(Viewport, self).__init__(**kwargs) + self.top_left_point = kwargs.get('top_left_point', None) + self.btm_right_point = kwargs.get('btm_right_point', None) diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py new file mode 100644 index 000000000000..7eecb58c837e --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py @@ -0,0 +1,2242 @@ +# 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, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._search_client_enums import * + + +class Address(msrest.serialization.Model): + """The address of the result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar building_number: The building number on the street. DEPRECATED, use streetNumber instead. + :vartype building_number: str + :ivar street: The street name. DEPRECATED, use streetName instead. + :vartype street: str + :ivar cross_street: The name of the street being crossed. + :vartype cross_street: str + :ivar street_number: The building number on the street. + :vartype street_number: str + :ivar route_numbers: The codes used to unambiguously identify the street. + :vartype route_numbers: list[int] + :ivar street_name: The street name. + :vartype street_name: str + :ivar street_name_and_number: The street name and number. + :vartype street_name_and_number: str + :ivar municipality: City / Town. + :vartype municipality: str + :ivar municipality_subdivision: Sub / Super City. + :vartype municipality_subdivision: str + :ivar country_tertiary_subdivision: Named Area. + :vartype country_tertiary_subdivision: str + :ivar country_secondary_subdivision: County. + :vartype country_secondary_subdivision: str + :ivar country_subdivision: State or Province. + :vartype country_subdivision: str + :ivar postal_code: Postal Code / Zip Code. + :vartype postal_code: str + :ivar extended_postal_code: Extended postal code (availability is dependent on the region). + :vartype extended_postal_code: str + :ivar country_code: Country (Note: This is a two-letter code, not a country name.). + :vartype country_code: str + :ivar country: Country name. + :vartype country: str + :ivar country_code_iso3: ISO alpha-3 country code. + :vartype country_code_iso3: str + :ivar freeform_address: An address line formatted according to the formatting rules of a + Result's country of origin, or in the case of a country, its full country name. + :vartype freeform_address: str + :ivar country_subdivision_name: The full name of a first level of country administrative + hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated + form. Only supported for USA, Canada, and Great Britain. + :vartype country_subdivision_name: str + :ivar local_name: An address component which represents the name of a geographic area or + locality that groups a number of addressable objects for addressing purposes, without being an + administrative unit. This field is used to build the ``freeformAddress`` property. + :vartype local_name: str + :ivar bounding_box: Bounding box coordinates. + :vartype bounding_box: any + """ + + _validation = { + 'building_number': {'readonly': True}, + 'street': {'readonly': True}, + 'cross_street': {'readonly': True}, + 'street_number': {'readonly': True}, + 'route_numbers': {'readonly': True}, + 'street_name': {'readonly': True}, + 'street_name_and_number': {'readonly': True}, + 'municipality': {'readonly': True}, + 'municipality_subdivision': {'readonly': True}, + 'country_tertiary_subdivision': {'readonly': True}, + 'country_secondary_subdivision': {'readonly': True}, + 'country_subdivision': {'readonly': True}, + 'postal_code': {'readonly': True}, + 'extended_postal_code': {'readonly': True}, + 'country_code': {'readonly': True}, + 'country': {'readonly': True}, + 'country_code_iso3': {'readonly': True}, + 'freeform_address': {'readonly': True}, + 'country_subdivision_name': {'readonly': True}, + 'local_name': {'readonly': True}, + 'bounding_box': {'readonly': True}, + } + + _attribute_map = { + 'building_number': {'key': 'buildingNumber', 'type': 'str'}, + 'street': {'key': 'street', 'type': 'str'}, + 'cross_street': {'key': 'crossStreet', 'type': 'str'}, + 'street_number': {'key': 'streetNumber', 'type': 'str'}, + 'route_numbers': {'key': 'routeNumbers', 'type': '[int]'}, + 'street_name': {'key': 'streetName', 'type': 'str'}, + 'street_name_and_number': {'key': 'streetNameAndNumber', 'type': 'str'}, + 'municipality': {'key': 'municipality', 'type': 'str'}, + 'municipality_subdivision': {'key': 'municipalitySubdivision', 'type': 'str'}, + 'country_tertiary_subdivision': {'key': 'countryTertiarySubdivision', 'type': 'str'}, + 'country_secondary_subdivision': {'key': 'countrySecondarySubdivision', 'type': 'str'}, + 'country_subdivision': {'key': 'countrySubdivision', 'type': 'str'}, + 'postal_code': {'key': 'postalCode', 'type': 'str'}, + 'extended_postal_code': {'key': 'extendedPostalCode', 'type': 'str'}, + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'country': {'key': 'country', 'type': 'str'}, + 'country_code_iso3': {'key': 'countryCodeISO3', 'type': 'str'}, + 'freeform_address': {'key': 'freeformAddress', 'type': 'str'}, + 'country_subdivision_name': {'key': 'countrySubdivisionName', 'type': 'str'}, + 'local_name': {'key': 'localName', 'type': 'str'}, + 'bounding_box': {'key': 'boundingBox', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Address, self).__init__(**kwargs) + self.building_number = None + self.street = None + self.cross_street = None + self.street_number = None + self.route_numbers = None + self.street_name = None + self.street_name_and_number = None + self.municipality = None + self.municipality_subdivision = None + self.country_tertiary_subdivision = None + self.country_secondary_subdivision = None + self.country_subdivision = None + self.postal_code = None + self.extended_postal_code = None + self.country_code = None + self.country = None + self.country_code_iso3 = None + self.freeform_address = None + self.country_subdivision_name = None + self.local_name = None + self.bounding_box = None + + +class AddressRanges(msrest.serialization.Model): + """Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included. + + :param range_left: Address range on the left side of the street. + :type range_left: str + :param range_right: Address range on the right side of the street. + :type range_right: str + :param from_property: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type from_property: ~azure.maps.search.models.LatLongPairAbbreviated + :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. + :type to: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'range_left': {'key': 'rangeLeft', 'type': 'str'}, + 'range_right': {'key': 'rangeRight', 'type': 'str'}, + 'from_property': {'key': 'from', 'type': 'LatLongPairAbbreviated'}, + 'to': {'key': 'to', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + range_left: Optional[str] = None, + range_right: Optional[str] = None, + from_property: Optional["LatLongPairAbbreviated"] = None, + to: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(AddressRanges, self).__init__(**kwargs) + self.range_left = range_left + self.range_right = range_right + self.from_property = from_property + self.to = to + + +class BatchRequest(msrest.serialization.Model): + """This type represents the request body for the Batch service. + + :param batch_items: The list of queries to process. + :type batch_items: list[~azure.maps.search.models.BatchRequestItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestItem]'}, + } + + def __init__( + self, + *, + batch_items: Optional[List["BatchRequestItem"]] = None, + **kwargs + ): + super(BatchRequest, self).__init__(**kwargs) + self.batch_items = batch_items + + +class BatchRequestItem(msrest.serialization.Model): + """Batch request object. + + :param query: This parameter contains a query string used to perform an unstructured geocoding + operation. The query string will be passed verbatim to the search API for processing. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + **kwargs + ): + super(BatchRequestItem, self).__init__(**kwargs) + self.query = query + + +class BatchResult(msrest.serialization.Model): + """This object is returned from a successful Batch service call. Extend with 'batchItems' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + """ + + _validation = { + 'batch_summary': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResult, self).__init__(**kwargs) + self.batch_summary = None + + +class BatchResultItem(msrest.serialization.Model): + """An item returned from Batch API. Extend with 'response' property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchResultSummary(msrest.serialization.Model): + """Summary of the results for the batch request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_requests: Number of successful requests in the batch. + :vartype successful_requests: int + :ivar total_requests: Total number of requests in the batch. + :vartype total_requests: int + """ + + _validation = { + 'successful_requests': {'readonly': True}, + 'total_requests': {'readonly': True}, + } + + _attribute_map = { + 'successful_requests': {'key': 'successfulRequests', 'type': 'int'}, + 'total_requests': {'key': 'totalRequests', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResultSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class BoundingBox(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type top_left: ~azure.maps.search.models.LatLongPairAbbreviated + :param bottom_right: A location represented as a latitude and longitude using short names 'lat' + & 'lon'. + :type bottom_right: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'bottom_right': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + top_left: Optional["LatLongPairAbbreviated"] = None, + bottom_right: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(BoundingBox, self).__init__(**kwargs) + self.top_left = top_left + self.bottom_right = bottom_right + + +class BrandName(msrest.serialization.Model): + """The name of the brand for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the brand. + :vartype name: str + """ + + _validation = { + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BrandName, self).__init__(**kwargs) + self.name = None + + +class Classification(msrest.serialization.Model): + """The classification for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code property. + :vartype code: str + :ivar names: Names array. + :vartype names: list[~azure.maps.search.models.ClassificationName] + """ + + _validation = { + 'code': {'readonly': True}, + 'names': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[ClassificationName]'}, + } + + def __init__( + self, + **kwargs + ): + super(Classification, self).__init__(**kwargs) + self.code = None + self.names = None + + +class ClassificationName(msrest.serialization.Model): + """Name for the classification. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_locale: Name Locale property. + :vartype name_locale: str + :ivar name: Name property. + :vartype name: str + """ + + _validation = { + 'name_locale': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'name_locale': {'key': 'nameLocale', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClassificationName, self).__init__(**kwargs) + self.name_locale = None + self.name = None + + +class DataSource(msrest.serialization.Model): + """Optional section. Reference ids for use with the `Get Search Polygon `_ API. + + :param geometry: Information about the geometric shape of the result. Only present if type == + Geography. + :type geometry: ~azure.maps.search.models.GeometryIdentifier + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeometryIdentifier'}, + } + + def __init__( + self, + *, + geometry: Optional["GeometryIdentifier"] = None, + **kwargs + ): + super(DataSource, self).__init__(**kwargs) + self.geometry = geometry + + +class EntryPoint(msrest.serialization.Model): + """The entry point for the POI being returned. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of entry point. Value can be either *main* or *minor*. Possible values + include: "main", "minor". + :vartype type: str or ~azure.maps.search.models.EntryPointType + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + position: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(EntryPoint, self).__init__(**kwargs) + self.type = None + self.position = position + + +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.search.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.search.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.search.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 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.search.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 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.search.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 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.search.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.search.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 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.search.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 GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + 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.search.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.search.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + 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 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.search.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.search.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.search.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.search.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.search.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.search.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.search.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.search.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.search.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.search.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 GeometryIdentifier(msrest.serialization.Model): + """Information about the geometric shape of the result. Only present if type == Geography. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Pass this as geometryId to the `Get Search Polygon + `_ API to fetch geometry + information for this result. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeometryIdentifier, self).__init__(**kwargs) + self.id = None + + +class LatLongPairAbbreviated(msrest.serialization.Model): + """A location represented as a latitude and longitude using short names 'lat' & 'lon'. + + :param lat: Latitude property. + :type lat: float + :param lon: Longitude property. + :type lon: float + """ + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + *, + lat: Optional[float] = None, + lon: Optional[float] = None, + **kwargs + ): + super(LatLongPairAbbreviated, self).__init__(**kwargs) + self.lat = lat + self.lon = lon + + +class OperatingHours(msrest.serialization.Model): + """Opening hours for a POI (Points of Interest). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mode: Value used in the request: none or "nextSevenDays". + :vartype mode: str + :ivar time_ranges: List of time ranges for the next 7 days. + :vartype time_ranges: list[~azure.maps.search.models.OperatingHoursTimeRange] + """ + + _validation = { + 'mode': {'readonly': True}, + 'time_ranges': {'readonly': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'time_ranges': {'key': 'timeRanges', 'type': '[OperatingHoursTimeRange]'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHours, self).__init__(**kwargs) + self.mode = None + self.time_ranges = None + + +class OperatingHoursTime(msrest.serialization.Model): + """Represents a date and time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar date: Represents current calendar date in POI time zone, e.g. "2019-02-07". + :vartype date: str + :ivar hour: Hours are in the 24 hour format in the local time of a POI; possible values are 0 - + 23. + :vartype hour: int + :ivar minute: Minutes are in the local time of a POI; possible values are 0 - 59. + :vartype minute: int + """ + + _validation = { + 'date': {'readonly': True}, + 'hour': {'readonly': True}, + 'minute': {'readonly': True}, + } + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'hour': {'key': 'hour', 'type': 'int'}, + 'minute': {'key': 'minute', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OperatingHoursTime, self).__init__(**kwargs) + self.date = None + self.hour = None + self.minute = None + + +class OperatingHoursTimeRange(msrest.serialization.Model): + """Open time range for a day. + + :param start_time: The point in the next 7 days range when a given POI is being opened, or the + beginning of the range if it was opened before the range. + :type start_time: ~azure.maps.search.models.OperatingHoursTime + :param end_time: The point in the next 7 days range when a given POI is being closed, or the + beginning of the range if it was closed before the range. + :type end_time: ~azure.maps.search.models.OperatingHoursTime + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'OperatingHoursTime'}, + 'end_time': {'key': 'endTime', 'type': 'OperatingHoursTime'}, + } + + def __init__( + self, + *, + start_time: Optional["OperatingHoursTime"] = None, + end_time: Optional["OperatingHoursTime"] = None, + **kwargs + ): + super(OperatingHoursTimeRange, self).__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + + +class PointOfInterest(msrest.serialization.Model): + """Details of the returned POI including information such as the name, phone, url address, and classifications. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the POI property. + :vartype name: str + :ivar phone: Telephone number property. + :vartype phone: str + :ivar url: Website URL property. + :vartype url: str + :ivar category_set: The list of the most specific POI categories. + :vartype category_set: list[~azure.maps.search.models.PointOfInterestCategorySet] + :ivar classifications: Classification array. + :vartype classifications: list[~azure.maps.search.models.Classification] + :ivar brands: Brands array. The name of the brand for the POI being returned. + :vartype brands: list[~azure.maps.search.models.BrandName] + :param operating_hours: Opening hours for a POI (Points of Interest). + :type operating_hours: ~azure.maps.search.models.OperatingHours + """ + + _validation = { + 'name': {'readonly': True}, + 'phone': {'readonly': True}, + 'url': {'readonly': True}, + 'category_set': {'readonly': True}, + 'classifications': {'readonly': True}, + 'brands': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + 'url': {'key': 'url', 'type': 'str'}, + 'category_set': {'key': 'categorySet', 'type': '[PointOfInterestCategorySet]'}, + 'classifications': {'key': 'classifications', 'type': '[Classification]'}, + 'brands': {'key': 'brands', 'type': '[BrandName]'}, + 'operating_hours': {'key': 'openingHours', 'type': 'OperatingHours'}, + } + + def __init__( + self, + *, + operating_hours: Optional["OperatingHours"] = None, + **kwargs + ): + super(PointOfInterest, self).__init__(**kwargs) + self.name = None + self.phone = None + self.url = None + self.category_set = None + self.classifications = None + self.brands = None + self.operating_hours = operating_hours + + +class PointOfInterestCategory(msrest.serialization.Model): + """POI category result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Unique ID for the category. ID can be used to restrict search results to specific + categories through other Search Service APIs, like `Get Search POI + `_. + :vartype id: int + :ivar name: Name of the category. + :vartype name: str + :ivar child_ids: Array of child category ids. + :vartype child_ids: list[int] + :ivar synonyms: Array of alternative names of the category. + :vartype synonyms: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'child_ids': {'readonly': True}, + 'synonyms': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'child_ids': {'key': 'childCategoryIds', 'type': '[int]'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategory, self).__init__(**kwargs) + self.id = None + self.name = None + self.child_ids = None + self.synonyms = None + + +class PointOfInterestCategorySet(msrest.serialization.Model): + """POI category. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Category ID. + :vartype id: int + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategorySet, self).__init__(**kwargs) + self.id = None + + +class PointOfInterestCategoryTreeResult(msrest.serialization.Model): + """This object is returned from a successful POI Category Tree call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar categories: Categories array. + :vartype categories: list[~azure.maps.search.models.PointOfInterestCategory] + """ + + _validation = { + 'categories': {'readonly': True}, + } + + _attribute_map = { + 'categories': {'key': 'poiCategories', 'type': '[PointOfInterestCategory]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointOfInterestCategoryTreeResult, self).__init__(**kwargs) + self.categories = None + + +class Polygon(msrest.serialization.Model): + """Polygon. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provider_id: ID of the returned entity. + :vartype provider_id: str + :param geometry_data: Geometry data in GeoJSON format. Please refer to `RFC 7946 + `_ for details. Present only if "error" is not present. + :type geometry_data: ~azure.maps.search.models.GeoJsonObject + """ + + _validation = { + 'provider_id': {'readonly': True}, + } + + _attribute_map = { + 'provider_id': {'key': 'providerID', 'type': 'str'}, + 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + *, + geometry_data: Optional["GeoJsonObject"] = None, + **kwargs + ): + super(Polygon, self).__init__(**kwargs) + self.provider_id = None + self.geometry_data = geometry_data + + +class PolygonResult(msrest.serialization.Model): + """This object is returned from a successful Search Polygon call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar polygons: Results array. + :vartype polygons: list[~azure.maps.search.models.Polygon] + """ + + _validation = { + 'polygons': {'readonly': True}, + } + + _attribute_map = { + 'polygons': {'key': 'additionalData', 'type': '[Polygon]'}, + } + + def __init__( + self, + **kwargs + ): + super(PolygonResult, self).__init__(**kwargs) + self.polygons = None + + +class ReverseSearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressReverseResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.ReverseSearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'ReverseSearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class ReverseSearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchAddressBatchItemResponse(ErrorResponse, ReverseSearchAddressResult): + """The result of the query. SearchAddressReverseResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ReverseSearchAddressBatchItemResponse, self).__init__(error=error, **kwargs) + self.summary = None + self.addresses = None + self.error = error + + +class ReverseSearchAddressBatchProcessResult(BatchResult): + """This object is returned from a successful Search Address Reverse Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.ReverseSearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[ReverseSearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressBatchProcessResult, self).__init__(**kwargs) + self.batch_items = None + + +class ReverseSearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + :ivar road_use: + :vartype road_use: list[str or ~azure.maps.search.models.RoadUseType] + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + 'road_use': {'readonly': True}, + 'match_type': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + 'road_use': {'key': 'roadUse', 'type': '[str]'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + self.road_use = None + self.match_type = None + + +class ReverseSearchCrossStreetAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search Address Reverse CrossStreet call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search Address Reverse Cross Street response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.ReverseSearchCrossStreetAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'addresses': {'key': 'addresses', 'type': '[ReverseSearchCrossStreetAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResult, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class ReverseSearchCrossStreetAddressResultItem(msrest.serialization.Model): + """Result object for a Search Address Reverse Cross Street response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReverseSearchCrossStreetAddressResultItem, self).__init__(**kwargs) + self.address = None + self.position = None + + +class SearchAddressBatchItem(BatchResultItem): + """An item returned from Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status_code: HTTP request status code. + :vartype status_code: int + :ivar response: The result of the query. SearchAddressResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchAddressBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'int'}, + 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchAddressResult(msrest.serialization.Model): + """This object is returned from a successful Search calls. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressResult, self).__init__(**kwargs) + self.summary = None + self.results = None + + +class SearchAddressBatchItemResponse(ErrorResponse, SearchAddressResult): + """The result of the query. SearchAddressResponse if the query completed successfully, ErrorResponse otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object for a Search API response. + :vartype summary: ~azure.maps.search.models.SearchSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchAddressResultItem] + :param error: The error object. + :type error: ~azure.maps.search.models.ErrorDetail + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchSummary'}, + 'results': {'key': 'results', 'type': '[SearchAddressResultItem]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(SearchAddressBatchItemResponse, self).__init__(error=error, **kwargs) + self.summary = None + self.results = None + self.error = error + + +class SearchAddressBatchResult(BatchResult): + """This object is returned from a successful Search Address Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar batch_summary: Summary of the results for the batch request. + :vartype batch_summary: ~azure.maps.search.models.BatchResultSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] + """ + + _validation = { + 'batch_summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'batch_summary': {'key': 'summary', 'type': 'BatchResultSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchResult, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressResultItem(msrest.serialization.Model): + """Result object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: One of: + + + * POI + * Street + * Geography + * Point Address + * Address Range + * Cross Street. Possible values include: "POI", "Street", "Geography", "Point Address", + "Address Range", "Cross Street". + :vartype type: str or ~azure.maps.search.models.SearchAddressResultType + :ivar id: Id property. + :vartype id: str + :ivar score: The value within a result set to indicate the relative matching score between + results. You can use this to determine that result x is twice as likely to be as relevant as + result y if the value of x is 2x the value of y. The values vary between queries and is only + meant as a relative value for one result set. + :vartype score: float + :ivar distance_in_meters: Straight line distance between the result and geobias location in + meters. + :vartype distance_in_meters: float + :ivar info: Information about the original data source of the Result. Used for support + requests. + :vartype info: str + :param entity_type: Possible values include: "Country", "CountrySubdivision", + "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", + "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :ivar point_of_interest: Details of the returned POI including information such as the name, + phone, url address, and classifications. + :vartype point_of_interest: ~azure.maps.search.models.PointOfInterest + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.Address + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.LatLongPairAbbreviated + :ivar viewport: The viewport that covers the result represented by the top-left and + bottom-right coordinates of the viewport. + :vartype viewport: ~azure.maps.search.models.BoundingBox + :ivar entry_points: Array of EntryPoints. Those describe the types of entrances available at + the location. The type can be "main" for main entrances such as a front door, or a lobby, and + "minor", for side and back doors. + :vartype entry_points: list[~azure.maps.search.models.EntryPoint] + :ivar address_ranges: Describes the address range on both sides of the street for a search + result. Coordinates for the start and end locations of the address range are included. + :vartype address_ranges: ~azure.maps.search.models.AddressRanges + :ivar data_sources: Optional section. Reference geometry id for use with the `Get Search + Polygon `_ API. + :vartype data_sources: ~azure.maps.search.models.DataSource + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. Possible values include: "AddressPoint", "HouseNumberRange", "Street". + :vartype match_type: str or ~azure.maps.search.models.MatchType + :ivar detour_time: Detour time in seconds. Only returned for calls to the Search Along Route + API. + :vartype detour_time: int + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'score': {'readonly': True}, + 'distance_in_meters': {'readonly': True}, + 'info': {'readonly': True}, + 'point_of_interest': {'readonly': True}, + 'address': {'readonly': True}, + 'viewport': {'readonly': True}, + 'entry_points': {'readonly': True}, + 'address_ranges': {'readonly': True}, + 'data_sources': {'readonly': True}, + 'match_type': {'readonly': True}, + 'detour_time': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'score': {'key': 'score', 'type': 'float'}, + 'distance_in_meters': {'key': 'dist', 'type': 'float'}, + 'info': {'key': 'info', 'type': 'str'}, + 'entity_type': {'key': 'entityType', 'type': 'str'}, + 'point_of_interest': {'key': 'poi', 'type': 'PointOfInterest'}, + 'address': {'key': 'address', 'type': 'Address'}, + 'position': {'key': 'position', 'type': 'LatLongPairAbbreviated'}, + 'viewport': {'key': 'viewport', 'type': 'BoundingBox'}, + 'entry_points': {'key': 'entryPoints', 'type': '[EntryPoint]'}, + 'address_ranges': {'key': 'addressRanges', 'type': 'AddressRanges'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSource'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + 'detour_time': {'key': 'detourTime', 'type': 'int'}, + } + + def __init__( + self, + *, + entity_type: Optional[Union[str, "GeographicEntityType"]] = None, + position: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(SearchAddressResultItem, self).__init__(**kwargs) + self.type = None + self.id = None + self.score = None + self.distance_in_meters = None + self.info = None + self.entity_type = entity_type + self.point_of_interest = None + self.address = None + self.position = position + self.viewport = None + self.entry_points = None + self.address_ranges = None + self.data_sources = None + self.match_type = None + self.detour_time = None + + +class SearchAlongRouteRequest(msrest.serialization.Model): + """This type represents the request body for the Search Along Route service. + + :param route: A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.GeoJsonLineString + """ + + _attribute_map = { + 'route': {'key': 'route', 'type': 'GeoJsonLineString'}, + } + + def __init__( + self, + *, + route: Optional["GeoJsonLineString"] = None, + **kwargs + ): + super(SearchAlongRouteRequest, self).__init__(**kwargs) + self.route = route + + +class SearchInsideGeometryRequest(msrest.serialization.Model): + """This type represents the request body for the Search Inside Geometry service. + + :param geometry: A valid ``GeoJSON`` object. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.search.models.GeoJsonObject + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + *, + geometry: Optional["GeoJsonObject"] = None, + **kwargs + ): + super(SearchInsideGeometryRequest, self).__init__(**kwargs) + self.geometry = geometry + + +class SearchSummary(msrest.serialization.Model): + """Summary object for a Search API response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar query: The query parameter that was used to produce these search results. + :vartype query: str + :ivar query_type: The type of query being returned: NEARBY or NON_NEAR. Possible values + include: "NEARBY", "NON_NEAR". + :vartype query_type: str or ~azure.maps.search.models.QueryType + :ivar query_time: Time spent resolving the query, in milliseconds. + :vartype query_time: int + :ivar num_results: Number of results in the response. + :vartype num_results: int + :ivar top: Maximum number of responses that will be returned. + :vartype top: int + :ivar skip: The starting offset of the returned Results within the full Result set. + :vartype skip: int + :ivar total_results: The total number of Results found. + :vartype total_results: int + :ivar fuzzy_level: The maximum fuzzy level required to provide Results. + :vartype fuzzy_level: int + :ivar geo_bias: Indication when the internal search engine has applied a geospatial bias to + improve the ranking of results. In some methods, this can be affected by setting the lat and + lon parameters where available. In other cases it is purely internal. + :vartype geo_bias: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _validation = { + 'query': {'readonly': True}, + 'query_type': {'readonly': True}, + 'query_time': {'readonly': True}, + 'num_results': {'readonly': True}, + 'top': {'readonly': True}, + 'skip': {'readonly': True}, + 'total_results': {'readonly': True}, + 'fuzzy_level': {'readonly': True}, + 'geo_bias': {'readonly': True}, + } + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + 'query_type': {'key': 'queryType', 'type': 'str'}, + 'query_time': {'key': 'queryTime', 'type': 'int'}, + 'num_results': {'key': 'numResults', 'type': 'int'}, + 'top': {'key': 'limit', 'type': 'int'}, + 'skip': {'key': 'offset', 'type': 'int'}, + 'total_results': {'key': 'totalResults', 'type': 'int'}, + 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, + 'geo_bias': {'key': 'geoBias', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchSummary, self).__init__(**kwargs) + self.query = None + self.query_type = None + self.query_time = None + self.num_results = None + self.top = None + self.skip = None + self.total_results = None + self.fuzzy_level = None + self.geo_bias = None + + +class Viewport(msrest.serialization.Model): + """The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport. + + :param top_left_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type top_left_point: ~azure.maps.search.models.LatLongPairAbbreviated + :param btm_right_point: A location represented as a latitude and longitude using short names + 'lat' & 'lon'. + :type btm_right_point: ~azure.maps.search.models.LatLongPairAbbreviated + """ + + _attribute_map = { + 'top_left_point': {'key': 'topLeftPoint', 'type': 'LatLongPairAbbreviated'}, + 'btm_right_point': {'key': 'btmRightPoint', 'type': 'LatLongPairAbbreviated'}, + } + + def __init__( + self, + *, + top_left_point: Optional["LatLongPairAbbreviated"] = None, + btm_right_point: Optional["LatLongPairAbbreviated"] = None, + **kwargs + ): + super(Viewport, self).__init__(**kwargs) + self.top_left_point = top_left_point + self.btm_right_point = btm_right_point diff --git a/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py b/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py new file mode 100644 index 000000000000..580b063fa8a3 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py @@ -0,0 +1,242 @@ +# 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 ElectricVehicleConnector(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: These are the standard household connectors for a certain region. They are all AC single phase + #: and the standard Voltage and standard Amperage. + #: + #: See also: `Plug & socket types - World Standards + #: `_. + STANDARD_HOUSEHOLD_COUNTRY_SPECIFIC = "StandardHouseholdCountrySpecific" + #: Type 1 connector as defined in the IEC 62196-2 standard. Also called Yazaki after the original + #: manufacturer or SAE J1772 after the standard that first published it. Mostly used in + #: combination with 120V single phase or up to 240V single phase infrastructure. + IEC62196_TYPE1 = "IEC62196Type1" + #: Type 1 based combo connector as defined in the IEC 62196-3 standard. The connector is based on + #: the Type 1 connector – as defined in the IEC 62196-2 standard – with two additional direct + #: current (DC) contacts to allow DC fast charging. + IEC62196_TYPE1_CCS = "IEC62196Type1CCS" + #: Type 2 connector as defined in the IEC 62196-2 standard. Provided as a cable and plug attached + #: to the charging point. + IEC62196_TYPE2_CABLE_ATTACHED = "IEC62196Type2CableAttached" + #: Type 2 connector as defined in the IEC 62196-2 standard. Provided as a socket set into the + #: charging point. + IEC62196_TYPE2_OUTLET = "IEC62196Type2Outlet" + #: Type 2 based combo connector as defined in the IEC 62196-3 standard. The connector is based on + #: the Type 2 connector – as defined in the IEC 62196-2 standard – with two additional direct + #: current (DC) contacts to allow DC fast charging. + IEC62196_TYPE2_CCS = "IEC62196Type2CCS" + #: Type 3 connector as defined in the IEC 62196-2 standard. Also called Scame after the original + #: manufacturer. Mostly used in combination with up to 240V single phase or up to 420V three phase + #: infrastructure. + IEC62196_TYPE3 = "IEC62196Type3" + #: CHAdeMO connector named after an association formed by the Tokyo Electric Power Company and + #: industrial partners. Because of this is is also known as the TEPCO's connector. It supports + #: fast DC charging. + CHADEMO = "Chademo" + #: Industrial Blue connector is a connector defined in the IEC 60309 standard. It is sometime + #: referred to as by some combination of the standard, the color and the fact that is a single + #: phase connector. The connector usually has the "P+N+E, 6h" configuration. + IEC60309_AC1_PHASE_BLUE = "IEC60309AC1PhaseBlue" + #: Industrial White connector is a DC connector defined in the IEC 60309 standard. + IEC60309_DC_WHITE = "IEC60309DCWhite" + #: The Tesla connector is the regionally specific Tesla Supercharger connector. I.e. it refers to + #: either Tesla's proprietary connector, sometimes referred to as Tesla Port mostly limited to + #: North America or the modified Type 2 (DC over Type 2) in Europe. + TESLA = "Tesla" + +class EntryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of entry point. Value can be either *main* or *minor*. + """ + + MAIN = "main" + MINOR = "minor" + +class GeographicEntityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + COUNTRY = "Country" + COUNTRY_SUBDIVISION = "CountrySubdivision" + COUNTRY_SECONDARY_SUBDIVISION = "CountrySecondarySubdivision" + COUNTRY_TERTIARY_SUBDIVISION = "CountryTertiarySubdivision" + MUNICIPALITY = "Municipality" + MUNICIPALITY_SUBDIVISION = "MunicipalitySubdivision" + NEIGHBOURHOOD = "Neighbourhood" + POSTAL_CODE_AREA = "PostalCodeArea" + +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 JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class LocalizedMapView(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: United Arab Emirates (Arabic View). + AE = "AE" + #: Argentina (Argentinian View). + AR = "AR" + #: Bahrain (Arabic View). + BH = "BH" + #: India (Indian View). + IN_ENUM = "IN" + #: Iraq (Arabic View). + IQ = "IQ" + #: Jordan (Arabic View). + JO = "JO" + #: Kuwait (Arabic View). + KW = "KW" + #: Lebanon (Arabic View). + LB = "LB" + #: Morocco (Moroccan View). + MA = "MA" + #: Oman (Arabic View). + OM = "OM" + #: Pakistan (Pakistani View). + PK = "PK" + #: Palestinian Authority (Arabic View). + PS = "PS" + #: Qatar (Arabic View). + QA = "QA" + #: Saudi Arabia (Arabic View). + SA = "SA" + #: Syria (Arabic View). + SY = "SY" + #: Yemen (Arabic View). + YE = "YE" + #: Return the map data based on the IP address of the request. + AUTO = "Auto" + #: Unified View (Others). + UNIFIED = "Unified" + +class MatchType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Types of match for a reverse address search operation. + """ + + ADDRESS_POINT = "AddressPoint" + HOUSE_NUMBER_RANGE = "HouseNumberRange" + STREET = "Street" + +class OperatingHoursRange(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Shows the hours of operation for the next week, starting with the current day in the local time + #: of the POI. + NEXT_SEVEN_DAYS = "nextSevenDays" + +class PointOfInterestExtendedPostalCodes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + POI = "POI" + NONE = "None" + +class QueryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of query being returned: NEARBY or NON_NEAR. + """ + + #: Search was performed around a certain latitude and longitude with a defined radius. + NEARBY = "NEARBY" + #: Search was performed globally, without biasing to a certain latitude and longitude, and no + #: defined radius. + GLOBAL_ENUM = "NON_NEAR" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +class RoadUseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the possible uses of a road. + """ + + LIMITED_ACCESS = "LimitedAccess" + ARTERIAL = "Arterial" + TERMINAL = "Terminal" + RAMP = "Ramp" + ROTARY = "Rotary" + LOCAL_STREET = "LocalStreet" + +class SearchAddressResultType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """One of: + + + * POI + * Street + * Geography + * Point Address + * Address Range + * Cross Street + """ + + POI = "POI" + STREET = "Street" + GEOGRAPHY = "Geography" + POINT_ADDRESS = "Point Address" + ADDRESS_RANGE = "Address Range" + CROSS_STREET = "Cross Street" + +class SearchIndexes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Address range interpolation. + ADDRESS = "Addr" + #: Geographies. + GEOGRAPHIES = "Geo" + #: Point Addresses. + POINT_ADDRESSES = "PAD" + #: Points of interest. + POINTS_OF_INTEREST = "POI" + #: Streets. + STREETS = "Str" + #: Cross Streets (Intersections). + CROSS_STREETS = "Xstr" diff --git a/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py new file mode 100644 index 000000000000..c7f640e252e1 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._search_operations import SearchOperations + +__all__ = [ + 'SearchOperations', +] diff --git a/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py b/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py new file mode 100644 index 000000000000..e8316ebd9612 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py @@ -0,0 +1,5287 @@ +# 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SearchOperations(object): + """SearchOperations 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.search.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_polygons( + self, + geometry_ids, # type: List[str] + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PolygonResult" + """**Get Polygon** + + **Applies to**\ : S1 pricing tier. + + The Get Polygon service allows you to request the geometry data such as a city or country + outline for a set of entities, previously retrieved from an Online Search request in GeoJSON + format. The geometry ID is returned in the sourceGeometry object under "geometry" and "id" in + either a Search Address or Search Fuzzy call. + + Please note that any geometry ID retrieved from an Online Search endpoint has a limited + lifetime. The client should not store geometry IDs in persistent storage for later referral, + as the stability of these identifiers is not guaranteed for a long period of time. It is + expected that a request to the Polygon method is made within a few minutes of the request to + the Online Search method that provided the ID. The service allows for batch requests up to 20 + identifiers. + + :param geometry_ids: Comma separated list of geometry UUIDs, previously retrieved from an + Online Search request. + :type geometry_ids: list[str] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PolygonResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PolygonResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PolygonResult"] + 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.list_polygons.metadata['url'] # type: ignore + path_format_arguments = { + '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['geometries'] = self._serialize.query("geometry_ids", geometry_ids, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PolygonResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_polygons.metadata = {'url': '/search/polygon/{format}'} # type: ignore + + def fuzzy_search( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + min_fuzzy_level=None, # type: Optional[int] + max_fuzzy_level=None, # type: Optional[int] + index_filter=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Free Form Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + The basic default API is Free Form Search which handles the most fuzzy of inputs handling any + combination of address or POI tokens. This search API is the canonical 'single line search'. + The Free Form Search API is a seamless combination of POI search and geocoding. The API can + also be weighted with a contextual position (lat./lon. pair), or fully constrained by a + coordinate and radius, or it can be executed more generally without any geo biasing anchor + point.:code:`
`:code:`
`We strongly advise you to use the 'countrySet' parameter to + specify only the countries for which your application needs coverage, as the default behavior + will be to search the entire world, potentially returning unnecessary + results.:code:`
`:code:`
` E.g.: ``countrySet``\ =US,FR :code:`
`:code:`
`Please + see `Search Coverage + `_ for a complete + list of all the supported countries.:code:`
`:code:`
`Most Search queries default to + ``maxFuzzyLevel``\ =2 to gain performance and also reduce unusual results. This new default can + be overridden as needed per request by passing in the query param ``maxFuzzyLevel``\ =3 or 4. + + :param query: The applicable query string (e.g., "seattle", "pizza"). Can *also* be specified + as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, + -122.125679"). Must be properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param min_fuzzy_level: Minimum fuzziness level to be used. Default: 1, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type min_fuzzy_level: int + :param max_fuzzy_level: Maximum fuzziness level to be used. Default: 2, minimum: 1 and maximum: + 4 + + + * + Level 1 has no spell checking. + + * + Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to + "restaurant." + + * + Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell + checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" + to "mountain view" matching. + + * + Level 4 doesn’t add any more spell checking functions. + + The search engine will start looking for a match on the level defined by minFuzzyLevel, and + will stop searching at the level specified by maxFuzzyLevel. + :type max_fuzzy_level: int + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.fuzzy_search.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if min_fuzzy_level is not None: + query_parameters['minFuzzyLevel'] = self._serialize.query("min_fuzzy_level", min_fuzzy_level, 'int', maximum=4, minimum=1) + if max_fuzzy_level is not None: + query_parameters['maxFuzzyLevel'] = self._serialize.query("max_fuzzy_level", max_fuzzy_level, 'int', maximum=4, minimum=1) + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore + + def search_point_of_interest( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.PointOfInterestExtendedPostalCodes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Get POI by Name** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Search allows you to request POI results by name. Search supports + additional query parameters such as language and filtering results by area of interest driven + by country or bounding box. Endpoint will return only POI results matching the query string. + Response includes POI details such as address, coordinate location and category. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **POI** = Points of Interest + + Value should be **POI** or **None** to disable extended postal codes. + + By default extended postal codes are included. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.PointOfInterestExtendedPostalCodes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest.metadata = {'url': '/search/poi/{format}'} # type: ignore + + def search_nearby_point_of_interest( + self, + lat, # type: float + lon, # type: float + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + radius_in_meters=None, # type: Optional[int] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Nearby Search** + + **Applies to**\ : S0 and S1 pricing tiers. + + If you have a use case for only retrieving POI results around a specific location, the nearby + search method may be the right choice. This endpoint will only return POI results, and does not + take in a search query parameter. + + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area, Min value is 1, Max Value is 50000. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_nearby_point_of_interest.metadata['url'] # type: ignore + path_format_arguments = { + '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("lat", lat, 'float') + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_nearby_point_of_interest.metadata = {'url': '/search/nearby/{format}'} # type: ignore + + def search_point_of_interest_category( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + category_filter=None, # type: Optional[List[int]] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + brand_filter=None, # type: Optional[List[str]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Get POI by Category** + + **Applies to**\ : S0 and S1 pricing tiers. + + Points of Interest (POI) Category Search allows you to request POI results from given category. + Search allows to query POIs from one category at a time. Endpoint will only return POI results + which are categorized as specified. Response includes POI details such as address, coordinate + location and classification. + + :param query: The POI category to search for (e.g., "AIRPORT", "RESTAURANT"), must be properly + URL encoded. Supported main categories can be requested by calling `Get Search POI Category + Tree API `_. List of available categories can also be + found `here `_. We + recommend to use POI Search Category Tree API to request the supported categories. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_point_of_interest_category.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_point_of_interest_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore + + def get_point_of_interest_category_tree( + self, + format="json", # type: Union[str, "_models.JsonFormat"] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.PointOfInterestCategoryTreeResult" + """**Get POI Category Tree** + + **Applies to**\ : S0 and S1 pricing tiers. + + POI Category API provides a full list of supported Points of Interest (POI) categories and + subcategories together with their translations and synonyms. The returned content can be used + to provide more meaningful results through other Search Service APIs, like `Get Search POI + `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, except NGT and NGT-Latn. Language tag is case insensitive. When + data in specified language is not available for a specific field, default language is used + (English). + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointOfInterestCategoryTreeResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.PointOfInterestCategoryTreeResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointOfInterestCategoryTreeResult"] + 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_of_interest_category_tree.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('PointOfInterestCategoryTreeResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_of_interest_category_tree.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore + + def search_address( + self, + query, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + is_type_ahead=None, # type: Optional[bool] + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + country_filter=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius_in_meters=None, # type: Optional[int] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + In many cases, the complete search service might be too much, for instance if you are only + interested in traditional geocoding. Search can also be accessed for address look up + exclusively. The geocoding is performed by hitting the geocode endpoint with just the address + or partial address in question. The geocoding search index will be queried for everything above + the street level data. No POIs will be returned. Note that the geocoder is very tolerant of + typos and incomplete addresses. It will also handle everything from exact street addresses or + street or intersections as well as higher level geographies such as city centers, counties, + states etc. + + :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be + properly URL encoded. + :type query: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param is_type_ahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type is_type_ahead: bool + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param country_filter: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_filter: list[str] + :param lat: Latitude where results should be biased. E.g. 37.337. + :type lat: float + :param lon: Longitude where results should be biased. E.g. -121.89. + :type lon: float + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param top_left: Top left position of the bounding box. E.g. 37.553,-122.453. + :type top_left: str + :param btm_right: Bottom right position of the bounding box. E.g. 37.553,-122.453. + :type btm_right: str + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_address.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if is_type_ahead is not None: + query_parameters['typeahead'] = self._serialize.query("is_type_ahead", is_type_ahead, 'bool') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if country_filter is not None: + query_parameters['countrySet'] = self._serialize.query("country_filter", country_filter, '[str]', div=',') + if lat is not None: + query_parameters['lat'] = self._serialize.query("lat", lat, 'float') + if lon is not None: + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if top_left is not None: + query_parameters['topLeft'] = self._serialize.query("top_left", top_left, 'str') + if btm_right is not None: + query_parameters['btmRight'] = self._serialize.query("btm_right", btm_right, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address.metadata = {'url': '/search/address/{format}'} # type: ignore + + def reverse_search_address( + self, + query, # type: List[float] + format="json", # type: Union[str, "_models.ResponseFormat"] + language=None, # type: Optional[str] + include_speed_limit=None, # type: Optional[bool] + heading=None, # type: Optional[int] + radius_in_meters=None, # type: Optional[int] + number=None, # type: Optional[str] + include_road_use=None, # type: Optional[bool] + road_use=None, # type: Optional[List[Union[str, "_models.RoadUseType"]]] + allow_freeform_newline=None, # type: Optional[bool] + include_match_type=None, # type: Optional[bool] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.ReverseSearchAddressResult" + """**Reverse Geocode to an Address** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable street address. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. This endpoint will return address information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param include_speed_limit: Boolean. To enable return of the posted speed limit. + :type include_speed_limit: bool + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param number: If a number is sent in along with the request, the response may include the side + of the street (Left/Right) and also an offset position for that number. + :type number: str + :param include_road_use: Boolean. To enable return of the road use array for reverse geocodes + at street level. + :type include_road_use: bool + :param road_use: To restrict reverse geocodes to a certain type of road use. The road use array + for reverse geocodes can be one or more of LimitedAccess, Arterial, Terminal, Ramp, Rotary, + LocalStreet. + :type road_use: list[str or ~azure.maps.search.models.RoadUseType] + :param allow_freeform_newline: Format of newlines in the formatted address. + + If true, the address will contain newlines. + If false, newlines will be converted to commas. + :type allow_freeform_newline: bool + :param include_match_type: Include information on the type of match the geocoder achieved in + the response. + :type include_match_type: bool + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressResult"] + 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.reverse_search_address.metadata['url'] # type: ignore + path_format_arguments = { + '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, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if include_speed_limit is not None: + query_parameters['returnSpeedLimit'] = self._serialize.query("include_speed_limit", include_speed_limit, 'bool') + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if number is not None: + query_parameters['number'] = self._serialize.query("number", number, 'str') + if include_road_use is not None: + query_parameters['returnRoadUse'] = self._serialize.query("include_road_use", include_road_use, 'bool') + if road_use is not None: + query_parameters['roadUse'] = self._serialize.query("road_use", road_use, '[str]', div=',') + if allow_freeform_newline is not None: + query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') + if include_match_type is not None: + query_parameters['returnMatchType'] = self._serialize.query("include_match_type", include_match_type, 'bool') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ReverseSearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore + + def reverse_search_cross_street_address( + self, + query, # type: List[float] + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + heading=None, # type: Optional[int] + radius_in_meters=None, # type: Optional[int] + language=None, # type: Optional[str] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.ReverseSearchCrossStreetAddressResult" + """**Reverse Geocode to a Cross Street** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you need to translate a coordinate (example: 37.786505, -122.3862) + into a human understandable cross street. Most often this is needed in tracking applications + where you receive a GPS feed from the device or asset and wish to know what address where the + coordinate is located. + This endpoint will return cross street information for a given coordinate. + + :param query: The applicable query specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param heading: The directional heading of the vehicle in degrees, for travel along a segment + of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can + include upto one decimal place. + :type heading: int + :param radius_in_meters: The radius in meters to for the results to be constrained to the + defined area. + :type radius_in_meters: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchCrossStreetAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchCrossStreetAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchCrossStreetAddressResult"] + 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.reverse_search_cross_street_address.metadata['url'] # type: ignore + path_format_arguments = { + '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, '[float]', div=',') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'int', maximum=360, minimum=-360) + if radius_in_meters is not None: + query_parameters['radius'] = self._serialize.query("radius_in_meters", radius_in_meters, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('ReverseSearchCrossStreetAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_cross_street_address.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore + + def search_structured_address( + self, + format="json", # type: Union[str, "_models.ResponseFormat"] + language=None, # type: Optional[str] + country_code="US", # type: str + top=None, # type: Optional[int] + skip=None, # type: Optional[int] + street_number=None, # type: Optional[str] + street_name=None, # type: Optional[str] + cross_street=None, # type: Optional[str] + municipality=None, # type: Optional[str] + municipality_subdivision=None, # type: Optional[str] + country_tertiary_subdivision=None, # type: Optional[str] + country_secondary_subdivision=None, # type: Optional[str] + country_subdivision=None, # type: Optional[str] + postal_code=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + entity_type=None, # type: Optional[Union[str, "_models.GeographicEntityType"]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Structured Address Geocoding** + + **Applies to**\ : S0 and S1 pricing tiers. + + Azure Address Geocoding can also be accessed for structured address look up exclusively. The + geocoding search index will be queried for everything above the street level data. No POIs + will be returned. Note that the geocoder is very tolerant of typos and incomplete addresses. + It will also handle everything from exact street addresses or street or intersections as well + as higher level geographies such as city centers, counties, states etc. + + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param country_code: The 2 or 3 letter `ISO3166-1 + `_ country code portion of an address. E.g. + US. + :type country_code: str + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param skip: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type skip: int + :param street_number: The street number portion of an address. + :type street_number: str + :param street_name: The street name portion of an address. + :type street_name: str + :param cross_street: The cross street name for the structured address. + :type cross_street: str + :param municipality: The municipality portion of an address. + :type municipality: str + :param municipality_subdivision: The municipality subdivision (sub/super city) for the + structured address. + :type municipality_subdivision: str + :param country_tertiary_subdivision: The named area for the structured address. + :type country_tertiary_subdivision: str + :param country_secondary_subdivision: The county for the structured address. + :type country_secondary_subdivision: str + :param country_subdivision: The country subdivision portion of an address. + :type country_subdivision: str + :param postal_code: The postal code portion of an address. + :type postal_code: str + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param entity_type: Specifies the level of filtering performed on geographies. Narrows the + search for specified geography entity types, e.g. return only municipality. The resulting + response will contain the geography ID as well as the entity type matched. If you provide more + than one entity as a comma separated list, endpoint will return the 'smallest entity + available'. Returned Geometry ID can be used to get the geometry of that geography via `Get + Search Polygon `_ API. The + following parameters are ignored when entityType is set: + + + * heading + * number + * returnRoadUse + * returnSpeedLimit + * roadUse + * returnMatchType. + :type entity_type: str or ~azure.maps.search.models.GeographicEntityType + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_structured_address.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if skip is not None: + query_parameters['ofs'] = self._serialize.query("skip", skip, 'int', maximum=1900, minimum=0) + if street_number is not None: + query_parameters['streetNumber'] = self._serialize.query("street_number", street_number, 'str') + if street_name is not None: + query_parameters['streetName'] = self._serialize.query("street_name", street_name, 'str') + if cross_street is not None: + query_parameters['crossStreet'] = self._serialize.query("cross_street", cross_street, 'str') + if municipality is not None: + query_parameters['municipality'] = self._serialize.query("municipality", municipality, 'str') + if municipality_subdivision is not None: + query_parameters['municipalitySubdivision'] = self._serialize.query("municipality_subdivision", municipality_subdivision, 'str') + if country_tertiary_subdivision is not None: + query_parameters['countryTertiarySubdivision'] = self._serialize.query("country_tertiary_subdivision", country_tertiary_subdivision, 'str') + if country_secondary_subdivision is not None: + query_parameters['countrySecondarySubdivision'] = self._serialize.query("country_secondary_subdivision", country_secondary_subdivision, 'str') + if country_subdivision is not None: + query_parameters['countrySubdivision'] = self._serialize.query("country_subdivision", country_subdivision, 'str') + if postal_code is not None: + query_parameters['postalCode'] = self._serialize.query("postal_code", postal_code, 'str') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_structured_address.metadata = {'url': '/search/address/structured/{format}'} # type: ignore + + def search_inside_geometry( + self, + query, # type: str + geometry, # type: "_models.SearchInsideGeometryRequest" + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + language=None, # type: Optional[str] + category_filter=None, # type: Optional[List[int]] + extended_postal_codes_for=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + index_filter=None, # type: Optional[List[Union[str, "_models.SearchIndexes"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Geometry endpoint allows you to perform a free form search inside a single geometry + or many of them. The search results that fall inside the geometry/geometries will be + returned.:code:`
`:code:`
`To send the geometry you will use a ``POST`` request where the + request body will contain the ``geometry`` object represented as a ``GeoJSON`` type and the + ``Content-Type`` header will be set to ``application/json``. The geographical features to be + searched can be modeled as Polygon and/or Circle geometries represented using any one of the + following ``GeoJSON`` types::code:`
  • **GeoJSON FeatureCollection**
    The `geometry` can + be represented as a `GeoJSON FeatureCollection` object. This is the recommended option if the + geometry contains both Polygons and Circles. The `FeatureCollection` can contain a max of 50 + `GeoJSON Feature` objects. Each `Feature` object should represent either a Polygon or a Circle + with the following conditions:
    • A `Feature` object for the + Polygon geometry can have a max of 50 coordinates and it's properties must be empty.
    • A + `Feature` object for the Circle geometry is composed of a _center_ represented using a `GeoJSON + Point` type and a _radius_ value (in meters) which must be specified in the object's properties + along with the _subType_ property whose value should be 'Circle'.
    `:code:`
    ` Please + see the Examples section below for a sample ``FeatureCollection`` + representation.:code:`
    `:code:`
    `
  • :code:`
  • **GeoJSON GeometryCollection**
    The + `geometry` can be represented as a `GeoJSON GeometryCollection` object. This is the recommended + option if the geometry contains a list of Polygons only. The `GeometryCollection` can contain a + max of 50 `GeoJSON Polygon` objects. Each `Polygon` object can have a max of 50 coordinates. + Please see the Examples section below for a sample `GeometryCollection` + representation.

  • `:code:`
  • **GeoJSON Polygon**
    The `geometry` can be + represented as a `GeoJSON Polygon` object. This is the recommended option if the geometry + contains a single Polygon. The `Polygon` object can have a max of 50 coordinates. Please see + the Examples section below for a sample `Polygon` + representation.

  • `
.:code:`
`:code:`
`. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param geometry: This represents the geometry for one or more geographical features (parks, + state boundary etc.) to search in and should be a GeoJSON compliant type. Please refer to `RFC + 7946 `_ for details. + :type geometry: ~azure.maps.search.models.SearchInsideGeometryRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type top: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param extended_postal_codes_for: Indexes for which extended postal codes should be included in + the results. + + Available indexes are: + + **Addr** = Address ranges + + **Geo** = Geographies + + **PAD** = Point Addresses + + **POI** = Points of Interest + + **Str** = Streets + + **XStr** = Cross Streets (intersections) + + Value should be a comma separated list of index types (in any order) or **None** for no + indexes. + + By default extended postal codes are included for all indexes except Geo. Extended postal code + lists for geographies can be quite long so they have to be explicitly requested when needed. + + Usage examples: + + extendedPostalCodesFor=POI + + extendedPostalCodesFor=PAD,Addr,POI + + extendedPostalCodesFor=None + + Extended postal code is returned as an **extendedPostalCode** property of an address. + Availability is region-dependent. + :type extended_postal_codes_for: list[str or ~azure.maps.search.models.SearchIndexes] + :param index_filter: A comma separated list of indexes which should be utilized for the search. + Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = + Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross + Streets (intersections). + :type index_filter: list[str or ~azure.maps.search.models.SearchIndexes] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_inside_geometry.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=100, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if extended_postal_codes_for is not None: + query_parameters['extendedPostalCodesFor'] = self._serialize.query("extended_postal_codes_for", extended_postal_codes_for, '[str]', div=',') + if index_filter is not None: + query_parameters['idxSet'] = self._serialize.query("index_filter", index_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(geometry, 'SearchInsideGeometryRequest') + 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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore + + def search_along_route( + self, + query, # type: str + max_detour_time, # type: int + route, # type: "_models.SearchAlongRouteRequest" + format="json", # type: Union[str, "_models.ResponseFormat"] + top=None, # type: Optional[int] + brand_filter=None, # type: Optional[List[str]] + category_filter=None, # type: Optional[List[int]] + electric_vehicle_connector_filter=None, # type: Optional[List[Union[str, "_models.ElectricVehicleConnector"]]] + localized_map_view=None, # type: Optional[Union[str, "_models.LocalizedMapView"]] + operating_hours=None, # type: Optional[Union[str, "_models.OperatingHoursRange"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressResult" + """**Applies to**\ : S0 and S1 pricing tiers. + + The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified + route. This search is constrained by specifying the ``maxDetourTime`` limiting + measure.:code:`
`:code:`
`To send the route-points you will use a ``POST`` request where + the request body will contain the ``route`` object represented as a ``GeoJSON LineString`` type + and the ``Content-Type`` header will be set to ``application/json``. Each route-point in + ``route`` is represented as a ``GeoJSON Position`` type i.e. an array where the *longitude* + value is followed by the *latitude* value and the *altitude* value is ignored. The ``route`` + should contain at least 2 route-points.:code:`
`:code:`
`It is possible that original + route will be altered, some of it's points may be skipped. If the route that passes through the + found point is faster than the original one, the ``detourTime`` value in the response is + negative. + + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param max_detour_time: Maximum detour time of the point of interest in seconds. Max value is + 3600 seconds. + :type max_detour_time: int + :param route: This represents the route to search along and should be a valid ``GeoJSON + LineString`` type. Please refer to `RFC 7946 + `_ for details. + :type route: ~azure.maps.search.models.SearchAlongRouteRequest + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param top: Maximum number of responses that will be returned. Default value is 10. Max value + is 20. + :type top: int + :param brand_filter: A comma-separated list of brand names which could be used to restrict the + result to specific brands. Item order does not matter. When multiple brands are provided, only + results that belong to (at least) one of the provided list will be returned. Brands that + contain a "," in their name should be put into quotes. + + Usage examples: + + brandSet=Foo + + brandSet=Foo,Bar + + brandSet="A,B,C Comma",Bar. + :type brand_filter: list[str] + :param category_filter: A comma-separated list of category set IDs which could be used to + restrict the result to specific Points of Interest categories. ID order does not matter. When + multiple category identifiers are provided, only POIs that belong to (at least) one of the + categories from the provided list will be returned. The list of supported categories can be + discovered using  `POI Categories API `_. Usage + examples: + + + * + **categorySet=7315**\  (Search Points of Interest from category Restaurant) + + * + **categorySet=7315025,7315017**\  (Search Points of Interest of category either Italian or + French Restaurant). + :type category_filter: list[int] + :param electric_vehicle_connector_filter: A comma-separated list of connector types which could + be used to restrict the result to Electric Vehicle Station supporting specific connector types. + Item order does not matter. When multiple connector types are provided, only results that + belong to (at least) one of the provided list will be returned. + + Available connector types are: + + + * ``StandardHouseholdCountrySpecific`` - These are the standard household connectors for a + certain region. They are all AC single phase and the standard Voltage and standard Amperage. + See also: `Plug & socket types - World Standards + `_. + * ``IEC62196Type1`` - Type 1 connector as defined in the IEC 62196-2 standard. Also called + Yazaki after the original manufacturer or SAE J1772 after the standard that first published it. + Mostly used in combination with 120V single phase or up to 240V single phase infrastructure. + * ``IEC62196Type1CCS`` - Type 1 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 1 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type2CableAttached`` - Type 2 connector as defined in the IEC 62196-2 standard. + Provided as a cable and plug attached to the charging point. + * ``IEC62196Type2Outlet`` - Type 2 connector as defined in the IEC 62196-2 standard. Provided + as a socket set into the charging point. + * ``IEC62196Type2CCS`` - Type 2 based combo connector as defined in the IEC 62196-3 standard. + The connector is based on the Type 2 connector – as defined in the IEC 62196-2 standard – with + two additional direct current (DC) contacts to allow DC fast charging. + * ``IEC62196Type3`` - Type 3 connector as defined in the IEC 62196-2 standard. Also called + Scame after the original manufacturer. Mostly used in combination with up to 240V single phase + or up to 420V three phase infrastructure. + * ``Chademo`` - CHAdeMO connector named after an association formed by the Tokyo Electric + Power Company and industrial partners. Because of this is is also known as the TEPCO's + connector. It supports fast DC charging. + * ``IEC60309AC1PhaseBlue`` - Industrial Blue connector is a connector defined in the IEC 60309 + standard. It is sometime referred to as by some combination of the standard, the color and the + fact that is a single phase connector. The connector usually has the "P+N+E, 6h" configuration. + * ``IEC60309DCWhite`` - Industrial White connector is a DC connector defined in the IEC 60309 + standard. + * ``Tesla`` - The Tesla connector is the regionally specific Tesla Supercharger connector. + I.e. it refers to either Tesla's proprietary connector, sometimes referred to as Tesla Port + mostly limited to North America or the modified Type 2 (DC over Type 2) in Europe. + + Usage examples: + + connectorSet=IEC62196Type2CableAttached + connectorSet=IEC62196Type2Outlet,IEC62196Type2CableAttached. + :type electric_vehicle_connector_filter: list[str or ~azure.maps.search.models.ElectricVehicleConnector] + :param localized_map_view: The View parameter (also called the "user region" parameter) allows + you to show the correct maps for a certain country/region for geopolitically disputed regions. + Different countries have different views of such regions, and the View parameter allows your + application to comply with the view required by the country your application will be serving. + By default, the View parameter is set to “Unified” even if you haven’t defined it in the + request. It is your responsibility to determine the location of your users, and then set the + View parameter correctly for that location. Alternatively, you have the option to set + ‘View=Auto’, which will return the map data based on the IP address of the request. The View + parameter in Azure Maps must be used in compliance with applicable laws, including those + regarding mapping, of the country where maps, images and other data and third party content + that you are authorized to access via Azure Maps is made available. Example: view=IN. + + Please refer to `Supported Views `_ for details and + to see the available Views. + :type localized_map_view: str or ~azure.maps.search.models.LocalizedMapView + :param operating_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. If not passed, then no opening hours + information will be returned. + Supported value: nextSevenDays. + :type operating_hours: str or ~azure.maps.search.models.OperatingHoursRange + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressResult"] + 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.search_along_route.metadata['url'] # type: ignore + path_format_arguments = { + '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') + query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) + if top is not None: + query_parameters['limit'] = self._serialize.query("top", top, 'int', maximum=20) + if brand_filter is not None: + query_parameters['brandSet'] = self._serialize.query("brand_filter", brand_filter, '[str]', div=',') + if category_filter is not None: + query_parameters['categorySet'] = self._serialize.query("category_filter", category_filter, '[int]', div=',') + if electric_vehicle_connector_filter is not None: + query_parameters['connectorSet'] = self._serialize.query("electric_vehicle_connector_filter", electric_vehicle_connector_filter, '[str]', div=',') + if localized_map_view is not None: + query_parameters['view'] = self._serialize.query("localized_map_view", localized_map_view, 'str') + if operating_hours is not None: + query_parameters['openingHours'] = self._serialize.query("operating_hours", operating_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(route, 'SearchAlongRouteRequest') + 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('SearchAddressResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore + + def fuzzy_search_batch_sync( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressBatchResult" + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.fuzzy_search_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + 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('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + fuzzy_search_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore + + def _fuzzy_search_batch_initial( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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._fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def begin_fuzzy_search_batch( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of search fuzzy queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._fuzzy_search_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def _get_fuzzy_search_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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_fuzzy_search_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_fuzzy_search_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def begin_get_fuzzy_search_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Fuzzy Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Fuzzy API + `_ using just a single API + call. You can call Search Address Fuzzy Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/fuzzy/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search fuzzy* queries you will use a ``POST`` request where the request body will + contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will be set + to ``application/json``. Here's a sample request body containing 5 *search fuzzy* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=atm&lat=47.639769&lon=-122.128362&radius=5000&limit=5"}, + {"query": "?query=Statue Of Liberty&limit=2"}, + {"query": "?query=Starbucks&lat=47.639769&lon=-122.128362&radius=5000"}, + {"query": "?query=Space Needle"}, + {"query": "?query=pizza&limit=10"} + ] + } + + A *search fuzzy* query in a batch is just a partial URL *without* the protocol, base URL, path, + api-version and subscription-key. It can accept any of the supported *search fuzzy* `URI + parameters `_. + The string values in the *search fuzzy* query must be properly escaped (e.g. " character should + be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/fuzzy/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "atm" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "ATM at Wells Fargo" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "3240 157th Ave NE, Redmond, WA 98052" + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "statue of liberty" + }, + "results": [ + { + "type": "POI", + "poi": { + "name": "Statue of Liberty" + }, + "address": { + "country": "United States Of America", + "freeformAddress": "New York, NY 10004" + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._get_fuzzy_search_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_fuzzy_search_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def search_address_batch_sync( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressBatchResult" + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + 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('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore + + def _search_address_batch_initial( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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._search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def begin_search_address_batch( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of address geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def _get_search_address_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResult"]] + 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_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def begin_get_search_address_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResult"] + """**Search Address Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address API + `_ using just a single API + call. You can call Search Address Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address* queries you will use a ``POST`` request where the request body + will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header will + be set to ``application/json``. Here's a sample request body containing 5 *search address* + queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=400 Broad St, Seattle, WA 98109&limit=3"}, + {"query": "?query=One, Microsoft Way, Redmond, WA 98052&limit=3"}, + {"query": "?query=350 5th Ave, New York, NY 10118&limit=1"}, + {"query": "?query=Pike Pl, Seattle, WA + 98101&lat=47.610970&lon=-122.342469&radius=1000"}, + {"query": "?query=Champ de Mars, 5 Avenue Anatole France, 75007 Paris, + France&limit=1"} + ] + } + + A *search address* query in a batch is just a partial URL *without* the protocol, base URL, + path, api-version and subscription-key. It can accept any of the supported *search address* + `URI parameters + `_. The string + values in the *search address* query must be properly escaped (e.g. " character should be + escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressResponse`` + `_ - If + the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "query": "one microsoft way redmond wa 98052" + }, + "results": [ + { + "position": { + "lat": 47.63989, + "lon": -122.12509 + } + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "query": "pike pl seattle wa 98101" + }, + "results": [ + { + "position": { + "lat": 47.60963, + "lon": -122.34215 + } + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 SearchAddressBatchResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResult"] + 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._get_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SearchAddressBatchResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def reverse_search_address_batch_sync( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ReverseSearchAddressBatchProcessResult" + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReverseSearchAddressBatchProcessResult, or the result of cls(response) + :rtype: ~azure.maps.search.models.ReverseSearchAddressBatchProcessResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 408: lambda response: HttpResponseError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + 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.reverse_search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + 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('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + reverse_search_address_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore + + def _reverse_search_address_batch_initial( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ReverseSearchAddressBatchProcessResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + 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._reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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(batch_request, 'BatchRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def begin_reverse_search_address_batch( + self, + batch_request, # type: "_models.BatchRequest" + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ReverseSearchAddressBatchProcessResult"] + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_request: The list of reverse geocoding queries/requests to process. The list can + contain a max of 10,000 queries and must contain at least 1 query. + :type batch_request: ~azure.maps.search.models.BatchRequest + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.JsonFormat + :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 ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + 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._reverse_search_address_batch_initial( + batch_request=batch_request, + format=format, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("format", format, '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_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def _get_reverse_search_address_batch_initial( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ReverseSearchAddressBatchProcessResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReverseSearchAddressBatchProcessResult"]] + 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_reverse_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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, 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: + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _get_reverse_search_address_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def begin_get_reverse_search_address_batch( + self, + batch_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ReverseSearchAddressBatchProcessResult"] + """**Search Address Reverse Batch API** + + **Applies to**\ : S1 pricing tier. + + The Search Address Batch API sends batches of queries to `Search Address Reverse API + `_ using just a single + API call. You can call Search Address Reverse Batch API to run either asynchronously (async) or + synchronously (sync). The async API allows caller to batch up to **10,000** queries and sync + API up to **100** queries. + + Submit Synchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Synchronous API is recommended for lightweight batch requests. When the service receives a + request, it will respond as soon as the batch items are calculated and there will be no + possibility to retrieve the results later. The Synchronous API will return a timeout error (a + 408 response) if the request takes longer than 60 seconds. The number of batch items is limited + to **100** for this API. + + .. code-block:: + + POST + https://atlas.microsoft.com/search/address/reverse/batch/sync/json?api-version=1.0&subscription-key={subscription-key} + + Submit Asynchronous Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Asynchronous API is appropriate for processing big volumes of relatively complex search + requests + + + * It allows the retrieval of results in a separate call (multiple downloads are possible). + * The asynchronous API is optimized for reliability and is not expected to run into a timeout. + * The number of batch items is limited to **10,000** for this API. + + When you make a request by using async request, by default the service returns a 202 response + code along a redirect URL in the Location field of the response header. This URL should be + checked periodically until the response data or error information is available. + The asynchronous responses are stored for **14** days. The redirect URL returns a 404 response + if used after the expiration period. + + Please note that asynchronous batch request is a long-running request. Here's a typical + sequence of operations: + + + #. Client sends a Search Address Batch ``POST`` request to Azure Maps + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request has been accepted. + + HTTP ``Error`` - There was an error processing your Batch request. This could either be a + ``400 Bad Request`` or any other ``Error`` status code. + + + #. + If the batch request was accepted successfully, the ``Location`` header in the response + contains the URL to download the results of the batch request. + This status URI looks like following: + + .. code-block:: + + GET + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + + #. Client issues a ``GET`` request on the *download URL* obtained in Step 3 to download the + batch results. + + POST Body for Batch Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To send the *search address reverse* queries you will use a ``POST`` request where the request + body will contain the ``batchItems`` array in ``json`` format and the ``Content-Type`` header + will be set to ``application/json``. Here's a sample request body containing 5 *search address + reverse* queries: + + .. code-block:: json + + { + "batchItems": [ + {"query": "?query=48.858561,2.294911"}, + {"query": "?query=47.639765,-122.127896&radius=5000&limit=2"}, + {"query": "?query=47.621028,-122.348170"}, + {"query": "?query=43.722990,10.396695"}, + {"query": "?query=40.750958,-73.982336"} + ] + } + + A *search address reverse* query in a batch is just a partial URL *without* the protocol, base + URL, path, api-version and subscription-key. It can accept any of the supported *search address + reverse* `URI parameters + `_. The + string values in the *search address reverse* query must be properly escaped (e.g. " character + should be escaped with ) and it should also be properly URL-encoded. + + The async API allows caller to batch up to **10,000** queries and sync API up to **100** + queries, and the batch should contain at least **1** query. + + Download Asynchronous Batch Results + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To download the async batch results you will issue a ``GET`` request to the batch download + endpoint. This *download URL* can be obtained from the ``Location`` header of a successful + ``POST`` batch request and looks like the following: + + .. code-block:: + + https://atlas.microsoft.com/search/address/reverse/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key} + + Here's the typical sequence of operations for downloading the batch results: + + + #. Client sends a ``GET`` request using the *download URL*. + #. + The server will respond with one of the following: + + .. + + HTTP ``202 Accepted`` - Batch request was accepted but is still being processed. Please + try again in some time. + + HTTP ``200 OK`` - Batch request successfully processed. The response body contains all + the batch results. + + + Batch Response Model + ^^^^^^^^^^^^^^^^^^^^ + + The returned data content is similar for async and sync requests. When downloading the results + of an async batch request, if the batch has finished processing, the response body contains the + batch response. This batch response contains a ``summary`` component that indicates the + ``totalRequests`` that were part of the original batch request and ``successfulRequests``\ i.e. + queries which were executed successfully. The batch response also includes a ``batchItems`` + array which contains a response for each and every query in the batch request. The + ``batchItems`` will contain the results in the exact same order the original queries were sent + in the batch request. Each item in ``batchItems`` contains ``statusCode`` and ``response`` + fields. Each ``response`` in ``batchItems`` is of one of the following types: + + + * + `\ ``SearchAddressReverseResponse`` + `_ + - If the query completed successfully. + + * + ``Error`` - If the query failed. The response will contain a ``code`` and a ``message`` in + this case. + + Here's a sample Batch Response with 2 *successful* and 1 *failed* result: + + .. code-block:: json + + { + "summary": { + "successfulRequests": 2, + "totalRequests": 3 + }, + "batchItems": [ + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 11 + }, + "addresses": [ + { + "address": { + "country": "France", + "freeformAddress": "Avenue Anatole France, 75007 Paris" + }, + "position": "48.858490,2.294820" + } + ] + } + }, + { + "statusCode": 200, + "response": + { + "summary": { + "queryTime": 1 + }, + "addresses": [ + { + "address": { + "country": "United States of America", + "freeformAddress": "157th Pl NE, Redmond WA 98052" + }, + "position": "47.640470,-122.129430" + } + ] + } + }, + { + "statusCode": 400, + "response": + { + "error": + { + "code": "400 BadRequest", + "message": "Bad request: one or more parameters were incorrectly + specified or are mutually exclusive." + } + } + } + ] + }. + + :param batch_id: Batch id for querying the operation. + :type batch_id: 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 ReverseSearchAddressBatchProcessResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.ReverseSearchAddressBatchProcessResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReverseSearchAddressBatchProcessResult"] + 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._get_reverse_search_address_batch_initial( + batch_id=batch_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReverseSearchAddressBatchProcessResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'format': self._serialize.url("batch_id", batch_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, 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_get_reverse_search_address_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-search/azure/maps/search/py.typed b/sdk/maps/azure-maps-search/azure/maps/search/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-search/sdk_packaging.toml b/sdk/maps/azure-maps-search/sdk_packaging.toml new file mode 100644 index 000000000000..8460703a0925 --- /dev/null +++ b/sdk/maps/azure-maps-search/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-search" +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-search/setup.cfg b/sdk/maps/azure-maps-search/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-search/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-search/setup.py b/sdk/maps/azure-maps-search/setup.py new file mode 100644 index 000000000000..2a2db158393a --- /dev/null +++ b/sdk/maps/azure-maps-search/setup.py @@ -0,0 +1,90 @@ +#!/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-search" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-timezone/CHANGELOG.md b/sdk/maps/azure-maps-timezone/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-timezone/LICENSE.txt b/sdk/maps/azure-maps-timezone/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-timezone/MANIFEST.in b/sdk/maps/azure-maps-timezone/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-timezone/README.md b/sdk/maps/azure-maps-timezone/README.md new file mode 100644 index 000000000000..b4df8e37b701 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/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.6+. +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-timezone%2FREADME.png) diff --git a/sdk/maps/azure-maps-timezone/_meta.json b/sdk/maps/azure-maps-timezone/_meta.json new file mode 100644 index 000000000000..c6797a699a7b --- /dev/null +++ b/sdk/maps/azure-maps-timezone/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Timezone/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/Timezone/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-timezone/azure/__init__.py b/sdk/maps/azure-maps-timezone/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-timezone/azure/maps/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/__init__.py new file mode 100644 index 000000000000..bea826c89ee9 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/__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 ._timezone_client import TimezoneClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['TimezoneClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/_configuration.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_configuration.py new file mode 100644 index 000000000000..55cf0a4ed38b --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class TimezoneClientConfiguration(Configuration): + """Configuration for TimezoneClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(TimezoneClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-timezone/{}'.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-timezone/azure/maps/timezone/_metadata.json b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_metadata.json new file mode 100644 index 000000000000..340651fe9d1f --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "TimezoneClient", + "filename": "_timezone_client", + "description": "Azure Maps Time Zone REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"TimezoneClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"TimezoneClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "timezone": "TimezoneOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/_timezone_client.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_timezone_client.py new file mode 100644 index 000000000000..dd68f433701a --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_timezone_client.py @@ -0,0 +1,85 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import TimezoneClientConfiguration +from .operations import TimezoneOperations +from . import models + + +class TimezoneClient(object): + """Azure Maps Time Zone REST APIs. + + :ivar timezone: TimezoneOperations operations + :vartype timezone: azure.maps.timezone.operations.TimezoneOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = TimezoneClientConfiguration(credential, client_id, **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.timezone = TimezoneOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> TimezoneClient + 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-timezone/azure/maps/timezone/_version.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/__init__.py new file mode 100644 index 000000000000..49b1f48f6354 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/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 ._timezone_client import TimezoneClient +__all__ = ['TimezoneClient'] diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_configuration.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_configuration.py new file mode 100644 index 000000000000..a6b600a00fd1 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 TimezoneClientConfiguration(Configuration): + """Configuration for TimezoneClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(TimezoneClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-timezone/{}'.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-timezone/azure/maps/timezone/aio/_timezone_client.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_timezone_client.py new file mode 100644 index 000000000000..e95c1894c441 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_timezone_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 TimezoneClientConfiguration +from .operations import TimezoneOperations +from .. import models + + +class TimezoneClient(object): + """Azure Maps Time Zone REST APIs. + + :ivar timezone: TimezoneOperations operations + :vartype timezone: azure.maps.timezone.aio.operations.TimezoneOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = TimezoneClientConfiguration(credential, client_id, **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.timezone = TimezoneOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "TimezoneClient": + 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-timezone/azure/maps/timezone/aio/operations/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/__init__.py new file mode 100644 index 000000000000..622b33ee2679 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._timezone_operations import TimezoneOperations + +__all__ = [ + 'TimezoneOperations', +] diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/_timezone_operations.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/_timezone_operations.py new file mode 100644 index 000000000000..412fd7f034b2 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/_timezone_operations.py @@ -0,0 +1,495 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TimezoneOperations: + """TimezoneOperations 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.timezone.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_timezone_by_id( + self, + timezone_id: str, + accept_language: Optional[str] = None, + options: Optional[Union[str, "_models.TimezoneOptions"]] = None, + time_stamp: Optional[datetime.datetime] = None, + daylight_savings_time_from: Optional[datetime.datetime] = None, + daylight_savings_time_lasting_years: Optional[int] = None, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.TimezoneResult": + """**Time Zone by Id** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns current, historical, and future time zone information for the specified IANA + time zone ID. + + :param timezone_id: The IANA time zone ID. + :type timezone_id: str + :param accept_language: Specifies the language code in which the timezone names should be + returned. If no language code is provided, the response will be in "EN". Please refer to + `Supported Languages `_ + for details. + :type accept_language: str + :param options: Alternatively, use alias "o". Options available for types of information + returned in the result. + :type options: str or ~azure.maps.timezone.models.TimezoneOptions + :param time_stamp: Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + API will use the machine time serving the request. + :type time_stamp: ~datetime.datetime + :param daylight_savings_time_from: Alternatively, use alias "tf". The start date from which + daylight savings time (DST) transitions are requested, only applies when "options" = all or + "options" = transitions. + :type daylight_savings_time_from: ~datetime.datetime + :param daylight_savings_time_lasting_years: Alternatively, use alias "ty". The number of years + from "transitionsFrom" for which DST transitions are requested, only applies when "options" = + all or "options" = transitions. + :type daylight_savings_time_lasting_years: int + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneResult"] + 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_timezone_by_id.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if options is not None: + query_parameters['options'] = self._serialize.query("options", options, 'str') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'iso-8601') + if daylight_savings_time_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("daylight_savings_time_from", daylight_savings_time_from, 'iso-8601') + if daylight_savings_time_lasting_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("daylight_savings_time_lasting_years", daylight_savings_time_lasting_years, 'int') + query_parameters['query'] = self._serialize.query("timezone_id", timezone_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + if accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("accept_language", accept_language, '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('TimezoneResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_by_id.metadata = {'url': '/timezone/byId/{format}'} # type: ignore + + async def get_timezone_by_coordinates( + self, + coordinates: List[float], + accept_language: Optional[str] = None, + options: Optional[Union[str, "_models.TimezoneOptions"]] = None, + time_stamp: Optional[datetime.datetime] = None, + daylight_savings_time_from: Optional[datetime.datetime] = None, + daylight_savings_time_lasting_years: Optional[int] = None, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.TimezoneResult": + """**Time Zone by Coordinates** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns current, historical, and future time zone information for a specified + latitude-longitude pair. In addition, the API provides sunset and sunrise times for a given + location. + + :param coordinates: Coordinates of the point for which time zone information is requested. This + parameter is a list of coordinates, containing a pair of coordinate(lat, long). When this + endpoint is called directly, coordinates are passed in as a single string containing + coordinates, separated by commas. + :type coordinates: list[float] + :param accept_language: Specifies the language code in which the timezone names should be + returned. If no language code is provided, the response will be in "EN". Please refer to + `Supported Languages `_ + for details. + :type accept_language: str + :param options: Alternatively, use alias "o". Options available for types of information + returned in the result. + :type options: str or ~azure.maps.timezone.models.TimezoneOptions + :param time_stamp: Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + API will use the machine time serving the request. + :type time_stamp: ~datetime.datetime + :param daylight_savings_time_from: Alternatively, use alias "tf". The start date from which + daylight savings time (DST) transitions are requested, only applies when "options" = all or + "options" = transitions. + :type daylight_savings_time_from: ~datetime.datetime + :param daylight_savings_time_lasting_years: Alternatively, use alias "ty". The number of years + from "transitionsFrom" for which DST transitions are requested, only applies when "options" = + all or "options" = transitions. + :type daylight_savings_time_lasting_years: int + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneResult"] + 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_timezone_by_coordinates.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if options is not None: + query_parameters['options'] = self._serialize.query("options", options, 'str') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'iso-8601') + if daylight_savings_time_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("daylight_savings_time_from", daylight_savings_time_from, 'iso-8601') + if daylight_savings_time_lasting_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("daylight_savings_time_lasting_years", daylight_savings_time_lasting_years, 'int') + query_parameters['query'] = self._serialize.query("coordinates", coordinates, '[float]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + if accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("accept_language", accept_language, '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('TimezoneResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_by_coordinates.metadata = {'url': '/timezone/byCoordinates/{format}'} # type: ignore + + async def get_windows_timezone_ids( + self, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> List["_models.TimezoneWindows"]: + """**Windows Time Zones** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns a full list of Windows Time Zone IDs. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TimezoneWindows, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.TimezoneWindows] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TimezoneWindows"]] + 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_windows_timezone_ids.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('[TimezoneWindows]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_windows_timezone_ids.metadata = {'url': '/timezone/enumWindows/{format}'} # type: ignore + + async def get_iana_timezone_ids( + self, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> List["_models.IanaId"]: + """**IANA Time Zones** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns a full list of IANA time zone IDs. Updates to the IANA service will be + reflected in the system within one day. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of IanaId, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.IanaId] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.IanaId"]] + 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_iana_timezone_ids.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('[IanaId]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_iana_timezone_ids.metadata = {'url': '/timezone/enumIana/{format}'} # type: ignore + + async def get_iana_version( + self, + format: Union[str, "_models.JsonFormat"] = "json", + **kwargs: Any + ) -> "_models.TimezoneIanaVersionResult": + """**Time Zone IANA Version** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns the current IANA version number as Metadata. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneIanaVersionResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneIanaVersionResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneIanaVersionResult"] + 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_iana_version.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TimezoneIanaVersionResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_iana_version.metadata = {'url': '/timezone/ianaVersion/{format}'} # type: ignore + + async def convert_windows_timezone_to_iana( + self, + windows_timezone_id: str, + format: Union[str, "_models.JsonFormat"] = "json", + windows_territory_code: Optional[str] = None, + **kwargs: Any + ) -> List["_models.IanaId"]: + """**Windows to IANA Time Zone** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns a corresponding IANA ID, given a valid Windows Time Zone ID. Multiple IANA IDs + may be returned for a single Windows ID. It is possible to narrow these results by adding an + optional territory parameter. + + :param windows_timezone_id: The Windows time zone ID. + :type windows_timezone_id: str + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :param windows_territory_code: Windows Time Zone territory code. + :type windows_territory_code: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of IanaId, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.IanaId] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.IanaId"]] + 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.convert_windows_timezone_to_iana.metadata['url'] # type: ignore + path_format_arguments = { + '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("windows_timezone_id", windows_timezone_id, 'str') + if windows_territory_code is not None: + query_parameters['territory'] = self._serialize.query("windows_territory_code", windows_territory_code, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('[IanaId]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + convert_windows_timezone_to_iana.metadata = {'url': '/timezone/windowsToIana/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/__init__.py new file mode 100644 index 000000000000..06589d0c257f --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/__init__.py @@ -0,0 +1,59 @@ +# 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 CountryRecord + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import IanaId + from ._models_py3 import ReferenceTime + from ._models_py3 import RepresentativePoint + from ._models_py3 import TimeTransition + from ._models_py3 import TimezoneIanaVersionResult + from ._models_py3 import TimezoneId + from ._models_py3 import TimezoneNames + from ._models_py3 import TimezoneResult + from ._models_py3 import TimezoneWindows +except (SyntaxError, ImportError): + from ._models import CountryRecord # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import IanaId # type: ignore + from ._models import ReferenceTime # type: ignore + from ._models import RepresentativePoint # type: ignore + from ._models import TimeTransition # type: ignore + from ._models import TimezoneIanaVersionResult # type: ignore + from ._models import TimezoneId # type: ignore + from ._models import TimezoneNames # type: ignore + from ._models import TimezoneResult # type: ignore + from ._models import TimezoneWindows # type: ignore + +from ._timezone_client_enums import ( + JsonFormat, + TimezoneOptions, +) + +__all__ = [ + 'CountryRecord', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'IanaId', + 'ReferenceTime', + 'RepresentativePoint', + 'TimeTransition', + 'TimezoneIanaVersionResult', + 'TimezoneId', + 'TimezoneNames', + 'TimezoneResult', + 'TimezoneWindows', + 'JsonFormat', + 'TimezoneOptions', +] diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models.py new file mode 100644 index 000000000000..4c0f3b9ea816 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models.py @@ -0,0 +1,507 @@ +# 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 CountryRecord(msrest.serialization.Model): + """A country record. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Country Name. + :vartype name: str + :ivar code: ISO-3166 2-letter country code for the country. + :vartype code: str + """ + + _validation = { + 'name': {'readonly': True}, + 'code': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'Name', 'type': 'str'}, + 'code': {'key': 'Code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CountryRecord, self).__init__(**kwargs) + self.name = None + self.code = None + + +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.timezone.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.timezone.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.timezone.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 IanaId(msrest.serialization.Model): + """IanaId. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id property. + :vartype id: str + :ivar is_alias: IsAlias property. + :vartype is_alias: bool + :ivar alias_of: AliasOf property. + :vartype alias_of: str + :ivar has_zone1970_location: This attribute returns ``True`` if the IanaId has any country/zone + associated with it. + :vartype has_zone1970_location: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'is_alias': {'readonly': True}, + 'alias_of': {'readonly': True}, + 'has_zone1970_location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'Id', 'type': 'str'}, + 'is_alias': {'key': 'IsAlias', 'type': 'bool'}, + 'alias_of': {'key': 'AliasOf', 'type': 'str'}, + 'has_zone1970_location': {'key': 'HasZone1970Location', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(IanaId, self).__init__(**kwargs) + self.id = None + self.is_alias = None + self.alias_of = None + self.has_zone1970_location = None + + +class ReferenceTime(msrest.serialization.Model): + """Details in effect at the local time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tag: Time zone name in effect at the reference timestamp (i.e. PST or PDT depending + whether Daylight Savings Time is in effect). + :vartype tag: str + :ivar standard_offset: UTC offset in effect at the ``ReferenceUTCTimestamp``. + :vartype standard_offset: str + :ivar daylight_savings: Time saving in minutes in effect at the ``ReferenceUTCTimestamp``. + :vartype daylight_savings: str + :ivar wall_time: Current wall time at the given time zone as shown in the ``Tag`` property. + :vartype wall_time: str + :ivar posix_tz_valid_year: The year this POSIX string is valid for. Note: A POSIX string will + only be valid in the given year. + :vartype posix_tz_valid_year: int + :ivar posix_tz: POSIX string used to set the time zone environment variable. + :vartype posix_tz: str + :ivar sunrise: Sunrise at the given time zone as shown in the ``Tag`` property. The sunrise is + described in the ISO8601 format. (Only be populated if the call is byCoordinates). + :vartype sunrise: ~datetime.datetime + :ivar sunset: Sunset at the given time zone as shown in the ``Tag`` property. The sunset is + described in the ISO8601 format.(Only be populated if the call is byCoordinates). + :vartype sunset: ~datetime.datetime + """ + + _validation = { + 'tag': {'readonly': True}, + 'standard_offset': {'readonly': True}, + 'daylight_savings': {'readonly': True}, + 'wall_time': {'readonly': True}, + 'posix_tz_valid_year': {'readonly': True}, + 'posix_tz': {'readonly': True}, + 'sunrise': {'readonly': True}, + 'sunset': {'readonly': True}, + } + + _attribute_map = { + 'tag': {'key': 'Tag', 'type': 'str'}, + 'standard_offset': {'key': 'StandardOffset', 'type': 'str'}, + 'daylight_savings': {'key': 'DaylightSavings', 'type': 'str'}, + 'wall_time': {'key': 'WallTime', 'type': 'str'}, + 'posix_tz_valid_year': {'key': 'PosixTzValidYear', 'type': 'int'}, + 'posix_tz': {'key': 'PosixTz', 'type': 'str'}, + 'sunrise': {'key': 'Sunrise', 'type': 'iso-8601'}, + 'sunset': {'key': 'Sunset', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(ReferenceTime, self).__init__(**kwargs) + self.tag = None + self.standard_offset = None + self.daylight_savings = None + self.wall_time = None + self.posix_tz_valid_year = None + self.posix_tz = None + self.sunrise = None + self.sunset = None + + +class RepresentativePoint(msrest.serialization.Model): + """Representative point property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar latitude: Latitude property. + :vartype latitude: float + :ivar longitude: Longitude property. + :vartype longitude: float + """ + + _validation = { + 'latitude': {'readonly': True}, + 'longitude': {'readonly': True}, + } + + _attribute_map = { + 'latitude': {'key': 'Latitude', 'type': 'float'}, + 'longitude': {'key': 'Longitude', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RepresentativePoint, self).__init__(**kwargs) + self.latitude = None + self.longitude = None + + +class TimeTransition(msrest.serialization.Model): + """TimeTransition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tag: Tag property. + :vartype tag: str + :ivar standard_offset: StandardOffset property. + :vartype standard_offset: str + :ivar daylight_savings: DaylightSavings property. + :vartype daylight_savings: str + :ivar utc_start: Start date, start time for this transition period. + :vartype utc_start: ~datetime.datetime + :ivar utc_end: End date, end time for this transition period. + :vartype utc_end: ~datetime.datetime + """ + + _validation = { + 'tag': {'readonly': True}, + 'standard_offset': {'readonly': True}, + 'daylight_savings': {'readonly': True}, + 'utc_start': {'readonly': True}, + 'utc_end': {'readonly': True}, + } + + _attribute_map = { + 'tag': {'key': 'Tag', 'type': 'str'}, + 'standard_offset': {'key': 'StandardOffset', 'type': 'str'}, + 'daylight_savings': {'key': 'DaylightSavings', 'type': 'str'}, + 'utc_start': {'key': 'UtcStart', 'type': 'iso-8601'}, + 'utc_end': {'key': 'UtcEnd', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TimeTransition, self).__init__(**kwargs) + self.tag = None + self.standard_offset = None + self.daylight_savings = None + self.utc_start = None + self.utc_end = None + + +class TimezoneIanaVersionResult(msrest.serialization.Model): + """This object is returned from a successful Timezone IANA Version call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Version property. + :vartype version: str + """ + + _validation = { + 'version': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneIanaVersionResult, self).__init__(**kwargs) + self.version = None + + +class TimezoneId(msrest.serialization.Model): + """TimezoneId. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id property. + :vartype id: str + :ivar aliases: An array of time zone ID aliases.  Only returned when [options]=\ *zoneinfo* or + *all*. + + Note: may be null. + :vartype aliases: list[str] + :ivar countries: An array of country records. Only returned when [options]=\ *zoneinfo* or + *all*. + :vartype countries: list[~azure.maps.timezone.models.CountryRecord] + :param names: Timezone names object. + :type names: ~azure.maps.timezone.models.TimezoneNames + :ivar reference_time: Details in effect at the local time. + :vartype reference_time: ~azure.maps.timezone.models.ReferenceTime + :ivar representative_point: Representative point property. + :vartype representative_point: ~azure.maps.timezone.models.RepresentativePoint + :ivar time_transitions: Time zone DST transitions from [transitionsFrom] until timestamp + 1 + year. + :vartype time_transitions: list[~azure.maps.timezone.models.TimeTransition] + """ + + _validation = { + 'id': {'readonly': True}, + 'aliases': {'readonly': True}, + 'countries': {'readonly': True}, + 'reference_time': {'readonly': True}, + 'representative_point': {'readonly': True}, + 'time_transitions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'Id', 'type': 'str'}, + 'aliases': {'key': 'Aliases', 'type': '[str]'}, + 'countries': {'key': 'Countries', 'type': '[CountryRecord]'}, + 'names': {'key': 'Names', 'type': 'TimezoneNames'}, + 'reference_time': {'key': 'ReferenceTime', 'type': 'ReferenceTime'}, + 'representative_point': {'key': 'RepresentativePoint', 'type': 'RepresentativePoint'}, + 'time_transitions': {'key': 'TimeTransitions', 'type': '[TimeTransition]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneId, self).__init__(**kwargs) + self.id = None + self.aliases = None + self.countries = None + self.names = kwargs.get('names', None) + self.reference_time = None + self.representative_point = None + self.time_transitions = None + + +class TimezoneNames(msrest.serialization.Model): + """Timezone names object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar iso6391_language_code: The ISO 639-1 language code of the Names. + :vartype iso6391_language_code: str + :ivar generic: Generic Name. + :vartype generic: str + :ivar standard: Standard Name. + :vartype standard: str + :ivar daylight: Daylight Name. + :vartype daylight: str + """ + + _validation = { + 'iso6391_language_code': {'readonly': True}, + 'generic': {'readonly': True}, + 'standard': {'readonly': True}, + 'daylight': {'readonly': True}, + } + + _attribute_map = { + 'iso6391_language_code': {'key': 'ISO6391LanguageCode', 'type': 'str'}, + 'generic': {'key': 'Generic', 'type': 'str'}, + 'standard': {'key': 'Standard', 'type': 'str'}, + 'daylight': {'key': 'Daylight', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneNames, self).__init__(**kwargs) + self.iso6391_language_code = None + self.generic = None + self.standard = None + self.daylight = None + + +class TimezoneResult(msrest.serialization.Model): + """This object is returned from a successful Timezone By ID call or By Coordinates call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Version property. + :vartype version: str + :ivar reference_utc_timestamp: Reference Utc Timestamp property. + :vartype reference_utc_timestamp: ~datetime.datetime + :ivar time_zones: TimeZoneId array. + :vartype time_zones: list[~azure.maps.timezone.models.TimezoneId] + """ + + _validation = { + 'version': {'readonly': True}, + 'reference_utc_timestamp': {'readonly': True}, + 'time_zones': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str'}, + 'reference_utc_timestamp': {'key': 'ReferenceUtcTimestamp', 'type': 'iso-8601'}, + 'time_zones': {'key': 'TimeZones', 'type': '[TimezoneId]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneResult, self).__init__(**kwargs) + self.version = None + self.reference_utc_timestamp = None + self.time_zones = None + + +class TimezoneWindows(msrest.serialization.Model): + """TimezoneWindows. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar windows_id: Windows Id property. + :vartype windows_id: str + :ivar territory: Territory property. + :vartype territory: str + :param iana_ids: IanaIds array. + :type iana_ids: list[str] + """ + + _validation = { + 'windows_id': {'readonly': True}, + 'territory': {'readonly': True}, + } + + _attribute_map = { + 'windows_id': {'key': 'WindowsId', 'type': 'str'}, + 'territory': {'key': 'Territory', 'type': 'str'}, + 'iana_ids': {'key': 'IanaIds', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneWindows, self).__init__(**kwargs) + self.windows_id = None + self.territory = None + self.iana_ids = kwargs.get('iana_ids', None) diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models_py3.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models_py3.py new file mode 100644 index 000000000000..74216d23bac0 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models_py3.py @@ -0,0 +1,515 @@ +# 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 List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CountryRecord(msrest.serialization.Model): + """A country record. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Country Name. + :vartype name: str + :ivar code: ISO-3166 2-letter country code for the country. + :vartype code: str + """ + + _validation = { + 'name': {'readonly': True}, + 'code': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'Name', 'type': 'str'}, + 'code': {'key': 'Code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CountryRecord, self).__init__(**kwargs) + self.name = None + self.code = None + + +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.timezone.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.timezone.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.timezone.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 IanaId(msrest.serialization.Model): + """IanaId. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id property. + :vartype id: str + :ivar is_alias: IsAlias property. + :vartype is_alias: bool + :ivar alias_of: AliasOf property. + :vartype alias_of: str + :ivar has_zone1970_location: This attribute returns ``True`` if the IanaId has any country/zone + associated with it. + :vartype has_zone1970_location: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'is_alias': {'readonly': True}, + 'alias_of': {'readonly': True}, + 'has_zone1970_location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'Id', 'type': 'str'}, + 'is_alias': {'key': 'IsAlias', 'type': 'bool'}, + 'alias_of': {'key': 'AliasOf', 'type': 'str'}, + 'has_zone1970_location': {'key': 'HasZone1970Location', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(IanaId, self).__init__(**kwargs) + self.id = None + self.is_alias = None + self.alias_of = None + self.has_zone1970_location = None + + +class ReferenceTime(msrest.serialization.Model): + """Details in effect at the local time. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tag: Time zone name in effect at the reference timestamp (i.e. PST or PDT depending + whether Daylight Savings Time is in effect). + :vartype tag: str + :ivar standard_offset: UTC offset in effect at the ``ReferenceUTCTimestamp``. + :vartype standard_offset: str + :ivar daylight_savings: Time saving in minutes in effect at the ``ReferenceUTCTimestamp``. + :vartype daylight_savings: str + :ivar wall_time: Current wall time at the given time zone as shown in the ``Tag`` property. + :vartype wall_time: str + :ivar posix_tz_valid_year: The year this POSIX string is valid for. Note: A POSIX string will + only be valid in the given year. + :vartype posix_tz_valid_year: int + :ivar posix_tz: POSIX string used to set the time zone environment variable. + :vartype posix_tz: str + :ivar sunrise: Sunrise at the given time zone as shown in the ``Tag`` property. The sunrise is + described in the ISO8601 format. (Only be populated if the call is byCoordinates). + :vartype sunrise: ~datetime.datetime + :ivar sunset: Sunset at the given time zone as shown in the ``Tag`` property. The sunset is + described in the ISO8601 format.(Only be populated if the call is byCoordinates). + :vartype sunset: ~datetime.datetime + """ + + _validation = { + 'tag': {'readonly': True}, + 'standard_offset': {'readonly': True}, + 'daylight_savings': {'readonly': True}, + 'wall_time': {'readonly': True}, + 'posix_tz_valid_year': {'readonly': True}, + 'posix_tz': {'readonly': True}, + 'sunrise': {'readonly': True}, + 'sunset': {'readonly': True}, + } + + _attribute_map = { + 'tag': {'key': 'Tag', 'type': 'str'}, + 'standard_offset': {'key': 'StandardOffset', 'type': 'str'}, + 'daylight_savings': {'key': 'DaylightSavings', 'type': 'str'}, + 'wall_time': {'key': 'WallTime', 'type': 'str'}, + 'posix_tz_valid_year': {'key': 'PosixTzValidYear', 'type': 'int'}, + 'posix_tz': {'key': 'PosixTz', 'type': 'str'}, + 'sunrise': {'key': 'Sunrise', 'type': 'iso-8601'}, + 'sunset': {'key': 'Sunset', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(ReferenceTime, self).__init__(**kwargs) + self.tag = None + self.standard_offset = None + self.daylight_savings = None + self.wall_time = None + self.posix_tz_valid_year = None + self.posix_tz = None + self.sunrise = None + self.sunset = None + + +class RepresentativePoint(msrest.serialization.Model): + """Representative point property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar latitude: Latitude property. + :vartype latitude: float + :ivar longitude: Longitude property. + :vartype longitude: float + """ + + _validation = { + 'latitude': {'readonly': True}, + 'longitude': {'readonly': True}, + } + + _attribute_map = { + 'latitude': {'key': 'Latitude', 'type': 'float'}, + 'longitude': {'key': 'Longitude', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RepresentativePoint, self).__init__(**kwargs) + self.latitude = None + self.longitude = None + + +class TimeTransition(msrest.serialization.Model): + """TimeTransition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tag: Tag property. + :vartype tag: str + :ivar standard_offset: StandardOffset property. + :vartype standard_offset: str + :ivar daylight_savings: DaylightSavings property. + :vartype daylight_savings: str + :ivar utc_start: Start date, start time for this transition period. + :vartype utc_start: ~datetime.datetime + :ivar utc_end: End date, end time for this transition period. + :vartype utc_end: ~datetime.datetime + """ + + _validation = { + 'tag': {'readonly': True}, + 'standard_offset': {'readonly': True}, + 'daylight_savings': {'readonly': True}, + 'utc_start': {'readonly': True}, + 'utc_end': {'readonly': True}, + } + + _attribute_map = { + 'tag': {'key': 'Tag', 'type': 'str'}, + 'standard_offset': {'key': 'StandardOffset', 'type': 'str'}, + 'daylight_savings': {'key': 'DaylightSavings', 'type': 'str'}, + 'utc_start': {'key': 'UtcStart', 'type': 'iso-8601'}, + 'utc_end': {'key': 'UtcEnd', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(TimeTransition, self).__init__(**kwargs) + self.tag = None + self.standard_offset = None + self.daylight_savings = None + self.utc_start = None + self.utc_end = None + + +class TimezoneIanaVersionResult(msrest.serialization.Model): + """This object is returned from a successful Timezone IANA Version call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Version property. + :vartype version: str + """ + + _validation = { + 'version': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneIanaVersionResult, self).__init__(**kwargs) + self.version = None + + +class TimezoneId(msrest.serialization.Model): + """TimezoneId. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Id property. + :vartype id: str + :ivar aliases: An array of time zone ID aliases.  Only returned when [options]=\ *zoneinfo* or + *all*. + + Note: may be null. + :vartype aliases: list[str] + :ivar countries: An array of country records. Only returned when [options]=\ *zoneinfo* or + *all*. + :vartype countries: list[~azure.maps.timezone.models.CountryRecord] + :param names: Timezone names object. + :type names: ~azure.maps.timezone.models.TimezoneNames + :ivar reference_time: Details in effect at the local time. + :vartype reference_time: ~azure.maps.timezone.models.ReferenceTime + :ivar representative_point: Representative point property. + :vartype representative_point: ~azure.maps.timezone.models.RepresentativePoint + :ivar time_transitions: Time zone DST transitions from [transitionsFrom] until timestamp + 1 + year. + :vartype time_transitions: list[~azure.maps.timezone.models.TimeTransition] + """ + + _validation = { + 'id': {'readonly': True}, + 'aliases': {'readonly': True}, + 'countries': {'readonly': True}, + 'reference_time': {'readonly': True}, + 'representative_point': {'readonly': True}, + 'time_transitions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'Id', 'type': 'str'}, + 'aliases': {'key': 'Aliases', 'type': '[str]'}, + 'countries': {'key': 'Countries', 'type': '[CountryRecord]'}, + 'names': {'key': 'Names', 'type': 'TimezoneNames'}, + 'reference_time': {'key': 'ReferenceTime', 'type': 'ReferenceTime'}, + 'representative_point': {'key': 'RepresentativePoint', 'type': 'RepresentativePoint'}, + 'time_transitions': {'key': 'TimeTransitions', 'type': '[TimeTransition]'}, + } + + def __init__( + self, + *, + names: Optional["TimezoneNames"] = None, + **kwargs + ): + super(TimezoneId, self).__init__(**kwargs) + self.id = None + self.aliases = None + self.countries = None + self.names = names + self.reference_time = None + self.representative_point = None + self.time_transitions = None + + +class TimezoneNames(msrest.serialization.Model): + """Timezone names object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar iso6391_language_code: The ISO 639-1 language code of the Names. + :vartype iso6391_language_code: str + :ivar generic: Generic Name. + :vartype generic: str + :ivar standard: Standard Name. + :vartype standard: str + :ivar daylight: Daylight Name. + :vartype daylight: str + """ + + _validation = { + 'iso6391_language_code': {'readonly': True}, + 'generic': {'readonly': True}, + 'standard': {'readonly': True}, + 'daylight': {'readonly': True}, + } + + _attribute_map = { + 'iso6391_language_code': {'key': 'ISO6391LanguageCode', 'type': 'str'}, + 'generic': {'key': 'Generic', 'type': 'str'}, + 'standard': {'key': 'Standard', 'type': 'str'}, + 'daylight': {'key': 'Daylight', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneNames, self).__init__(**kwargs) + self.iso6391_language_code = None + self.generic = None + self.standard = None + self.daylight = None + + +class TimezoneResult(msrest.serialization.Model): + """This object is returned from a successful Timezone By ID call or By Coordinates call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: Version property. + :vartype version: str + :ivar reference_utc_timestamp: Reference Utc Timestamp property. + :vartype reference_utc_timestamp: ~datetime.datetime + :ivar time_zones: TimeZoneId array. + :vartype time_zones: list[~azure.maps.timezone.models.TimezoneId] + """ + + _validation = { + 'version': {'readonly': True}, + 'reference_utc_timestamp': {'readonly': True}, + 'time_zones': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'Version', 'type': 'str'}, + 'reference_utc_timestamp': {'key': 'ReferenceUtcTimestamp', 'type': 'iso-8601'}, + 'time_zones': {'key': 'TimeZones', 'type': '[TimezoneId]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneResult, self).__init__(**kwargs) + self.version = None + self.reference_utc_timestamp = None + self.time_zones = None + + +class TimezoneWindows(msrest.serialization.Model): + """TimezoneWindows. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar windows_id: Windows Id property. + :vartype windows_id: str + :ivar territory: Territory property. + :vartype territory: str + :param iana_ids: IanaIds array. + :type iana_ids: list[str] + """ + + _validation = { + 'windows_id': {'readonly': True}, + 'territory': {'readonly': True}, + } + + _attribute_map = { + 'windows_id': {'key': 'WindowsId', 'type': 'str'}, + 'territory': {'key': 'Territory', 'type': 'str'}, + 'iana_ids': {'key': 'IanaIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + iana_ids: Optional[List[str]] = None, + **kwargs + ): + super(TimezoneWindows, self).__init__(**kwargs) + self.windows_id = None + self.territory = None + self.iana_ids = iana_ids diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_timezone_client_enums.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_timezone_client_enums.py new file mode 100644 index 000000000000..c880d8672d99 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_timezone_client_enums.py @@ -0,0 +1,45 @@ +# 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 JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class TimezoneOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Do not include zoneinfo or transitions in the result. + NONE = "none" + #: Include additional time zone info in the result. + ZONE_INFO = "zoneInfo" + #: Include transition information in the result (The number of transitions is currently capped at + #: 250). + TRANSITIONS = "transitions" + #: Include both zoneinfo and transitions in the result. + ALL = "all" diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/__init__.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/__init__.py new file mode 100644 index 000000000000..622b33ee2679 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._timezone_operations import TimezoneOperations + +__all__ = [ + 'TimezoneOperations', +] diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/_timezone_operations.py b/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/_timezone_operations.py new file mode 100644 index 000000000000..eecb6fa3d705 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/_timezone_operations.py @@ -0,0 +1,505 @@ +# 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TimezoneOperations(object): + """TimezoneOperations 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.timezone.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_timezone_by_id( + self, + timezone_id, # type: str + accept_language=None, # type: Optional[str] + options=None, # type: Optional[Union[str, "_models.TimezoneOptions"]] + time_stamp=None, # type: Optional[datetime.datetime] + daylight_savings_time_from=None, # type: Optional[datetime.datetime] + daylight_savings_time_lasting_years=None, # type: Optional[int] + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.TimezoneResult" + """**Time Zone by Id** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns current, historical, and future time zone information for the specified IANA + time zone ID. + + :param timezone_id: The IANA time zone ID. + :type timezone_id: str + :param accept_language: Specifies the language code in which the timezone names should be + returned. If no language code is provided, the response will be in "EN". Please refer to + `Supported Languages `_ + for details. + :type accept_language: str + :param options: Alternatively, use alias "o". Options available for types of information + returned in the result. + :type options: str or ~azure.maps.timezone.models.TimezoneOptions + :param time_stamp: Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + API will use the machine time serving the request. + :type time_stamp: ~datetime.datetime + :param daylight_savings_time_from: Alternatively, use alias "tf". The start date from which + daylight savings time (DST) transitions are requested, only applies when "options" = all or + "options" = transitions. + :type daylight_savings_time_from: ~datetime.datetime + :param daylight_savings_time_lasting_years: Alternatively, use alias "ty". The number of years + from "transitionsFrom" for which DST transitions are requested, only applies when "options" = + all or "options" = transitions. + :type daylight_savings_time_lasting_years: int + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneResult"] + 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_timezone_by_id.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if options is not None: + query_parameters['options'] = self._serialize.query("options", options, 'str') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'iso-8601') + if daylight_savings_time_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("daylight_savings_time_from", daylight_savings_time_from, 'iso-8601') + if daylight_savings_time_lasting_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("daylight_savings_time_lasting_years", daylight_savings_time_lasting_years, 'int') + query_parameters['query'] = self._serialize.query("timezone_id", timezone_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + if accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("accept_language", accept_language, '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('TimezoneResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_by_id.metadata = {'url': '/timezone/byId/{format}'} # type: ignore + + def get_timezone_by_coordinates( + self, + coordinates, # type: List[float] + accept_language=None, # type: Optional[str] + options=None, # type: Optional[Union[str, "_models.TimezoneOptions"]] + time_stamp=None, # type: Optional[datetime.datetime] + daylight_savings_time_from=None, # type: Optional[datetime.datetime] + daylight_savings_time_lasting_years=None, # type: Optional[int] + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.TimezoneResult" + """**Time Zone by Coordinates** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns current, historical, and future time zone information for a specified + latitude-longitude pair. In addition, the API provides sunset and sunrise times for a given + location. + + :param coordinates: Coordinates of the point for which time zone information is requested. This + parameter is a list of coordinates, containing a pair of coordinate(lat, long). When this + endpoint is called directly, coordinates are passed in as a single string containing + coordinates, separated by commas. + :type coordinates: list[float] + :param accept_language: Specifies the language code in which the timezone names should be + returned. If no language code is provided, the response will be in "EN". Please refer to + `Supported Languages `_ + for details. + :type accept_language: str + :param options: Alternatively, use alias "o". Options available for types of information + returned in the result. + :type options: str or ~azure.maps.timezone.models.TimezoneOptions + :param time_stamp: Alternatively, use alias "stamp", or "s". Reference time, if omitted, the + API will use the machine time serving the request. + :type time_stamp: ~datetime.datetime + :param daylight_savings_time_from: Alternatively, use alias "tf". The start date from which + daylight savings time (DST) transitions are requested, only applies when "options" = all or + "options" = transitions. + :type daylight_savings_time_from: ~datetime.datetime + :param daylight_savings_time_lasting_years: Alternatively, use alias "ty". The number of years + from "transitionsFrom" for which DST transitions are requested, only applies when "options" = + all or "options" = transitions. + :type daylight_savings_time_lasting_years: int + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneResult"] + 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_timezone_by_coordinates.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if options is not None: + query_parameters['options'] = self._serialize.query("options", options, 'str') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'iso-8601') + if daylight_savings_time_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("daylight_savings_time_from", daylight_savings_time_from, 'iso-8601') + if daylight_savings_time_lasting_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("daylight_savings_time_lasting_years", daylight_savings_time_lasting_years, 'int') + query_parameters['query'] = self._serialize.query("coordinates", coordinates, '[float]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.client_id, 'str') + if accept_language is not None: + header_parameters['Accept-Language'] = self._serialize.header("accept_language", accept_language, '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('TimezoneResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_by_coordinates.metadata = {'url': '/timezone/byCoordinates/{format}'} # type: ignore + + def get_windows_timezone_ids( + self, + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> List["_models.TimezoneWindows"] + """**Windows Time Zones** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns a full list of Windows Time Zone IDs. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TimezoneWindows, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.TimezoneWindows] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TimezoneWindows"]] + 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_windows_timezone_ids.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('[TimezoneWindows]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_windows_timezone_ids.metadata = {'url': '/timezone/enumWindows/{format}'} # type: ignore + + def get_iana_timezone_ids( + self, + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> List["_models.IanaId"] + """**IANA Time Zones** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns a full list of IANA time zone IDs. Updates to the IANA service will be + reflected in the system within one day. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of IanaId, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.IanaId] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.IanaId"]] + 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_iana_timezone_ids.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('[IanaId]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_iana_timezone_ids.metadata = {'url': '/timezone/enumIana/{format}'} # type: ignore + + def get_iana_version( + self, + format="json", # type: Union[str, "_models.JsonFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.TimezoneIanaVersionResult" + """**Time Zone IANA Version** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns the current IANA version number as Metadata. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneIanaVersionResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneIanaVersionResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneIanaVersionResult"] + 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_iana_version.metadata['url'] # type: ignore + path_format_arguments = { + '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.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TimezoneIanaVersionResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_iana_version.metadata = {'url': '/timezone/ianaVersion/{format}'} # type: ignore + + def convert_windows_timezone_to_iana( + self, + windows_timezone_id, # type: str + format="json", # type: Union[str, "_models.JsonFormat"] + windows_territory_code=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["_models.IanaId"] + """**Windows to IANA Time Zone** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns a corresponding IANA ID, given a valid Windows Time Zone ID. Multiple IANA IDs + may be returned for a single Windows ID. It is possible to narrow these results by adding an + optional territory parameter. + + :param windows_timezone_id: The Windows time zone ID. + :type windows_timezone_id: str + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.JsonFormat + :param windows_territory_code: Windows Time Zone territory code. + :type windows_territory_code: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of IanaId, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.IanaId] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.IanaId"]] + 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.convert_windows_timezone_to_iana.metadata['url'] # type: ignore + path_format_arguments = { + '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("windows_timezone_id", windows_timezone_id, 'str') + if windows_territory_code is not None: + query_parameters['territory'] = self._serialize.query("windows_territory_code", windows_territory_code, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('[IanaId]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + convert_windows_timezone_to_iana.metadata = {'url': '/timezone/windowsToIana/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-timezone/azure/maps/timezone/py.typed b/sdk/maps/azure-maps-timezone/azure/maps/timezone/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-timezone/sdk_packaging.toml b/sdk/maps/azure-maps-timezone/sdk_packaging.toml new file mode 100644 index 000000000000..257c6fbbe04b --- /dev/null +++ b/sdk/maps/azure-maps-timezone/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-timezone" +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-timezone/setup.cfg b/sdk/maps/azure-maps-timezone/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-timezone/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-timezone/setup.py b/sdk/maps/azure-maps-timezone/setup.py new file mode 100644 index 000000000000..fedae4b355d3 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/setup.py @@ -0,0 +1,90 @@ +#!/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-timezone" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-traffic/CHANGELOG.md b/sdk/maps/azure-maps-traffic/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-traffic/LICENSE.txt b/sdk/maps/azure-maps-traffic/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-traffic/MANIFEST.in b/sdk/maps/azure-maps-traffic/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-traffic/README.md b/sdk/maps/azure-maps-traffic/README.md new file mode 100644 index 000000000000..691a24928e9e --- /dev/null +++ b/sdk/maps/azure-maps-traffic/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.6+. +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-traffic%2FREADME.png) diff --git a/sdk/maps/azure-maps-traffic/_meta.json b/sdk/maps/azure-maps-traffic/_meta.json new file mode 100644 index 000000000000..90c2e0268816 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Traffic/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/Traffic/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-traffic/azure/__init__.py b/sdk/maps/azure-maps-traffic/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-traffic/azure/maps/__init__.py b/sdk/maps/azure-maps-traffic/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/__init__.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/__init__.py new file mode 100644 index 000000000000..a725fdd54fa7 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/__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 ._traffic_client import TrafficClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['TrafficClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/_configuration.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_configuration.py new file mode 100644 index 000000000000..7f8aa657d927 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class TrafficClientConfiguration(Configuration): + """Configuration for TrafficClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(TrafficClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-traffic/{}'.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-traffic/azure/maps/traffic/_metadata.json b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_metadata.json new file mode 100644 index 000000000000..a882367cf816 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "TrafficClient", + "filename": "_traffic_client", + "description": "Azure Maps Traffic REST APIs.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"TrafficClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"TrafficClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "traffic": "TrafficOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/_traffic_client.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_traffic_client.py new file mode 100644 index 000000000000..d73f558b6ae4 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_traffic_client.py @@ -0,0 +1,85 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import TrafficClientConfiguration +from .operations import TrafficOperations +from . import models + + +class TrafficClient(object): + """Azure Maps Traffic REST APIs. + + :ivar traffic: TrafficOperations operations + :vartype traffic: azure.maps.traffic.operations.TrafficOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = TrafficClientConfiguration(credential, client_id, **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.traffic = TrafficOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> TrafficClient + 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-traffic/azure/maps/traffic/_version.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/__init__.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/__init__.py new file mode 100644 index 000000000000..8a8023f2c29d --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/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 ._traffic_client import TrafficClient +__all__ = ['TrafficClient'] diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_configuration.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_configuration.py new file mode 100644 index 000000000000..d2c1db8b0ef6 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 TrafficClientConfiguration(Configuration): + """Configuration for TrafficClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(TrafficClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-traffic/{}'.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-traffic/azure/maps/traffic/aio/_traffic_client.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_traffic_client.py new file mode 100644 index 000000000000..a87d846c1208 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_traffic_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 TrafficClientConfiguration +from .operations import TrafficOperations +from .. import models + + +class TrafficClient(object): + """Azure Maps Traffic REST APIs. + + :ivar traffic: TrafficOperations operations + :vartype traffic: azure.maps.traffic.aio.operations.TrafficOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = TrafficClientConfiguration(credential, client_id, **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.traffic = TrafficOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "TrafficClient": + 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-traffic/azure/maps/traffic/aio/operations/__init__.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/__init__.py new file mode 100644 index 000000000000..bc9cb737e087 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._traffic_operations import TrafficOperations + +__all__ = [ + 'TrafficOperations', +] diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/_traffic_operations.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/_traffic_operations.py new file mode 100644 index 000000000000..71b8ea5527ab --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/_traffic_operations.py @@ -0,0 +1,574 @@ +# 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, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TrafficOperations: + """TrafficOperations 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.traffic.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_traffic_flow_tile( + self, + format: Union[str, "_models.TileFormat"], + style: Union[str, "_models.TrafficFlowTileStyle"], + zoom: int, + tile_index: "_models.TileIndex", + thickness: Optional[int] = None, + **kwargs: Any + ) -> IO: + """**Traffic Flow Tile** + + **Applies to**\ : S0 and S1 pricing tiers. + + The Azure Flow Tile API serves 256 x 256 pixel tiles showing traffic flow. All tiles use the + same grid system. Because the traffic tiles use transparent images, they can be layered on top + of map tiles to create a compound display. The Flow tiles use colors to indicate either the + speed of traffic on different road segments, or the difference between that speed and the + free-flow speed on the road segment in question. + + :param format: Desired format of the response. Possible values are png & pbf. + :type format: str or ~azure.maps.traffic.models.TileFormat + :param style: .. raw:: html + +

The style to be used to render the tile.

. + :type style: str or ~azure.maps.traffic.models.TrafficFlowTileStyle + :param zoom: Zoom level for the desired tile. For *raster* tiles, value must be in the range: + 0-22 (inclusive). For *vector* tiles, value must be in the range: 0-22 (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.traffic.models.TileIndex + :param thickness: The value of the width of the line representing traffic. This value is a + multiplier and the accepted values range from 1 - 20. The default value is 10. This parameter + is not valid when format is pbf. + :type thickness: int + :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', {})) + + _x = None + _y = None + if tile_index is not None: + _x = tile_index.x + _y = tile_index.y + api_version = "1.0" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_traffic_flow_tile.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if thickness is not None: + query_parameters['thickness'] = self._serialize.query("thickness", thickness, 'int', maximum=20, minimum=1) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_traffic_flow_tile.metadata = {'url': '/traffic/flow/tile/{format}'} # type: ignore + + async def get_traffic_flow_segment( + self, + style: Union[str, "_models.TrafficFlowSegmentStyle"], + zoom: int, + coordinates: List[float], + format: Union[str, "_models.ResponseFormat"] = "json", + unit: Optional[Union[str, "_models.SpeedUnit"]] = None, + thickness: Optional[int] = None, + open_lr: Optional[bool] = None, + **kwargs: Any + ) -> "_models.TrafficFlowSegmentData": + """**Traffic Flow Segment** + + **Applies to**\ : S0 and S1 pricing tiers. + + This service provides information about the speeds and travel times of the road fragment + closest to the given coordinates. It is designed to work alongside the Flow layer of the Render + Service to support clickable flow data visualizations. With this API, the client side can + connect any place in the map with flow data on the closest road and present it to the user. + + :param style: The style to be used to render the tile. Valid values are absolute which returns + colors reflecting the absolute speed measured, relative which returns the speed relative to + free-flow, Relative-delay which displays relative speeds only where they are different from the + freeflow speeds. + :type style: str or ~azure.maps.traffic.models.TrafficFlowSegmentStyle + :param zoom: Zoom level for the desired tile. Zoom value must be in the range: 0-22 + (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param coordinates: Coordinates of the point close to the road segment. This parameter is a + list of four coordinates, containing two coordinate pairs (lat, long, lat, long), and + calculated using EPSG4326 projection. When this endpoint is called directly, coordinates are + passed in as a single string containing four coordinates, separated by commas. + :type coordinates: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.ResponseFormat + :param unit: Unit of speed in KMPH or MPH. + :type unit: str or ~azure.maps.traffic.models.SpeedUnit + :param thickness: The value of the width of the line representing traffic. This value is a + multiplier and the accepted values range from 1 - 20. The default value is 10. + :type thickness: int + :param open_lr: Boolean on whether the response should include OpenLR code. + :type open_lr: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrafficFlowSegmentData, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficFlowSegmentData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficFlowSegmentData"] + 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_traffic_flow_segment.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['query'] = self._serialize.query("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if thickness is not None: + query_parameters['thickness'] = self._serialize.query("thickness", thickness, 'int', maximum=20, minimum=1) + if open_lr is not None: + query_parameters['openLr'] = self._serialize.query("open_lr", open_lr, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TrafficFlowSegmentData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_traffic_flow_segment.metadata = {'url': '/traffic/flow/segment/{format}'} # type: ignore + + async def get_traffic_incident_tile( + self, + format: Union[str, "_models.TileFormat"], + style: Union[str, "_models.TrafficIncidentTileStyle"], + zoom: int, + tile_index: "_models.TileIndex", + traffic_state: Optional[str] = None, + **kwargs: Any + ) -> IO: + """**Traffic Incident Tile** + + **Applies to**\ : S0 and S1 pricing tiers. + + This service serves 256 x 256 pixel tiles showing traffic incidents. All tiles use the same + grid system. Because the traffic tiles use transparent images, they can be layered on top of + map tiles to create a compound display. Traffic tiles render graphics to indicate traffic on + the roads in the specified area. + + :param format: Desired format of the response. Possible values are png & pbf. + :type format: str or ~azure.maps.traffic.models.TileFormat + :param style: The style to be used to render the tile. This parameter is not valid when format + is pbf. + :type style: str or ~azure.maps.traffic.models.TrafficIncidentTileStyle + :param zoom: Zoom level for the desired tile. For *raster* tiles, value must be in the range: + 0-22 (inclusive). For *vector* tiles, value must be in the range: 0-22 (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.traffic.models.TileIndex + :param traffic_state: Reference value for the state of traffic at a particular time, obtained + from the Viewport API call, trafficModelId attribute in trafficState field. It is updated every + minute, and is valid for two minutes before it times out. Use -1 to get the most recent + traffic information. Default: most recent traffic information. + :type traffic_state: 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', {})) + + _x = None + _y = None + if tile_index is not None: + _x = tile_index.x + _y = tile_index.y + api_version = "1.0" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_traffic_incident_tile.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if traffic_state is not None: + query_parameters['t'] = self._serialize.query("traffic_state", traffic_state, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_traffic_incident_tile.metadata = {'url': '/traffic/incident/tile/{format}'} # type: ignore + + async def get_traffic_incident_detail( + self, + style: Union[str, "_models.IncidentDetailStyle"], + boundingbox: List[float], + bounding_zoom: int, + trafficmodelid: str, + format: Union[str, "_models.ResponseFormat"] = "json", + language: Optional[str] = None, + projection: Optional[Union[str, "_models.ProjectionStandard"]] = None, + geometries: Optional[Union[str, "_models.IncidentGeometryType"]] = None, + expand_cluster: Optional[bool] = None, + original_position: Optional[bool] = None, + **kwargs: Any + ) -> "_models.TrafficIncidentDetail": + """**Traffic Incident Detail** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API provides information on traffic incidents inside a given bounding box, based on the + current Traffic Model ID. The Traffic Model ID is available to grant synchronization of data + between calls and API's. The Traffic Model ID is a key value for determining the currency of + traffic incidents. It is updated every minute, and is valid for two minutes before it times + out. It is used in rendering `incident tiles + `_. It can be + obtained from the `Viewport API + `_. + + :param style: The style that will be used to render the tile in Traffic `Incident Tile API + `_. This will + have an effect on the coordinates of traffic incidents in the reply. + :type style: str or ~azure.maps.traffic.models.IncidentDetailStyle + :param boundingbox: The ``boundingbox`` is represented by two value pairs describing it's + corners (first pair for lower left corner and second for upper right). The pairs can either be + specified using any of the ``projection``\ 's specified below (e.g., *minY,minX,maxY,maxX*\ ) + or by two latitude-longitude pairs (e.g., *minLat,minLon,maxLat,maxLon*\ + ).:code:`
`:code:`
`NOTE: If latitude/longitude pairs are used, then the ``projection`` + parameter must be set to "EPSG4326". + :type boundingbox: list[float] + :param bounding_zoom: Zoom level for desired tile. 0 to 22 for raster tiles, 0 through 22 for + vector tiles. + :type bounding_zoom: int + :param trafficmodelid: Number referencing traffic model. This can be obtained from the + `Viewport API + `_. It is + updated every minute, and is valid for two minutes before it times out. If the wrong Traffic + Model ID is specified, the correct one will be returned by the interface. A value of -1 will + always invoke the most recent traffic model. + :type trafficmodelid: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.ResponseFormat + :param language: `ISO 639-1 code `_ for + the output language. Supported languages are ar, ca, cs, da, de, el, en, en-GB, en-US, es, et, + fi, fr, he, hu, id, in*, it, lt, lv, nb, nl, no, pl, pt, ro, ru, sk, sv, th, tr, zh. + + Please refer to `Supported Languages + `_ for details. When + invalid language code is provided response is returned in English. When incident cause or + description does not have translation, English description is returned. + :type language: str + :param projection: The projection used to specify the coordinates in the request and response. + `EPSG900913 `_ (default) or + `EPSG4326 `_. + :type projection: str or ~azure.maps.traffic.models.ProjectionStandard + :param geometries: The type of vector geometry added to incidents (returned in the :code:`` + element of the response). + :type geometries: str or ~azure.maps.traffic.models.IncidentGeometryType + :param expand_cluster: Boolean to indicate whether to list all traffic incidents in a cluster + separately. + :type expand_cluster: bool + :param original_position: Boolean on whether to return the original position of the incident + (:code:``) as well as the one shifted to the beginning of the traffic tube (:code:``). + :type original_position: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrafficIncidentDetail, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentDetail + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentDetail"] + 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_traffic_incident_detail.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['boundingbox'] = self._serialize.query("boundingbox", boundingbox, '[float]', div=',') + query_parameters['boundingZoom'] = self._serialize.query("bounding_zoom", bounding_zoom, 'int', maximum=22, minimum=0) + query_parameters['trafficmodelid'] = self._serialize.query("trafficmodelid", trafficmodelid, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if projection is not None: + query_parameters['projection'] = self._serialize.query("projection", projection, 'str') + if geometries is not None: + query_parameters['geometries'] = self._serialize.query("geometries", geometries, 'str') + if expand_cluster is not None: + query_parameters['expandCluster'] = self._serialize.query("expand_cluster", expand_cluster, 'bool') + if original_position is not None: + query_parameters['originalPosition'] = self._serialize.query("original_position", original_position, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TrafficIncidentDetail', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_traffic_incident_detail.metadata = {'url': '/traffic/incident/detail/{format}'} # type: ignore + + async def get_traffic_incident_viewport( + self, + boundingbox: List[float], + boundingzoom: int, + overviewbox: List[float], + overviewzoom: int, + format: Union[str, "_models.ResponseFormat"] = "json", + copyright: Optional[bool] = True, + **kwargs: Any + ) -> "_models.TrafficIncidentViewport": + """**Traffic Incident Viewport** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns legal and technical information for the viewport described in the request. It + should be called by client applications whenever the viewport changes (for instance, through + zooming, panning, going to a location, or displaying a route). The request should contain the + bounding box and zoom level of the viewport whose information is needed. The return will + contain map version information, as well as the current Traffic Model ID and copyright IDs. + The Traffic Model ID returned by the Viewport Description is used by other APIs to retrieve + last traffic information for further processing. + + :param boundingbox: Bounding box of the map viewport in `EPSG900913 + `_ projection. The ``boundingbox`` + is represented by two value pairs describing it's corners (first pair for lower left corner and + second for upper right). When this endpoint is called directly, all values should be separated + by commas (e.g., *minY,minX,maxY,maxX*\ ). The maximum size of the bounding box that can be + passed is dependent on the requested zoom level. The width and height cannot exceed 4092 pixels + when rendered on the given zoom level.:code:`
`:code:`
`NOTE: Bounding boxes that cross + the 180° meridian require special treatment. For such boxes, the eastern *maxX* value will be + negative, and thus less than the *minX* value west of the 180° meridian. To address that, the + value 40075016.6855874 should be added to the true *maxX* value before it is passed in the + request. + :type boundingbox: list[float] + :param boundingzoom: Zoom level of the map viewport. Used to determine whether the view can be + zoomed in. + :type boundingzoom: int + :param overviewbox: Bounding box of the overview map in `EPSG900913 + `_ + projection.:code:`
`:code:`
`Used in case the overview box/mini map has different + copyright data than the main map. If there is no mini map, the same coordinates as + ``boundingBox`` is used. When this endpoint is called directly, coordinates are passed in as a + single string containing four coordinates, separated by commas. + :type overviewbox: list[float] + :param overviewzoom: Zoom level of the overview map. If there is no mini map, use the same zoom + level as boundingZoom. + :type overviewzoom: int + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.ResponseFormat + :param copyright: Determines what copyright information to return. When true the copyright text + is returned; when false only the copyright index is returned. + :type copyright: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrafficIncidentViewport, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentViewport + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentViewport"] + 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_traffic_incident_viewport.metadata['url'] # type: ignore + path_format_arguments = { + '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['boundingbox'] = self._serialize.query("boundingbox", boundingbox, '[float]', div=',') + query_parameters['boundingzoom'] = self._serialize.query("boundingzoom", boundingzoom, 'int', maximum=22, minimum=0) + query_parameters['overviewbox'] = self._serialize.query("overviewbox", overviewbox, '[float]', div=',') + query_parameters['overviewzoom'] = self._serialize.query("overviewzoom", overviewzoom, 'int', maximum=22, minimum=0) + if copyright is not None: + query_parameters['copyright'] = self._serialize.query("copyright", copyright, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TrafficIncidentViewport', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_traffic_incident_viewport.metadata = {'url': '/traffic/incident/viewport/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/__init__.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/__init__.py new file mode 100644 index 000000000000..04a1ed1735cd --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/__init__.py @@ -0,0 +1,83 @@ +# 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 ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import LatLongPair + from ._models_py3 import Point + from ._models_py3 import TileIndex + from ._models_py3 import TrafficFlowSegmentData + from ._models_py3 import TrafficFlowSegmentDataFlowSegmentData + from ._models_py3 import TrafficFlowSegmentDataFlowSegmentDataCoordinates + from ._models_py3 import TrafficIncidentDetail + from ._models_py3 import TrafficIncidentDetailTm + from ._models_py3 import TrafficIncidentPointOfInterest + from ._models_py3 import TrafficIncidentViewport + from ._models_py3 import TrafficIncidentViewportViewpResp + from ._models_py3 import TrafficState +except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import LatLongPair # type: ignore + from ._models import Point # type: ignore + from ._models import TileIndex # type: ignore + from ._models import TrafficFlowSegmentData # type: ignore + from ._models import TrafficFlowSegmentDataFlowSegmentData # type: ignore + from ._models import TrafficFlowSegmentDataFlowSegmentDataCoordinates # type: ignore + from ._models import TrafficIncidentDetail # type: ignore + from ._models import TrafficIncidentDetailTm # type: ignore + from ._models import TrafficIncidentPointOfInterest # type: ignore + from ._models import TrafficIncidentViewport # type: ignore + from ._models import TrafficIncidentViewportViewpResp # type: ignore + from ._models import TrafficState # type: ignore + +from ._traffic_client_enums import ( + DelayMagnitude, + IconCategory, + IncidentDetailStyle, + IncidentGeometryType, + ProjectionStandard, + ResponseFormat, + SpeedUnit, + TileFormat, + TrafficFlowSegmentStyle, + TrafficFlowTileStyle, + TrafficIncidentTileStyle, +) + +__all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'LatLongPair', + 'Point', + 'TileIndex', + 'TrafficFlowSegmentData', + 'TrafficFlowSegmentDataFlowSegmentData', + 'TrafficFlowSegmentDataFlowSegmentDataCoordinates', + 'TrafficIncidentDetail', + 'TrafficIncidentDetailTm', + 'TrafficIncidentPointOfInterest', + 'TrafficIncidentViewport', + 'TrafficIncidentViewportViewpResp', + 'TrafficState', + 'DelayMagnitude', + 'IconCategory', + 'IncidentDetailStyle', + 'IncidentGeometryType', + 'ProjectionStandard', + 'ResponseFormat', + 'SpeedUnit', + 'TileFormat', + 'TrafficFlowSegmentStyle', + 'TrafficFlowTileStyle', + 'TrafficIncidentTileStyle', +] diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models.py new file mode 100644 index 000000000000..76016ec3f5fd --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models.py @@ -0,0 +1,598 @@ +# 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 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.traffic.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.traffic.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.traffic.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 LatLongPair(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + :param latitude: Latitude property. + :type latitude: float + :param longitude: Longitude property. + :type longitude: float + """ + + _attribute_map = { + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(LatLongPair, self).__init__(**kwargs) + self.latitude = kwargs.get('latitude', None) + self.longitude = kwargs.get('longitude', None) + + +class Point(msrest.serialization.Model): + """Generic representation of a point with coordinates (x, y) in the Cartesian plane. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar x: x coordinate. + :vartype x: float + :ivar y: y coordinate. + :vartype y: float + """ + + _validation = { + 'x': {'readonly': True}, + 'y': {'readonly': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(Point, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TileIndex(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. X coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type x: int + :param y: Required. Y coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type y: int + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(TileIndex, self).__init__(**kwargs) + self.x = kwargs['x'] + self.y = kwargs['y'] + + +class TrafficFlowSegmentData(msrest.serialization.Model): + """This object is returned from a successful Traffic Flow Segment call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar flow_segment_data: Flow Segment Data property. + :vartype flow_segment_data: ~azure.maps.traffic.models.TrafficFlowSegmentDataFlowSegmentData + """ + + _validation = { + 'flow_segment_data': {'readonly': True}, + } + + _attribute_map = { + 'flow_segment_data': {'key': 'flowSegmentData', 'type': 'TrafficFlowSegmentDataFlowSegmentData'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentData, self).__init__(**kwargs) + self.flow_segment_data = None + + +class TrafficFlowSegmentDataFlowSegmentData(msrest.serialization.Model): + """Flow Segment Data property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar functional_road_class: Functional Road Class. This indicates the road type: + 0: Motorway, freeway or other major road. + 1: Major road, less important than a motorway. + 2: Other major road. + 3: Secondary road. + 4: Local connecting road. + 5: Local road of high importance. + 6: Local road. + :vartype functional_road_class: str + :ivar current_speed: The current average speed at the selected point, in the units requested. + This is calculated from the currentTravelTime and the length of the selected segment. + :vartype current_speed: int + :ivar free_flow_speed: The free flow speed expected under ideal conditions, expressed in the + units requested. This is related to the freeFlowTravelTime. + :vartype free_flow_speed: int + :ivar current_travel_time: Current travel time in seconds, across this traffic segment, based + on fused real-time measurements between the defined locations in the specified direction. + :vartype current_travel_time: int + :ivar free_flow_travel_time: The travel time in seconds, across this traffic segment, which + would be expected under ideal free flow conditions. + :vartype free_flow_travel_time: int + :ivar confidence: The confidence is a measure of the quality of the provided travel time and + speed. A value of 1 means full confidence, that the response contains the highest quality data. + Lower values indicate the degree that the response may vary from the actual conditions on the + road. Any value greater than 0.6 means the information was based on real-time probe input. A + value of 0.5 means the reported speed is based on historical info. A value between 0.5 and + 0.6 has a calculated weighted average between historical and live speeds. + :vartype confidence: float + :param coordinates: Includes the coordinates describing the shape of the segment. Coordinates + are shifted from the road depending on the zoom level to support high quality visualization in + every scale. + :type coordinates: ~azure.maps.traffic.models.TrafficFlowSegmentDataFlowSegmentDataCoordinates + :ivar version: This indicates the software version that generated the response. + :vartype version: str + :ivar open_lr_code: OpenLR code for segment. See `OpenLR + `_ for more information on the use of Open LR codes. + :vartype open_lr_code: str + """ + + _validation = { + 'functional_road_class': {'readonly': True}, + 'current_speed': {'readonly': True}, + 'free_flow_speed': {'readonly': True}, + 'current_travel_time': {'readonly': True}, + 'free_flow_travel_time': {'readonly': True}, + 'confidence': {'readonly': True}, + 'version': {'readonly': True}, + 'open_lr_code': {'readonly': True}, + } + + _attribute_map = { + 'functional_road_class': {'key': 'frc', 'type': 'str'}, + 'current_speed': {'key': 'currentSpeed', 'type': 'int'}, + 'free_flow_speed': {'key': 'freeFlowSpeed', 'type': 'int'}, + 'current_travel_time': {'key': 'currentTravelTime', 'type': 'int'}, + 'free_flow_travel_time': {'key': 'freeFlowTravelTime', 'type': 'int'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'coordinates': {'key': 'coordinates', 'type': 'TrafficFlowSegmentDataFlowSegmentDataCoordinates'}, + 'version': {'key': '@version', 'type': 'str'}, + 'open_lr_code': {'key': 'openlr', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentDataFlowSegmentData, self).__init__(**kwargs) + self.functional_road_class = None + self.current_speed = None + self.free_flow_speed = None + self.current_travel_time = None + self.free_flow_travel_time = None + self.confidence = None + self.coordinates = kwargs.get('coordinates', None) + self.version = None + self.open_lr_code = None + + +class TrafficFlowSegmentDataFlowSegmentDataCoordinates(msrest.serialization.Model): + """Includes the coordinates describing the shape of the segment. Coordinates are shifted from the road depending on the zoom level to support high quality visualization in every scale. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar coordinates: Coordinate array. + :vartype coordinates: list[~azure.maps.traffic.models.LatLongPair] + """ + + _validation = { + 'coordinates': {'readonly': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinate', 'type': '[LatLongPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentDataFlowSegmentDataCoordinates, self).__init__(**kwargs) + self.coordinates = None + + +class TrafficIncidentDetail(msrest.serialization.Model): + """This object is returned from a successful Traffic incident Detail call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tm: Main response element. + :vartype tm: ~azure.maps.traffic.models.TrafficIncidentDetailTm + """ + + _validation = { + 'tm': {'readonly': True}, + } + + _attribute_map = { + 'tm': {'key': 'tm', 'type': 'TrafficIncidentDetailTm'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetail, self).__init__(**kwargs) + self.tm = None + + +class TrafficIncidentDetailTm(msrest.serialization.Model): + """Main response element. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ID of the traffic model for this incident. + :vartype id: str + :ivar points_of_interest: A single traffic incident, or a cluster of traffic incidents. + :vartype points_of_interest: list[~azure.maps.traffic.models.TrafficIncidentPointOfInterest] + """ + + _validation = { + 'id': {'readonly': True}, + 'points_of_interest': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': '@id', 'type': 'str'}, + 'points_of_interest': {'key': 'poi', 'type': '[TrafficIncidentPointOfInterest]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetailTm, self).__init__(**kwargs) + self.id = None + self.points_of_interest = None + + +class TrafficIncidentPointOfInterest(msrest.serialization.Model): + """TrafficIncidentPointOfInterest. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ID of the traffic incident. + :vartype id: str + :ivar point: The point where an icon of the cluster or raw incident should be drawn, expressed + in the requested projection. This is affected by traffic style, zoom level and road type. + :vartype point: ~azure.maps.traffic.models.Point + :ivar icon_category: The icon category associated with this incident. Values are numbers in the + range 0-13, with the following meanings -- 0: Unknown, 1: Accident, 2: Fog, 3: Dangerous + Conditions, 4: Rain, 5: Ice, 6: Jam, 7: Lane Closed, 8: Road Closed, 9: Road Works, 10: Wind, + 11: Flooding, 12: Detour, 13: Cluster. Possible values include: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14. + :vartype icon_category: str or ~azure.maps.traffic.models.IconCategory + :ivar magnitude_of_delay: The magnitude of delay associated with incident. These values + correspond to incident colors in the traffic tiles. Possible values include: 0, 1, 2, 3, 4. + :vartype magnitude_of_delay: str or ~azure.maps.traffic.models.DelayMagnitude + :ivar bottom_left_coordinate: Bottom left coordinate of the cluster in the projection of the + request. + :vartype bottom_left_coordinate: ~azure.maps.traffic.models.Point + :ivar top_left_coordinate: Top right coordinate of the cluster in the projection of the + request. + :vartype top_left_coordinate: ~azure.maps.traffic.models.Point + :ivar cluster_size: Cluster size: the number of incidents in the cluster. + :vartype cluster_size: int + :ivar length_in_meters: Length of the incident in meters. + :vartype length_in_meters: int + :ivar road_numbers: The road number(s) affected by the incident. Multiple road numbers will + delimited by slashes. + :vartype road_numbers: str + :ivar start_date: Start date of the incident, if available. The date is described in the + ISO8601 format. + :vartype start_date: ~datetime.datetime + :ivar end_date: Estimated end date of the incident, if available. The date is described in the + ISO8601 format. + :vartype end_date: ~datetime.datetime + :ivar delay_in_seconds: Delay caused by the incident in seconds (except in road closures). + :vartype delay_in_seconds: int + :ivar traffic_end_location: To: the name of the intersection or location where the traffic due + to the incident ends. + :vartype traffic_end_location: str + :ivar traffic_start_location: From: the name of the intersection or location where the traffic + due to the incident starts. + :vartype traffic_start_location: str + :ivar description: Description of the incident in the language requested. + :vartype description: str + :ivar cause: Cause of the incident, where available, in the language requested. + :vartype cause: str + """ + + _validation = { + 'id': {'readonly': True}, + 'point': {'readonly': True}, + 'icon_category': {'readonly': True}, + 'magnitude_of_delay': {'readonly': True}, + 'bottom_left_coordinate': {'readonly': True}, + 'top_left_coordinate': {'readonly': True}, + 'cluster_size': {'readonly': True}, + 'length_in_meters': {'readonly': True}, + 'road_numbers': {'readonly': True}, + 'start_date': {'readonly': True}, + 'end_date': {'readonly': True}, + 'delay_in_seconds': {'readonly': True}, + 'traffic_end_location': {'readonly': True}, + 'traffic_start_location': {'readonly': True}, + 'description': {'readonly': True}, + 'cause': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'point': {'key': 'p', 'type': 'Point'}, + 'icon_category': {'key': 'ic', 'type': 'int'}, + 'magnitude_of_delay': {'key': 'ty', 'type': 'int'}, + 'bottom_left_coordinate': {'key': 'cbl', 'type': 'Point'}, + 'top_left_coordinate': {'key': 'ctr', 'type': 'Point'}, + 'cluster_size': {'key': 'cs', 'type': 'int'}, + 'length_in_meters': {'key': 'l', 'type': 'int'}, + 'road_numbers': {'key': 'r', 'type': 'str'}, + 'start_date': {'key': 'sd', 'type': 'iso-8601'}, + 'end_date': {'key': 'ed', 'type': 'iso-8601'}, + 'delay_in_seconds': {'key': 'dl', 'type': 'int'}, + 'traffic_end_location': {'key': 't', 'type': 'str'}, + 'traffic_start_location': {'key': 'f', 'type': 'str'}, + 'description': {'key': 'd', 'type': 'str'}, + 'cause': {'key': 'c', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentPointOfInterest, self).__init__(**kwargs) + self.id = None + self.point = None + self.icon_category = None + self.magnitude_of_delay = None + self.bottom_left_coordinate = None + self.top_left_coordinate = None + self.cluster_size = None + self.length_in_meters = None + self.road_numbers = None + self.start_date = None + self.end_date = None + self.delay_in_seconds = None + self.traffic_end_location = None + self.traffic_start_location = None + self.description = None + self.cause = None + + +class TrafficIncidentViewport(msrest.serialization.Model): + """This object is returned from a successful Traffic Incident Viewport call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar viewp_resp: Viewport Response object. + :vartype viewp_resp: ~azure.maps.traffic.models.TrafficIncidentViewportViewpResp + """ + + _validation = { + 'viewp_resp': {'readonly': True}, + } + + _attribute_map = { + 'viewp_resp': {'key': 'viewpResp', 'type': 'TrafficIncidentViewportViewpResp'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewport, self).__init__(**kwargs) + self.viewp_resp = None + + +class TrafficIncidentViewportViewpResp(msrest.serialization.Model): + """Viewport Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar traffic_state: Traffic State information. + :vartype traffic_state: ~azure.maps.traffic.models.TrafficState + :ivar copyright_information: When the copyright parameter value is true, this contains the full + text of the copyright information that must be displayed with the tiles in the viewport. + :vartype copyright_information: str + :ivar version: Indicates the software version used to generate the information. For use with + support queries. + :vartype version: str + :ivar maps: Indicates the data provider's internal names for the map data used in the viewport. + For use with support queries. + :vartype maps: str + """ + + _validation = { + 'traffic_state': {'readonly': True}, + 'copyright_information': {'readonly': True}, + 'version': {'readonly': True}, + 'maps': {'readonly': True}, + } + + _attribute_map = { + 'traffic_state': {'key': 'trafficState', 'type': 'TrafficState'}, + 'copyright_information': {'key': 'copyrightIds', 'type': 'str'}, + 'version': {'key': '@version', 'type': 'str'}, + 'maps': {'key': '@maps', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewportViewpResp, self).__init__(**kwargs) + self.traffic_state = None + self.copyright_information = None + self.version = None + self.maps = None + + +class TrafficState(msrest.serialization.Model): + """Traffic State information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar traffic_age: The elapsed time (in seconds) from the Traffic Model ID creation. + :vartype traffic_age: int + :ivar traffic_model_id: The unique ID called Traffic Model ID is used in calls to Traffic + Incident services. It allows to obtain information from particular traffic updates. Traffic + Model ID is updated every minute, and is valid for two minutes before it times out. + :vartype traffic_model_id: str + """ + + _validation = { + 'traffic_age': {'readonly': True}, + 'traffic_model_id': {'readonly': True}, + } + + _attribute_map = { + 'traffic_age': {'key': '@trafficAge', 'type': 'int'}, + 'traffic_model_id': {'key': '@trafficModelId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficState, self).__init__(**kwargs) + self.traffic_age = None + self.traffic_model_id = None diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models_py3.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models_py3.py new file mode 100644 index 000000000000..03929b515612 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models_py3.py @@ -0,0 +1,610 @@ +# 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 Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +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.traffic.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.traffic.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.traffic.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 LatLongPair(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + :param latitude: Latitude property. + :type latitude: float + :param longitude: Longitude property. + :type longitude: float + """ + + _attribute_map = { + 'latitude': {'key': 'latitude', 'type': 'float'}, + 'longitude': {'key': 'longitude', 'type': 'float'}, + } + + def __init__( + self, + *, + latitude: Optional[float] = None, + longitude: Optional[float] = None, + **kwargs + ): + super(LatLongPair, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +class Point(msrest.serialization.Model): + """Generic representation of a point with coordinates (x, y) in the Cartesian plane. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar x: x coordinate. + :vartype x: float + :ivar y: y coordinate. + :vartype y: float + """ + + _validation = { + 'x': {'readonly': True}, + 'y': {'readonly': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'float'}, + 'y': {'key': 'y', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(Point, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TileIndex(msrest.serialization.Model): + """Parameter group. + + All required parameters must be populated in order to send to Azure. + + :param x: Required. X coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type x: int + :param y: Required. Y coordinate of the tile on zoom grid. Value must be in the range [0, + 2:code:``zoom`` -1]. + + Please see `Zoom Levels and Tile Grid + `_ for + details. + :type y: int + """ + + _validation = { + 'x': {'required': True}, + 'y': {'required': True}, + } + + _attribute_map = { + 'x': {'key': 'x', 'type': 'int'}, + 'y': {'key': 'y', 'type': 'int'}, + } + + def __init__( + self, + *, + x: int, + y: int, + **kwargs + ): + super(TileIndex, self).__init__(**kwargs) + self.x = x + self.y = y + + +class TrafficFlowSegmentData(msrest.serialization.Model): + """This object is returned from a successful Traffic Flow Segment call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar flow_segment_data: Flow Segment Data property. + :vartype flow_segment_data: ~azure.maps.traffic.models.TrafficFlowSegmentDataFlowSegmentData + """ + + _validation = { + 'flow_segment_data': {'readonly': True}, + } + + _attribute_map = { + 'flow_segment_data': {'key': 'flowSegmentData', 'type': 'TrafficFlowSegmentDataFlowSegmentData'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentData, self).__init__(**kwargs) + self.flow_segment_data = None + + +class TrafficFlowSegmentDataFlowSegmentData(msrest.serialization.Model): + """Flow Segment Data property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar functional_road_class: Functional Road Class. This indicates the road type: + 0: Motorway, freeway or other major road. + 1: Major road, less important than a motorway. + 2: Other major road. + 3: Secondary road. + 4: Local connecting road. + 5: Local road of high importance. + 6: Local road. + :vartype functional_road_class: str + :ivar current_speed: The current average speed at the selected point, in the units requested. + This is calculated from the currentTravelTime and the length of the selected segment. + :vartype current_speed: int + :ivar free_flow_speed: The free flow speed expected under ideal conditions, expressed in the + units requested. This is related to the freeFlowTravelTime. + :vartype free_flow_speed: int + :ivar current_travel_time: Current travel time in seconds, across this traffic segment, based + on fused real-time measurements between the defined locations in the specified direction. + :vartype current_travel_time: int + :ivar free_flow_travel_time: The travel time in seconds, across this traffic segment, which + would be expected under ideal free flow conditions. + :vartype free_flow_travel_time: int + :ivar confidence: The confidence is a measure of the quality of the provided travel time and + speed. A value of 1 means full confidence, that the response contains the highest quality data. + Lower values indicate the degree that the response may vary from the actual conditions on the + road. Any value greater than 0.6 means the information was based on real-time probe input. A + value of 0.5 means the reported speed is based on historical info. A value between 0.5 and + 0.6 has a calculated weighted average between historical and live speeds. + :vartype confidence: float + :param coordinates: Includes the coordinates describing the shape of the segment. Coordinates + are shifted from the road depending on the zoom level to support high quality visualization in + every scale. + :type coordinates: ~azure.maps.traffic.models.TrafficFlowSegmentDataFlowSegmentDataCoordinates + :ivar version: This indicates the software version that generated the response. + :vartype version: str + :ivar open_lr_code: OpenLR code for segment. See `OpenLR + `_ for more information on the use of Open LR codes. + :vartype open_lr_code: str + """ + + _validation = { + 'functional_road_class': {'readonly': True}, + 'current_speed': {'readonly': True}, + 'free_flow_speed': {'readonly': True}, + 'current_travel_time': {'readonly': True}, + 'free_flow_travel_time': {'readonly': True}, + 'confidence': {'readonly': True}, + 'version': {'readonly': True}, + 'open_lr_code': {'readonly': True}, + } + + _attribute_map = { + 'functional_road_class': {'key': 'frc', 'type': 'str'}, + 'current_speed': {'key': 'currentSpeed', 'type': 'int'}, + 'free_flow_speed': {'key': 'freeFlowSpeed', 'type': 'int'}, + 'current_travel_time': {'key': 'currentTravelTime', 'type': 'int'}, + 'free_flow_travel_time': {'key': 'freeFlowTravelTime', 'type': 'int'}, + 'confidence': {'key': 'confidence', 'type': 'float'}, + 'coordinates': {'key': 'coordinates', 'type': 'TrafficFlowSegmentDataFlowSegmentDataCoordinates'}, + 'version': {'key': '@version', 'type': 'str'}, + 'open_lr_code': {'key': 'openlr', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: Optional["TrafficFlowSegmentDataFlowSegmentDataCoordinates"] = None, + **kwargs + ): + super(TrafficFlowSegmentDataFlowSegmentData, self).__init__(**kwargs) + self.functional_road_class = None + self.current_speed = None + self.free_flow_speed = None + self.current_travel_time = None + self.free_flow_travel_time = None + self.confidence = None + self.coordinates = coordinates + self.version = None + self.open_lr_code = None + + +class TrafficFlowSegmentDataFlowSegmentDataCoordinates(msrest.serialization.Model): + """Includes the coordinates describing the shape of the segment. Coordinates are shifted from the road depending on the zoom level to support high quality visualization in every scale. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar coordinates: Coordinate array. + :vartype coordinates: list[~azure.maps.traffic.models.LatLongPair] + """ + + _validation = { + 'coordinates': {'readonly': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinate', 'type': '[LatLongPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentDataFlowSegmentDataCoordinates, self).__init__(**kwargs) + self.coordinates = None + + +class TrafficIncidentDetail(msrest.serialization.Model): + """This object is returned from a successful Traffic incident Detail call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tm: Main response element. + :vartype tm: ~azure.maps.traffic.models.TrafficIncidentDetailTm + """ + + _validation = { + 'tm': {'readonly': True}, + } + + _attribute_map = { + 'tm': {'key': 'tm', 'type': 'TrafficIncidentDetailTm'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetail, self).__init__(**kwargs) + self.tm = None + + +class TrafficIncidentDetailTm(msrest.serialization.Model): + """Main response element. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ID of the traffic model for this incident. + :vartype id: str + :ivar points_of_interest: A single traffic incident, or a cluster of traffic incidents. + :vartype points_of_interest: list[~azure.maps.traffic.models.TrafficIncidentPointOfInterest] + """ + + _validation = { + 'id': {'readonly': True}, + 'points_of_interest': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': '@id', 'type': 'str'}, + 'points_of_interest': {'key': 'poi', 'type': '[TrafficIncidentPointOfInterest]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetailTm, self).__init__(**kwargs) + self.id = None + self.points_of_interest = None + + +class TrafficIncidentPointOfInterest(msrest.serialization.Model): + """TrafficIncidentPointOfInterest. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: ID of the traffic incident. + :vartype id: str + :ivar point: The point where an icon of the cluster or raw incident should be drawn, expressed + in the requested projection. This is affected by traffic style, zoom level and road type. + :vartype point: ~azure.maps.traffic.models.Point + :ivar icon_category: The icon category associated with this incident. Values are numbers in the + range 0-13, with the following meanings -- 0: Unknown, 1: Accident, 2: Fog, 3: Dangerous + Conditions, 4: Rain, 5: Ice, 6: Jam, 7: Lane Closed, 8: Road Closed, 9: Road Works, 10: Wind, + 11: Flooding, 12: Detour, 13: Cluster. Possible values include: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14. + :vartype icon_category: str or ~azure.maps.traffic.models.IconCategory + :ivar magnitude_of_delay: The magnitude of delay associated with incident. These values + correspond to incident colors in the traffic tiles. Possible values include: 0, 1, 2, 3, 4. + :vartype magnitude_of_delay: str or ~azure.maps.traffic.models.DelayMagnitude + :ivar bottom_left_coordinate: Bottom left coordinate of the cluster in the projection of the + request. + :vartype bottom_left_coordinate: ~azure.maps.traffic.models.Point + :ivar top_left_coordinate: Top right coordinate of the cluster in the projection of the + request. + :vartype top_left_coordinate: ~azure.maps.traffic.models.Point + :ivar cluster_size: Cluster size: the number of incidents in the cluster. + :vartype cluster_size: int + :ivar length_in_meters: Length of the incident in meters. + :vartype length_in_meters: int + :ivar road_numbers: The road number(s) affected by the incident. Multiple road numbers will + delimited by slashes. + :vartype road_numbers: str + :ivar start_date: Start date of the incident, if available. The date is described in the + ISO8601 format. + :vartype start_date: ~datetime.datetime + :ivar end_date: Estimated end date of the incident, if available. The date is described in the + ISO8601 format. + :vartype end_date: ~datetime.datetime + :ivar delay_in_seconds: Delay caused by the incident in seconds (except in road closures). + :vartype delay_in_seconds: int + :ivar traffic_end_location: To: the name of the intersection or location where the traffic due + to the incident ends. + :vartype traffic_end_location: str + :ivar traffic_start_location: From: the name of the intersection or location where the traffic + due to the incident starts. + :vartype traffic_start_location: str + :ivar description: Description of the incident in the language requested. + :vartype description: str + :ivar cause: Cause of the incident, where available, in the language requested. + :vartype cause: str + """ + + _validation = { + 'id': {'readonly': True}, + 'point': {'readonly': True}, + 'icon_category': {'readonly': True}, + 'magnitude_of_delay': {'readonly': True}, + 'bottom_left_coordinate': {'readonly': True}, + 'top_left_coordinate': {'readonly': True}, + 'cluster_size': {'readonly': True}, + 'length_in_meters': {'readonly': True}, + 'road_numbers': {'readonly': True}, + 'start_date': {'readonly': True}, + 'end_date': {'readonly': True}, + 'delay_in_seconds': {'readonly': True}, + 'traffic_end_location': {'readonly': True}, + 'traffic_start_location': {'readonly': True}, + 'description': {'readonly': True}, + 'cause': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'point': {'key': 'p', 'type': 'Point'}, + 'icon_category': {'key': 'ic', 'type': 'int'}, + 'magnitude_of_delay': {'key': 'ty', 'type': 'int'}, + 'bottom_left_coordinate': {'key': 'cbl', 'type': 'Point'}, + 'top_left_coordinate': {'key': 'ctr', 'type': 'Point'}, + 'cluster_size': {'key': 'cs', 'type': 'int'}, + 'length_in_meters': {'key': 'l', 'type': 'int'}, + 'road_numbers': {'key': 'r', 'type': 'str'}, + 'start_date': {'key': 'sd', 'type': 'iso-8601'}, + 'end_date': {'key': 'ed', 'type': 'iso-8601'}, + 'delay_in_seconds': {'key': 'dl', 'type': 'int'}, + 'traffic_end_location': {'key': 't', 'type': 'str'}, + 'traffic_start_location': {'key': 'f', 'type': 'str'}, + 'description': {'key': 'd', 'type': 'str'}, + 'cause': {'key': 'c', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentPointOfInterest, self).__init__(**kwargs) + self.id = None + self.point = None + self.icon_category = None + self.magnitude_of_delay = None + self.bottom_left_coordinate = None + self.top_left_coordinate = None + self.cluster_size = None + self.length_in_meters = None + self.road_numbers = None + self.start_date = None + self.end_date = None + self.delay_in_seconds = None + self.traffic_end_location = None + self.traffic_start_location = None + self.description = None + self.cause = None + + +class TrafficIncidentViewport(msrest.serialization.Model): + """This object is returned from a successful Traffic Incident Viewport call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar viewp_resp: Viewport Response object. + :vartype viewp_resp: ~azure.maps.traffic.models.TrafficIncidentViewportViewpResp + """ + + _validation = { + 'viewp_resp': {'readonly': True}, + } + + _attribute_map = { + 'viewp_resp': {'key': 'viewpResp', 'type': 'TrafficIncidentViewportViewpResp'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewport, self).__init__(**kwargs) + self.viewp_resp = None + + +class TrafficIncidentViewportViewpResp(msrest.serialization.Model): + """Viewport Response object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar traffic_state: Traffic State information. + :vartype traffic_state: ~azure.maps.traffic.models.TrafficState + :ivar copyright_information: When the copyright parameter value is true, this contains the full + text of the copyright information that must be displayed with the tiles in the viewport. + :vartype copyright_information: str + :ivar version: Indicates the software version used to generate the information. For use with + support queries. + :vartype version: str + :ivar maps: Indicates the data provider's internal names for the map data used in the viewport. + For use with support queries. + :vartype maps: str + """ + + _validation = { + 'traffic_state': {'readonly': True}, + 'copyright_information': {'readonly': True}, + 'version': {'readonly': True}, + 'maps': {'readonly': True}, + } + + _attribute_map = { + 'traffic_state': {'key': 'trafficState', 'type': 'TrafficState'}, + 'copyright_information': {'key': 'copyrightIds', 'type': 'str'}, + 'version': {'key': '@version', 'type': 'str'}, + 'maps': {'key': '@maps', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewportViewpResp, self).__init__(**kwargs) + self.traffic_state = None + self.copyright_information = None + self.version = None + self.maps = None + + +class TrafficState(msrest.serialization.Model): + """Traffic State information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar traffic_age: The elapsed time (in seconds) from the Traffic Model ID creation. + :vartype traffic_age: int + :ivar traffic_model_id: The unique ID called Traffic Model ID is used in calls to Traffic + Incident services. It allows to obtain information from particular traffic updates. Traffic + Model ID is updated every minute, and is valid for two minutes before it times out. + :vartype traffic_model_id: str + """ + + _validation = { + 'traffic_age': {'readonly': True}, + 'traffic_model_id': {'readonly': True}, + } + + _attribute_map = { + 'traffic_age': {'key': '@trafficAge', 'type': 'int'}, + 'traffic_model_id': {'key': '@trafficModelId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficState, self).__init__(**kwargs) + self.traffic_age = None + self.traffic_model_id = None diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_traffic_client_enums.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_traffic_client_enums.py new file mode 100644 index 000000000000..1b2350989c0d --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_traffic_client_enums.py @@ -0,0 +1,161 @@ +# 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 DelayMagnitude(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """The magnitude of delay associated with incident. These values correspond to incident colors in + the traffic tiles + """ + + #: Unknown. + UNKNOWN = 0 + #: Minor. + MINOR = 1 + #: Moderate. + MODERATE = 2 + #: Major. + MAJOR = 3 + #: Indefinite (used for road closures and other indefinite delays). + INDEFINITE = 4 + +class IconCategory(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """The icon category associated with this incident. Values are numbers in the range 0-13, with the + following meanings -- 0: Unknown, 1: Accident, 2: Fog, 3: Dangerous Conditions, 4: Rain, 5: + Ice, 6: Jam, 7: Lane Closed, 8: Road Closed, 9: Road Works, 10: Wind, 11: Flooding, 12: Detour, + 13: Cluster + """ + + #: Unknown. + UNKNOWN = 0 + #: Accident. + ACCIDENT = 1 + #: Fog. + FOG = 2 + #: Dangerous Conditions. + DANGEROUS_CONDITIONS = 3 + #: Rain. + RAIN = 4 + #: Ice. + ICE = 5 + #: Jam. + JAM = 6 + #: Lane Closed. + LANE_CLOSED = 7 + #: Road Closed. + ROAD_CLOSED = 8 + #: Road Works. + ROAD_WORKS = 9 + #: Wind. + WIND = 10 + #: Flooding. + FLOODING = 11 + #: Detour. + DETOUR = 12 + #: Cluster: Returned if a cluster contains incidents with different icon categories. + CLUSTER = 13 + #: Broken Down Vehicle. + BROKEN_DOWN_VEHICLE = 14 + +class IncidentDetailStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Creates traffic lines with colored chevrons indicating severity. + S1 = "s1" + #: Creates plain lines with certain degree of glow. + S2 = "s2" + #: Creates plain lines with certain degree of glow, different than the s2 style. + S3 = "s3" + #: Night style. + NIGHT = "night" + +class IncidentGeometryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Places incidents precisely on the road. + ORIGINAL = "original" + #: Moves the incident slightly (depending on zoom level) to indicate specific road lanes. + SHIFTED = "shifted" + +class ProjectionStandard(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `EPSG900913 `_. + EPSG900913 = "EPSG900913" + #: `EPSG4326 `_. + EPSG4326 = "EPSG4326" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +class SpeedUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Kilometers Per Hour. + KMPH = "KMPH" + #: Miles Per Hour. + MPH = "MPH" + +class TileFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: An image in the png format. Supports zoom levels 0 through 18. + PNG = "png" + #: Vector graphic in the pbf format. Supports zoom levels 0 through 22. + PBF = "pbf" + +class TrafficFlowSegmentStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ABSOLUTE = "absolute" + RELATIVE = "relative" + RELATIVE_DELAY = "relative-delay" + +class TrafficFlowTileStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Colors will reflect the absolute speed measured. Absolute speed is the capability to access the + #: full speed. + ABSOLUTE = "absolute" + #: This is the speed relative to free-flow, highlighting areas of congestion visualizing the + #: traffic flow. Free-flow refers to conditions where there is no congestion and traffic can + #: follow the speed limits. The most used option to visualize traffic flow on a map. + RELATIVE = "relative" + #: Displays relative colors only where they are different from the free-flow speeds. This option + #: will only highlights areas of congestion. + RELATIVE_DELAY = "relative-delay" + #: Displays relative colors but a larger difference from freeflow is required for segments to + #: change the color. This mode only valid when format is png. + REDUCED_SENSITIVITY = "reduced-sensitivity" + +class TrafficIncidentTileStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Creates traffic lines with colored chevrons indicating severity. + S1 = "s1" + #: Creates plain lines with certain degree of glow. + S2 = "s2" + #: Creates plain lines with certain degree of glow, different from the s2 style. + S3 = "s3" + #: Night style. + NIGHT = "night" diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/__init__.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/__init__.py new file mode 100644 index 000000000000..bc9cb737e087 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._traffic_operations import TrafficOperations + +__all__ = [ + 'TrafficOperations', +] diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/_traffic_operations.py b/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/_traffic_operations.py new file mode 100644 index 000000000000..30ab3790c862 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/_traffic_operations.py @@ -0,0 +1,583 @@ +# 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, IO, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TrafficOperations(object): + """TrafficOperations 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.traffic.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_traffic_flow_tile( + self, + format, # type: Union[str, "_models.TileFormat"] + style, # type: Union[str, "_models.TrafficFlowTileStyle"] + zoom, # type: int + tile_index, # type: "_models.TileIndex" + thickness=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> IO + """**Traffic Flow Tile** + + **Applies to**\ : S0 and S1 pricing tiers. + + The Azure Flow Tile API serves 256 x 256 pixel tiles showing traffic flow. All tiles use the + same grid system. Because the traffic tiles use transparent images, they can be layered on top + of map tiles to create a compound display. The Flow tiles use colors to indicate either the + speed of traffic on different road segments, or the difference between that speed and the + free-flow speed on the road segment in question. + + :param format: Desired format of the response. Possible values are png & pbf. + :type format: str or ~azure.maps.traffic.models.TileFormat + :param style: .. raw:: html + +

The style to be used to render the tile.

. + :type style: str or ~azure.maps.traffic.models.TrafficFlowTileStyle + :param zoom: Zoom level for the desired tile. For *raster* tiles, value must be in the range: + 0-22 (inclusive). For *vector* tiles, value must be in the range: 0-22 (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.traffic.models.TileIndex + :param thickness: The value of the width of the line representing traffic. This value is a + multiplier and the accepted values range from 1 - 20. The default value is 10. This parameter + is not valid when format is pbf. + :type thickness: int + :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', {})) + + _x = None + _y = None + if tile_index is not None: + _x = tile_index.x + _y = tile_index.y + api_version = "1.0" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_traffic_flow_tile.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if thickness is not None: + query_parameters['thickness'] = self._serialize.query("thickness", thickness, 'int', maximum=20, minimum=1) + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_traffic_flow_tile.metadata = {'url': '/traffic/flow/tile/{format}'} # type: ignore + + def get_traffic_flow_segment( + self, + style, # type: Union[str, "_models.TrafficFlowSegmentStyle"] + zoom, # type: int + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.ResponseFormat"] + unit=None, # type: Optional[Union[str, "_models.SpeedUnit"]] + thickness=None, # type: Optional[int] + open_lr=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.TrafficFlowSegmentData" + """**Traffic Flow Segment** + + **Applies to**\ : S0 and S1 pricing tiers. + + This service provides information about the speeds and travel times of the road fragment + closest to the given coordinates. It is designed to work alongside the Flow layer of the Render + Service to support clickable flow data visualizations. With this API, the client side can + connect any place in the map with flow data on the closest road and present it to the user. + + :param style: The style to be used to render the tile. Valid values are absolute which returns + colors reflecting the absolute speed measured, relative which returns the speed relative to + free-flow, Relative-delay which displays relative speeds only where they are different from the + freeflow speeds. + :type style: str or ~azure.maps.traffic.models.TrafficFlowSegmentStyle + :param zoom: Zoom level for the desired tile. Zoom value must be in the range: 0-22 + (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param coordinates: Coordinates of the point close to the road segment. This parameter is a + list of four coordinates, containing two coordinate pairs (lat, long, lat, long), and + calculated using EPSG4326 projection. When this endpoint is called directly, coordinates are + passed in as a single string containing four coordinates, separated by commas. + :type coordinates: list[float] + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.ResponseFormat + :param unit: Unit of speed in KMPH or MPH. + :type unit: str or ~azure.maps.traffic.models.SpeedUnit + :param thickness: The value of the width of the line representing traffic. This value is a + multiplier and the accepted values range from 1 - 20. The default value is 10. + :type thickness: int + :param open_lr: Boolean on whether the response should include OpenLR code. + :type open_lr: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrafficFlowSegmentData, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficFlowSegmentData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficFlowSegmentData"] + 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_traffic_flow_segment.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['query'] = self._serialize.query("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if thickness is not None: + query_parameters['thickness'] = self._serialize.query("thickness", thickness, 'int', maximum=20, minimum=1) + if open_lr is not None: + query_parameters['openLr'] = self._serialize.query("open_lr", open_lr, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TrafficFlowSegmentData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_traffic_flow_segment.metadata = {'url': '/traffic/flow/segment/{format}'} # type: ignore + + def get_traffic_incident_tile( + self, + format, # type: Union[str, "_models.TileFormat"] + style, # type: Union[str, "_models.TrafficIncidentTileStyle"] + zoom, # type: int + tile_index, # type: "_models.TileIndex" + traffic_state=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> IO + """**Traffic Incident Tile** + + **Applies to**\ : S0 and S1 pricing tiers. + + This service serves 256 x 256 pixel tiles showing traffic incidents. All tiles use the same + grid system. Because the traffic tiles use transparent images, they can be layered on top of + map tiles to create a compound display. Traffic tiles render graphics to indicate traffic on + the roads in the specified area. + + :param format: Desired format of the response. Possible values are png & pbf. + :type format: str or ~azure.maps.traffic.models.TileFormat + :param style: The style to be used to render the tile. This parameter is not valid when format + is pbf. + :type style: str or ~azure.maps.traffic.models.TrafficIncidentTileStyle + :param zoom: Zoom level for the desired tile. For *raster* tiles, value must be in the range: + 0-22 (inclusive). For *vector* tiles, value must be in the range: 0-22 (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param tile_index: Parameter group. + :type tile_index: ~azure.maps.traffic.models.TileIndex + :param traffic_state: Reference value for the state of traffic at a particular time, obtained + from the Viewport API call, trafficModelId attribute in trafficState field. It is updated every + minute, and is valid for two minutes before it times out. Use -1 to get the most recent + traffic information. Default: most recent traffic information. + :type traffic_state: 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', {})) + + _x = None + _y = None + if tile_index is not None: + _x = tile_index.x + _y = tile_index.y + api_version = "1.0" + accept = "application/json, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_traffic_incident_tile.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x", _x, 'int') + query_parameters['y'] = self._serialize.query("y", _y, 'int') + if traffic_state is not None: + query_parameters['t'] = self._serialize.query("traffic_state", traffic_state, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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 + get_traffic_incident_tile.metadata = {'url': '/traffic/incident/tile/{format}'} # type: ignore + + def get_traffic_incident_detail( + self, + style, # type: Union[str, "_models.IncidentDetailStyle"] + boundingbox, # type: List[float] + bounding_zoom, # type: int + trafficmodelid, # type: str + format="json", # type: Union[str, "_models.ResponseFormat"] + language=None, # type: Optional[str] + projection=None, # type: Optional[Union[str, "_models.ProjectionStandard"]] + geometries=None, # type: Optional[Union[str, "_models.IncidentGeometryType"]] + expand_cluster=None, # type: Optional[bool] + original_position=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.TrafficIncidentDetail" + """**Traffic Incident Detail** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API provides information on traffic incidents inside a given bounding box, based on the + current Traffic Model ID. The Traffic Model ID is available to grant synchronization of data + between calls and API's. The Traffic Model ID is a key value for determining the currency of + traffic incidents. It is updated every minute, and is valid for two minutes before it times + out. It is used in rendering `incident tiles + `_. It can be + obtained from the `Viewport API + `_. + + :param style: The style that will be used to render the tile in Traffic `Incident Tile API + `_. This will + have an effect on the coordinates of traffic incidents in the reply. + :type style: str or ~azure.maps.traffic.models.IncidentDetailStyle + :param boundingbox: The ``boundingbox`` is represented by two value pairs describing it's + corners (first pair for lower left corner and second for upper right). The pairs can either be + specified using any of the ``projection``\ 's specified below (e.g., *minY,minX,maxY,maxX*\ ) + or by two latitude-longitude pairs (e.g., *minLat,minLon,maxLat,maxLon*\ + ).:code:`
`:code:`
`NOTE: If latitude/longitude pairs are used, then the ``projection`` + parameter must be set to "EPSG4326". + :type boundingbox: list[float] + :param bounding_zoom: Zoom level for desired tile. 0 to 22 for raster tiles, 0 through 22 for + vector tiles. + :type bounding_zoom: int + :param trafficmodelid: Number referencing traffic model. This can be obtained from the + `Viewport API + `_. It is + updated every minute, and is valid for two minutes before it times out. If the wrong Traffic + Model ID is specified, the correct one will be returned by the interface. A value of -1 will + always invoke the most recent traffic model. + :type trafficmodelid: str + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.ResponseFormat + :param language: `ISO 639-1 code `_ for + the output language. Supported languages are ar, ca, cs, da, de, el, en, en-GB, en-US, es, et, + fi, fr, he, hu, id, in*, it, lt, lv, nb, nl, no, pl, pt, ro, ru, sk, sv, th, tr, zh. + + Please refer to `Supported Languages + `_ for details. When + invalid language code is provided response is returned in English. When incident cause or + description does not have translation, English description is returned. + :type language: str + :param projection: The projection used to specify the coordinates in the request and response. + `EPSG900913 `_ (default) or + `EPSG4326 `_. + :type projection: str or ~azure.maps.traffic.models.ProjectionStandard + :param geometries: The type of vector geometry added to incidents (returned in the :code:`` + element of the response). + :type geometries: str or ~azure.maps.traffic.models.IncidentGeometryType + :param expand_cluster: Boolean to indicate whether to list all traffic incidents in a cluster + separately. + :type expand_cluster: bool + :param original_position: Boolean on whether to return the original position of the incident + (:code:``) as well as the one shifted to the beginning of the traffic tube (:code:``). + :type original_position: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrafficIncidentDetail, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentDetail + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentDetail"] + 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_traffic_incident_detail.metadata['url'] # type: ignore + path_format_arguments = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['boundingbox'] = self._serialize.query("boundingbox", boundingbox, '[float]', div=',') + query_parameters['boundingZoom'] = self._serialize.query("bounding_zoom", bounding_zoom, 'int', maximum=22, minimum=0) + query_parameters['trafficmodelid'] = self._serialize.query("trafficmodelid", trafficmodelid, 'str') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if projection is not None: + query_parameters['projection'] = self._serialize.query("projection", projection, 'str') + if geometries is not None: + query_parameters['geometries'] = self._serialize.query("geometries", geometries, 'str') + if expand_cluster is not None: + query_parameters['expandCluster'] = self._serialize.query("expand_cluster", expand_cluster, 'bool') + if original_position is not None: + query_parameters['originalPosition'] = self._serialize.query("original_position", original_position, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TrafficIncidentDetail', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_traffic_incident_detail.metadata = {'url': '/traffic/incident/detail/{format}'} # type: ignore + + def get_traffic_incident_viewport( + self, + boundingbox, # type: List[float] + boundingzoom, # type: int + overviewbox, # type: List[float] + overviewzoom, # type: int + format="json", # type: Union[str, "_models.ResponseFormat"] + copyright=True, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.TrafficIncidentViewport" + """**Traffic Incident Viewport** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns legal and technical information for the viewport described in the request. It + should be called by client applications whenever the viewport changes (for instance, through + zooming, panning, going to a location, or displaying a route). The request should contain the + bounding box and zoom level of the viewport whose information is needed. The return will + contain map version information, as well as the current Traffic Model ID and copyright IDs. + The Traffic Model ID returned by the Viewport Description is used by other APIs to retrieve + last traffic information for further processing. + + :param boundingbox: Bounding box of the map viewport in `EPSG900913 + `_ projection. The ``boundingbox`` + is represented by two value pairs describing it's corners (first pair for lower left corner and + second for upper right). When this endpoint is called directly, all values should be separated + by commas (e.g., *minY,minX,maxY,maxX*\ ). The maximum size of the bounding box that can be + passed is dependent on the requested zoom level. The width and height cannot exceed 4092 pixels + when rendered on the given zoom level.:code:`
`:code:`
`NOTE: Bounding boxes that cross + the 180° meridian require special treatment. For such boxes, the eastern *maxX* value will be + negative, and thus less than the *minX* value west of the 180° meridian. To address that, the + value 40075016.6855874 should be added to the true *maxX* value before it is passed in the + request. + :type boundingbox: list[float] + :param boundingzoom: Zoom level of the map viewport. Used to determine whether the view can be + zoomed in. + :type boundingzoom: int + :param overviewbox: Bounding box of the overview map in `EPSG900913 + `_ + projection.:code:`
`:code:`
`Used in case the overview box/mini map has different + copyright data than the main map. If there is no mini map, the same coordinates as + ``boundingBox`` is used. When this endpoint is called directly, coordinates are passed in as a + single string containing four coordinates, separated by commas. + :type overviewbox: list[float] + :param overviewzoom: Zoom level of the overview map. If there is no mini map, use the same zoom + level as boundingZoom. + :type overviewzoom: int + :param format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.ResponseFormat + :param copyright: Determines what copyright information to return. When true the copyright text + is returned; when false only the copyright index is returned. + :type copyright: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TrafficIncidentViewport, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentViewport + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentViewport"] + 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_traffic_incident_viewport.metadata['url'] # type: ignore + path_format_arguments = { + '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['boundingbox'] = self._serialize.query("boundingbox", boundingbox, '[float]', div=',') + query_parameters['boundingzoom'] = self._serialize.query("boundingzoom", boundingzoom, 'int', maximum=22, minimum=0) + query_parameters['overviewbox'] = self._serialize.query("overviewbox", overviewbox, '[float]', div=',') + query_parameters['overviewzoom'] = self._serialize.query("overviewzoom", overviewzoom, 'int', maximum=22, minimum=0) + if copyright is not None: + query_parameters['copyright'] = self._serialize.query("copyright", copyright, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('TrafficIncidentViewport', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_traffic_incident_viewport.metadata = {'url': '/traffic/incident/viewport/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-traffic/azure/maps/traffic/py.typed b/sdk/maps/azure-maps-traffic/azure/maps/traffic/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-traffic/sdk_packaging.toml b/sdk/maps/azure-maps-traffic/sdk_packaging.toml new file mode 100644 index 000000000000..811a2e3c5df7 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-traffic" +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-traffic/setup.cfg b/sdk/maps/azure-maps-traffic/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-traffic/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-traffic/setup.py b/sdk/maps/azure-maps-traffic/setup.py new file mode 100644 index 000000000000..4dd2ccdff666 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/setup.py @@ -0,0 +1,90 @@ +#!/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-traffic" +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.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'], + } +) diff --git a/sdk/maps/azure-maps-weather/CHANGELOG.md b/sdk/maps/azure-maps-weather/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/maps/azure-maps-weather/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/maps/azure-maps-weather/LICENSE.txt b/sdk/maps/azure-maps-weather/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/maps/azure-maps-weather/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/maps/azure-maps-weather/MANIFEST.in b/sdk/maps/azure-maps-weather/MANIFEST.in new file mode 100644 index 000000000000..b954cce330c9 --- /dev/null +++ b/sdk/maps/azure-maps-weather/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 +include LICENSE.txt diff --git a/sdk/maps/azure-maps-weather/README.md b/sdk/maps/azure-maps-weather/README.md new file mode 100644 index 000000000000..afd2ea570c4c --- /dev/null +++ b/sdk/maps/azure-maps-weather/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.6+. +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-weather%2FREADME.png) diff --git a/sdk/maps/azure-maps-weather/_meta.json b/sdk/maps/azure-maps-weather/_meta.json new file mode 100644 index 000000000000..e4e13c9332be --- /dev/null +++ b/sdk/maps/azure-maps-weather/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "5d66051664eaf014195185293278d3907699b5e1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Weather/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/Weather/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-weather/azure/__init__.py b/sdk/maps/azure-maps-weather/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-weather/azure/maps/__init__.py b/sdk/maps/azure-maps-weather/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/__init__.py b/sdk/maps/azure-maps-weather/azure/maps/weather/__init__.py new file mode 100644 index 000000000000..ad3c3b6be5b2 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/__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 ._weather_client import WeatherClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['WeatherClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/_configuration.py b/sdk/maps/azure-maps-weather/azure/maps/weather/_configuration.py new file mode 100644 index 000000000000..2d541f504a46 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/_configuration.py @@ -0,0 +1,68 @@ +# 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 + + from azure.core.credentials import TokenCredential + + +class WeatherClientConfiguration(Configuration): + """Configuration for WeatherClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(WeatherClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-weather/{}'.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-weather/azure/maps/weather/_metadata.json b/sdk/maps/azure-maps-weather/azure/maps/weather/_metadata.json new file mode 100644 index 000000000000..b53ddaffe9e9 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/_metadata.json @@ -0,0 +1,103 @@ +{ + "chosen_version": "1.0", + "total_api_version_list": ["1.0"], + "client": { + "name": "WeatherClient", + "filename": "_weather_client", + "description": "WeatherClient.", + "base_url": "\u0027https://atlas.microsoft.com\u0027", + "custom_base_url": null, + "azure_arm": false, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"WeatherClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"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\": [\"WeatherClientConfiguration\"]}}}" + }, + "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 + }, + "client_id": { + "signature": "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 + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "client_id": { + "signature": "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 + } + }, + "constant": { + }, + "call": "credential, client_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://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\"]}}, \"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\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "weather": "WeatherOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/_version.py b/sdk/maps/azure-maps-weather/azure/maps/weather/_version.py new file mode 100644 index 000000000000..b9995fb385b0 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/_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 = "1.0-preview" diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/_weather_client.py b/sdk/maps/azure-maps-weather/azure/maps/weather/_weather_client.py new file mode 100644 index 000000000000..2c6b19ed825b --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/_weather_client.py @@ -0,0 +1,85 @@ +# 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 + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import WeatherClientConfiguration +from .operations import WeatherOperations +from . import models + + +class WeatherClient(object): + """WeatherClient. + + :ivar weather: WeatherOperations operations + :vartype weather: azure.maps.weather.operations.WeatherOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + client_id=None, # type: Optional[str] + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = WeatherClientConfiguration(credential, client_id, **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.weather = WeatherOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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: () -> WeatherClient + 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-weather/azure/maps/weather/aio/__init__.py b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/__init__.py new file mode 100644 index 000000000000..3e1c7559ff00 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/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 ._weather_client import WeatherClient +__all__ = ['WeatherClient'] diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_configuration.py b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_configuration.py new file mode 100644 index 000000000000..a6ba59fd95fb --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.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 WeatherClientConfiguration(Configuration): + """Configuration for WeatherClient. + + 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 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 client_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + super(WeatherClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.client_id = client_id + self.api_version = "1.0" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-weather/{}'.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-weather/azure/maps/weather/aio/_weather_client.py b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_weather_client.py new file mode 100644 index 000000000000..19549cf660ff --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_weather_client.py @@ -0,0 +1,78 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core 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 WeatherClientConfiguration +from .operations import WeatherOperations +from .. import models + + +class WeatherClient(object): + """WeatherClient. + + :ivar weather: WeatherOperations operations + :vartype weather: azure.maps.weather.aio.operations.WeatherOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param 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 client_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + client_id: Optional[str] = None, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://atlas.microsoft.com' + self._config = WeatherClientConfiguration(credential, client_id, **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.weather = WeatherOperations( + 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 + """ + http_request.url = self._client.format_url(http_request.url) + 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) -> "WeatherClient": + 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-weather/azure/maps/weather/aio/operations/__init__.py b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/__init__.py new file mode 100644 index 000000000000..89299c2bd587 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._weather_operations import WeatherOperations + +__all__ = [ + 'WeatherOperations', +] diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/_weather_operations.py b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/_weather_operations.py new file mode 100644 index 000000000000..22e2420d5f61 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/_weather_operations.py @@ -0,0 +1,854 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WeatherOperations: + """WeatherOperations 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.weather.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_hourly_forecast( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + unit: Optional[Union[str, "_models.WeatherDataUnit"]] = None, + duration: Optional[int] = None, + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.HourlyForecastResponse": + """**Get Hourly Forecast** + + **Applies to**\ : S0 and S1 pricing tiers. + + Request detailed weather forecast by the hour for the next 1, 12, 24 (1 day), 72 (3 days), 120 + (5 days), and 240 hours (10 days) for the given the given coordinate location. The API returns + details such as temperature, humidity, wind, precipitation, and ultraviolet (UV) index. + + In S0 you can request hourly forecast for the next 1, 12, 24 hours (1 day), and 72 hours (3 + days). In S1 you can also request hourly forecast for the next 120 (5 days) and 240 hours (10 + days). + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param duration: Time frame of the returned weather forecast. By default, the forecast data for + next hour will be returned. Available values are + + + * ``1`` - Return forecast data for the next hour. Default value. + * ``12`` - Return hourly forecast for next 12 hours. + * ``24`` - Return hourly forecast for next 24 hours. + * ``72`` - Return hourly forecast for next 72 hours (3 days). + * ``120`` - Return hourly forecast for next 120 hours (5 days). Only available in S1 SKU. + * ``240`` - Return hourly forecast for next 240 hours (10 days). Only available in S1 SKU. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HourlyForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.HourlyForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HourlyForecastResponse"] + 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_hourly_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('HourlyForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hourly_forecast.metadata = {'url': '/weather/forecast/hourly/{format}'} # type: ignore + + async def get_minute_forecast( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + interval: Optional[int] = None, + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.MinuteForecastResponse": + """**Get Minute Forecast** + + **Applies to**\ : S1 pricing tier. + + Get Minute Forecast service returns minute-by-minute forecasts for a given location for the + next 120 minutes. Users can request weather forecasts in the interval of 1, 5 and 15 minutes. + The response will include details such as the type of precipitation (including rain, snow, or a + mixture of both), start time, and precipitation intensity value (dBZ). + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param interval: Specifies time interval in minutes for the returned weather forecast. + Supported values are + + + * ``1`` - Retrieve forecast for 1-minute intervals. Returned by default. + * ``5`` - Retrieve forecasts for 5-minute intervals. + * ``15`` - Retrieve forecasts for 15-minute intervals. + :type interval: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MinuteForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.MinuteForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MinuteForecastResponse"] + 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_minute_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MinuteForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_minute_forecast.metadata = {'url': '/weather/forecast/minute/{format}'} # type: ignore + + async def get_quarter_day_forecast( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + unit: Optional[Union[str, "_models.WeatherDataUnit"]] = None, + duration: Optional[int] = None, + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.QuarterDayForecastResponse": + """**Get Quarter-Day Forecast** + + **Applies to**\ : S0 and S1 pricing tiers. + + Service returns detailed weather forecast by quarter-day for the next 1, 5, 10, or 15 days for + a given location. Response data is presented by quarters of the day - morning, afternoon, + evening, and overnight. Details such as temperature, humidity, wind, precipitation, and UV + index are returned. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param duration: Specifies for how many days the quester-day forecast responses are returned. + Supported values are: + + + * ``1`` - Return forecast data for the next day. Returned by default. + * ``5`` - Return forecast data for the next 5 days. + * ``10`` - Return forecast data for next 10 days. + * ``15`` - Return forecast data for the next 15 days. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuarterDayForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.QuarterDayForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuarterDayForecastResponse"] + 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_quarter_day_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('QuarterDayForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_quarter_day_forecast.metadata = {'url': '/weather/forecast/quarterDay/{format}'} # type: ignore + + async def get_current_conditions( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + unit: Optional[Union[str, "_models.WeatherDataUnit"]] = None, + details: Optional[str] = None, + duration: Optional[int] = None, + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.CurrentConditionsResponse": + """**Get Current Conditions** + + **Applies to**\ : S0 and S1 pricing tiers. + + Get Current Conditions service returns detailed current weather conditions such as + precipitation, temperature and wind for a given coordinate location. Also, observations from + the past 6 or 24 hours for a particular location can be retrieved. The basic information + returned with the response include details such as observation date and time, brief description + of the weather conditions, weather icon, precipitation indicator flags, and temperature. + Additional details such as RealFeel™ Temperature and UV index are also returned. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param details: Return full details for the current conditions. Available values are + + + * ``true`` - Returns full details. By default all details are returned. + * ``false`` - Returns a truncated version of the current condition data, which includes + observation date time, weather phrase, icon code, precipitation indicator flag, and + temperature. + :type details: str + :param duration: Time frame of the returned weather conditions. By default, the most current + weather conditions will be returned. Default value is 0. Supported values are: + + + * ``0`` - Return the most current weather conditions. + * ``6`` - Return weather conditions from past 6 hours. + * ``24`` - Return weather conditions from past 24 hours. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CurrentConditionsResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.CurrentConditionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CurrentConditionsResponse"] + 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_current_conditions.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('CurrentConditionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_current_conditions.metadata = {'url': '/weather/currentConditions/{format}'} # type: ignore + + async def get_daily_forecast( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + unit: Optional[Union[str, "_models.WeatherDataUnit"]] = None, + duration: Optional[int] = None, + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.DailyForecastResponse": + """**Get Daily Forecast** + + **Applies to**\ : S0 and S1 pricing tiers. + + The service returns detailed weather forecast such as temperature and wind by day for the next + 1, 5, 10, 15, 25, or 45 days for a given coordinate location. The response include details + such as temperature, wind, precipitation, air quality, and UV index. + + In S0 you can request daily forecast for the next 1, 5, 10, and 15 days. In S1 you can also + request daily forecast for the next 25 days, and 45 days. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param duration: Specifies for how many days the daily forecast responses are returned. + Available values are + + + * ``1`` - Return forecast data for the next day. Returned by default. + * ``5`` - Return forecast data for the next 5 days. + * ``10`` - Return forecast data for the next 10 days. + * ``25`` - Return forecast data for the next 25 days. Only available in S1 SKU. + * ``45`` - Return forecast data for the next 45 days. Only available in S1 SKU. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DailyForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.DailyForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DailyForecastResponse"] + 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_daily_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('DailyForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_daily_forecast.metadata = {'url': '/weather/forecast/daily/{format}'} # type: ignore + + async def get_weather_along_route( + self, + query: str, + format: Union[str, "_models.JsonFormat"] = "json", + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.WeatherAlongRouteResponse": + """**Get Weather along route** + + **Applies to**\ : S1 pricing tier. + + Weather along a route API returns hyper local (one kilometer or less), up-to-the-minute + weather nowcasts, weather hazard assessments, and notifications along a route described as a + sequence of waypoints. + This includes a list of weather hazards affecting the waypoint or route, and the aggregated + hazard index for each waypoint might be used to paint each portion of a route according to how + safe it is for the driver. When submitting the waypoints, it is recommended to stay within, or + close to, the distance that can be traveled within 120-mins or shortly after. Data is updated + every five minutes. + + The service supplements Azure Maps `Route Service + `_ that allows you to first request a route + between an origin and a destination and use that as an input for Weather Along Route endpoint. + + In addition, the service supports scenarios to generate weather notifications for waypoints + that experience an increase in intensity of a weather hazard. For example, if the vehicle is + expected to begin experiencing heavy rain as it reaches a waypoint, a weather notification for + heavy rain will be generated for that waypoint allowing the end product to display a heavy rain + notification before the driver reaches that waypoint. + The trigger for when to display the notification for a waypoint could be based, for example, + on a `geofence `_\ , or + selectable distance to the waypoint. + + The API covers all regions of the planet except latitudes above Greenland and Antarctica. + + :param query: Coordinates through which the route is calculated, separated by colon (:) and + entered in chronological order. A minimum of two waypoints is required. A single API call may + contain up to 60 waypoints. + A waypoint indicates location, ETA, and optional heading: latitude,longitude,ETA,heading, + where + + + * ``Latitude`` - Latitude coordinate in decimal degrees. + * ``Longitude`` - Longitude coordinate in decimal degrees. + * ``ETA (estimated time of arrival)`` - The number of minutes from the present time that it + will take for the vehicle to reach the waypoint. Allowed range is from 0.0 to 120.0 minutes. + * ``Heading`` - An optional value indicating the vehicle heading as it passes the waypoint. + Expressed in clockwise degrees relative to true north. This is issued to calculate sun glare as + a driving hazard. Allowed range is from 0.0 to 360.0 degrees. If not provided, a heading will + automatically be derived based on the position of neighboring waypoints. + + It is recommended to stay within, or close to, the distance that can be traveled within + 120-mins or shortly after. This way a more accurate assessment can be provided for the trip and + prevent isolated events not being captured between waypoints. Information can and should be + updated along the route (especially for trips greater than 2 hours) to continuously pull new + waypoints moving forward, but also to ensure that forecast information for content such as + precipitation type and intensity is accurate as storms develop and dissipate over time. + :type query: str + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WeatherAlongRouteResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.WeatherAlongRouteResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WeatherAlongRouteResponse"] + 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_weather_along_route.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('WeatherAlongRouteResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_weather_along_route.metadata = {'url': '/weather/route/{format}'} # type: ignore + + async def get_severe_weather_alerts( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + language: Optional[str] = None, + details: Optional[str] = None, + **kwargs: Any + ) -> "_models.SevereWeatherAlertsResponse": + """**Get Severe Weather Alerts** + + **Applies to**\ : S0 and S1 pricing tiers. + + Severe weather phenomenon can significantly impact our everyday life and business operations. + For example, severe weather conditions such as tropical storms, high winds or flooding can + close roads and force logistics companies to reroute their fleet causing delays in reaching + destinations and breaking the cold chain of refrigerated food products.  Azure Maps + Severe Weather Alerts API returns the severe weather alerts that are available worldwide + from both official Government Meteorological Agencies and leading global to + regional weather alert providers. The service can return details such as alert type, category, + level and detailed description about the active severe alerts for the requested location, like + hurricanes, thunderstorms, lightning, heat waves or forest fires. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param details: Return full details for the severe weather alerts. Available values are + + + * ``true`` - Returns full details. By default all details are returned. + * ``false`` - Returns a truncated version of the alerts data, which excludes the area-specific + full description of alert details (\ ``alertDetails``\ ). + :type details: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SevereWeatherAlertsResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.SevereWeatherAlertsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SevereWeatherAlertsResponse"] + 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_severe_weather_alerts.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SevereWeatherAlertsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_severe_weather_alerts.metadata = {'url': '/weather/severe/alerts/{format}'} # type: ignore + + async def get_daily_indices( + self, + coordinates: List[float], + format: Union[str, "_models.JsonFormat"] = "json", + language: Optional[str] = None, + duration: Optional[int] = None, + index_id: Optional[int] = None, + index_group_id: Optional[int] = None, + **kwargs: Any + ) -> "_models.DailyIndicesResponse": + """**Get Daily Indices** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you want to know if the weather conditions are optimal for a specific + activity, for example, for outdoor construction, indoor activities, running or farming + including soil moisture information. Azure Maps Indices API returns index values that will + guide end users to plan future activities. For example, a health mobile application can notify + users that today is good weather for running or for other outdoors activities like for playing + golf, and retail stores can optimize their digital marketing campaigns based on predicted index + values. The service returns in daily indices values for current and next 5, 10 and 15 days + starting from current day. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param duration: Specifies for how many days the daily indices are returned. By default, the + indices data for the current day will be returned. When requesting future indices data, the + current day is included in the response as day 1. Available values are + + + * ``1`` - Return daily index data for the current day. Default value. + * ``5`` - Return 5 days of daily index data starting from the current day. + * ``10`` - Return 10 days of daily index data starting from the current day. + * ``15`` - Return 15 days of daily index data starting from the current day. + :type duration: int + :param index_id: Numeric index identifier that can be used for restricting returned results to + the corresponding index type. Cannot be paired with ``indexGroupId``. Please refer to `Weather + Service Concepts `_ for details and to see the + supported indices. + :type index_id: int + :param index_group_id: Numeric index group identifier that can be used for restricting returned + results to the corresponding subset of indices (index group). Cannot be paired with + ``indexId``. Please refer to `Weather Service Concepts + `_ for details and to see the supported index groups. + :type index_group_id: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DailyIndicesResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.DailyIndicesResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DailyIndicesResponse"] + 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_daily_indices.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if index_id is not None: + query_parameters['indexId'] = self._serialize.query("index_id", index_id, 'int') + if index_group_id is not None: + query_parameters['indexGroupId'] = self._serialize.query("index_group_id", index_group_id, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('DailyIndicesResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_daily_indices.metadata = {'url': '/weather/indices/daily/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/models/__init__.py b/sdk/maps/azure-maps-weather/azure/maps/weather/models/__init__.py new file mode 100644 index 000000000000..06859788f938 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/__init__.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AirAndPollen + from ._models_py3 import AlertDetails + from ._models_py3 import ColorValue + from ._models_py3 import CurrentConditions + from ._models_py3 import CurrentConditionsResponse + from ._models_py3 import DailyForecast + from ._models_py3 import DailyForecastDetail + from ._models_py3 import DailyForecastResponse + from ._models_py3 import DailyForecastSummary + from ._models_py3 import DailyIndex + from ._models_py3 import DailyIndicesResponse + from ._models_py3 import DegreeDaySummary + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import ForecastInterval + from ._models_py3 import HazardDetail + from ._models_py3 import HourlyForecast + from ._models_py3 import HourlyForecastResponse + from ._models_py3 import IntervalSummary + from ._models_py3 import LatestStatus + from ._models_py3 import LocalSource + from ._models_py3 import MinuteForecastResponse + from ._models_py3 import MinuteForecastSummary + from ._models_py3 import PastHoursTemperature + from ._models_py3 import PrecipitationSummary + from ._models_py3 import PressureTendency + from ._models_py3 import QuarterDayForecast + from ._models_py3 import QuarterDayForecastResponse + from ._models_py3 import SevereWeatherAlert + from ._models_py3 import SevereWeatherAlertDescription + from ._models_py3 import SevereWeatherAlertsResponse + from ._models_py3 import SunGlare + from ._models_py3 import TemperatureSummary + from ._models_py3 import WaypointForecast + from ._models_py3 import WeatherAlongRoutePrecipitation + from ._models_py3 import WeatherAlongRouteResponse + from ._models_py3 import WeatherAlongRouteSummary + from ._models_py3 import WeatherHazards + from ._models_py3 import WeatherNotification + from ._models_py3 import WeatherValue + from ._models_py3 import WeatherValueRange + from ._models_py3 import WindDetails + from ._models_py3 import WindDirection + from ._models_py3 import WindSpeed +except (SyntaxError, ImportError): + from ._models import AirAndPollen # type: ignore + from ._models import AlertDetails # type: ignore + from ._models import ColorValue # type: ignore + from ._models import CurrentConditions # type: ignore + from ._models import CurrentConditionsResponse # type: ignore + from ._models import DailyForecast # type: ignore + from ._models import DailyForecastDetail # type: ignore + from ._models import DailyForecastResponse # type: ignore + from ._models import DailyForecastSummary # type: ignore + from ._models import DailyIndex # type: ignore + from ._models import DailyIndicesResponse # type: ignore + from ._models import DegreeDaySummary # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ForecastInterval # type: ignore + from ._models import HazardDetail # type: ignore + from ._models import HourlyForecast # type: ignore + from ._models import HourlyForecastResponse # type: ignore + from ._models import IntervalSummary # type: ignore + from ._models import LatestStatus # type: ignore + from ._models import LocalSource # type: ignore + from ._models import MinuteForecastResponse # type: ignore + from ._models import MinuteForecastSummary # type: ignore + from ._models import PastHoursTemperature # type: ignore + from ._models import PrecipitationSummary # type: ignore + from ._models import PressureTendency # type: ignore + from ._models import QuarterDayForecast # type: ignore + from ._models import QuarterDayForecastResponse # type: ignore + from ._models import SevereWeatherAlert # type: ignore + from ._models import SevereWeatherAlertDescription # type: ignore + from ._models import SevereWeatherAlertsResponse # type: ignore + from ._models import SunGlare # type: ignore + from ._models import TemperatureSummary # type: ignore + from ._models import WaypointForecast # type: ignore + from ._models import WeatherAlongRoutePrecipitation # type: ignore + from ._models import WeatherAlongRouteResponse # type: ignore + from ._models import WeatherAlongRouteSummary # type: ignore + from ._models import WeatherHazards # type: ignore + from ._models import WeatherNotification # type: ignore + from ._models import WeatherValue # type: ignore + from ._models import WeatherValueRange # type: ignore + from ._models import WindDetails # type: ignore + from ._models import WindDirection # type: ignore + from ._models import WindSpeed # type: ignore + +from ._weather_client_enums import ( + DayQuarter, + HazardIndex, + IconCode, + JsonFormat, + LatestStatusKeyword, + PrecipitationType, + UnitType, + WeatherDataUnit, +) + +__all__ = [ + 'AirAndPollen', + 'AlertDetails', + 'ColorValue', + 'CurrentConditions', + 'CurrentConditionsResponse', + 'DailyForecast', + 'DailyForecastDetail', + 'DailyForecastResponse', + 'DailyForecastSummary', + 'DailyIndex', + 'DailyIndicesResponse', + 'DegreeDaySummary', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ForecastInterval', + 'HazardDetail', + 'HourlyForecast', + 'HourlyForecastResponse', + 'IntervalSummary', + 'LatestStatus', + 'LocalSource', + 'MinuteForecastResponse', + 'MinuteForecastSummary', + 'PastHoursTemperature', + 'PrecipitationSummary', + 'PressureTendency', + 'QuarterDayForecast', + 'QuarterDayForecastResponse', + 'SevereWeatherAlert', + 'SevereWeatherAlertDescription', + 'SevereWeatherAlertsResponse', + 'SunGlare', + 'TemperatureSummary', + 'WaypointForecast', + 'WeatherAlongRoutePrecipitation', + 'WeatherAlongRouteResponse', + 'WeatherAlongRouteSummary', + 'WeatherHazards', + 'WeatherNotification', + 'WeatherValue', + 'WeatherValueRange', + 'WindDetails', + 'WindDirection', + 'WindSpeed', + 'DayQuarter', + 'HazardIndex', + 'IconCode', + 'JsonFormat', + 'LatestStatusKeyword', + 'PrecipitationType', + 'UnitType', + 'WeatherDataUnit', +] diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models.py b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models.py new file mode 100644 index 000000000000..cd9d0b709420 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models.py @@ -0,0 +1,1969 @@ +# 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 AirAndPollen(msrest.serialization.Model): + """AirAndPollen. + + :param description: Name of the pollen or pollutant. For example, grass, mold, weed, air + quality, tree and UV index. + :type description: str + :param value: Value of the given type above. Values associated with mold, grass, weed and tree + are in units of parts per cubic meter. Both air quality and UV are indices, so they are + unitless. + :type value: int + :param category: Category of the air quality or pollution type. For example, low, high, good, + moderate, unhealthy, hazardous. + :type category: str + :param category_value: Value associated with the air quality or pollution category. These + values range from 1 to 6. 1 implying good conditions, 6 implying hazardous conditions. + :type category_value: int + :param air_quality_type: Only exists for air quality. Examples include ozone and particle + pollution. + :type air_quality_type: str + """ + + _attribute_map = { + 'description': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + 'category': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + 'air_quality_type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AirAndPollen, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.value = kwargs.get('value', None) + self.category = kwargs.get('category', None) + self.category_value = kwargs.get('category_value', None) + self.air_quality_type = kwargs.get('air_quality_type', None) + + +class AlertDetails(msrest.serialization.Model): + """Information about a severe weather alert issued within an affected area(s). If multiple alerts are active for the same location, the alerts will be returned in order of ``priority`` within the API response, with the highest priority alert being returned at the top of the response. + + :param name: The name of an area which is affected by the alert. The location that was + requested falls under the alert area. + :type name: str + :param description: Text summarizing the alert in the returned area. + :type description: str + :param start_time: The start date and time of the alert in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. If the alert crosses multiple time zones the returned time in the + response is the local time to the requested coordinate location. + :type start_time: ~datetime.datetime + :param end_time: The end date and time of the alert in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. If the alert crosses multiple time zones the returned time in the + response is the local time to the requested coordinate location. + :type end_time: ~datetime.datetime + :param latest_status: The latest status of the alert in the current area. + :type latest_status: ~azure.maps.weather.models.LatestStatus + :param details: Full details associated with the alert. Returned if ``details``\ =True. This + field is always returned in the language(s) of choice by the issuing provider and Azure Maps + only returns what is created by the provider. Please note, some countries/regions may offer + their native language and English. Language parameter won’t apply to this field. + :type details: str + :param language: Language of the ``alertDetails``. This field helps to point out that the + language of the ``alertDetails`` may differ from the requested language parameter. Returned if + ``details``\ =True. Language code has been derived from the ISO 639-1 Alpha-2 codes. + :type language: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'summary', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'latest_status': {'key': 'latestStatus', 'type': 'LatestStatus'}, + 'details': {'key': 'alertDetails', 'type': 'str'}, + 'language': {'key': 'alertDetailsLanguageCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertDetails, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.description = kwargs.get('description', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.latest_status = kwargs.get('latest_status', None) + self.details = kwargs.get('details', None) + self.language = kwargs.get('language', None) + + +class ColorValue(msrest.serialization.Model): + """ColorValue. + + :param red: Red component of the RGB value. + :type red: int + :param green: Green component of the RGB value. + :type green: int + :param blue: Blue component of the RGB value. + :type blue: int + :param hex: Hexadecimal color value. + :type hex: str + """ + + _attribute_map = { + 'red': {'key': 'red', 'type': 'int'}, + 'green': {'key': 'green', 'type': 'int'}, + 'blue': {'key': 'blue', 'type': 'int'}, + 'hex': {'key': 'hex', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ColorValue, self).__init__(**kwargs) + self.red = kwargs.get('red', None) + self.green = kwargs.get('green', None) + self.blue = kwargs.get('blue', None) + self.hex = kwargs.get('hex', None) + + +class CurrentConditions(msrest.serialization.Model): + """CurrentConditions. + + :param date_time: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param description: Phrase description of the current weather condition. Displayed in + specified language. + :type description: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param is_daytime: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_daytime: bool + :param temperature: Temperature being returned. + :type temperature: ~azure.maps.weather.models.WeatherValue + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValue + :param real_feel_temperature_shade: RealFeel™ Temperature being returned. Describes what the + temperature really feels like in the shade. + :type real_feel_temperature_shade: ~azure.maps.weather.models.WeatherValue + :param relative_humidity: Relative humidity is the amount of water vapor present in air + expressed as a percentage of the amount needed for saturation at the same temperature. + :type relative_humidity: int + :param dew_point: The dewpoint temperature in specified unit. The dewpoint temperature is the + temperature that the air must be cooled to in order to reach saturation. + :type dew_point: ~azure.maps.weather.models.WeatherValue + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param uv_index: Measure of the strength of the ultraviolet radiation from the sun. Supported + values are: + + + * ``0-2`` - Low danger from the sun's UV rays or the average person. + * ``3-5`` - Moderate risk of harm from unprotected sun exposure. + * ``6-7`` - High risk of harm from unprotected sun exposure. + * ``8-10`` - Very high risk of harm from unprotected sun exposure. + * ``11+`` - Extreme risk of harm from unprotected sun exposure. + :type uv_index: int + :param uv_index_description: Phrase associated with the ``uvIndex``. + :type uv_index_description: str + :param visibility: Visibility in specified unit. A measure of the distance at which an object + or light can be clearly discerned. + :type visibility: ~azure.maps.weather.models.WeatherValue + :param obstructions_to_visibility: Cause of limited visibility. + :type obstructions_to_visibility: str + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + :param cloud_ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the + height of the base of the lowest clouds. + :type cloud_ceiling: ~azure.maps.weather.models.WeatherValue + :param pressure: Atmospheric pressure in specified unit. + :type pressure: ~azure.maps.weather.models.WeatherValue + :param pressure_tendency: Atmospheric pressure change. + :type pressure_tendency: ~azure.maps.weather.models.PressureTendency + :param past_twenty_four_hour_temperature_departure: Departure from the temperature observed 24 + hours ago in specified unit. + :type past_twenty_four_hour_temperature_departure: ~azure.maps.weather.models.WeatherValue + :param apparent_temperature: Perceived outdoor temperature caused by the combination of air + temperature, relative humidity, and wind speed in specified unit. + :type apparent_temperature: ~azure.maps.weather.models.WeatherValue + :param wind_chill_temperature: Perceived air temperature on exposed skin due to wind. + :type wind_chill_temperature: ~azure.maps.weather.models.WeatherValue + :param wet_bulb_temperature: The temperature to which air may be cooled by evaporating water + into it at constant pressure until it reaches saturation. + :type wet_bulb_temperature: ~azure.maps.weather.models.WeatherValue + :param precipitation_summary: Summary of precipitation amounts over the past 24 hours. + :type precipitation_summary: ~azure.maps.weather.models.PrecipitationSummary + :param temperature_summary: Summary of temperature fluctuations over the past 6, 12, and 24 + hours. + :type temperature_summary: ~azure.maps.weather.models.TemperatureSummary + """ + + _attribute_map = { + 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, + 'description': {'key': 'phrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'is_daytime': {'key': 'isDayTime', 'type': 'bool'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValue'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValue'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherValue'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherValue'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_description': {'key': 'uvIndexPhrase', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherValue'}, + 'obstructions_to_visibility': {'key': 'obstructionsToVisibility', 'type': 'str'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'cloud_ceiling': {'key': 'ceiling', 'type': 'WeatherValue'}, + 'pressure': {'key': 'pressure', 'type': 'WeatherValue'}, + 'pressure_tendency': {'key': 'pressureTendency', 'type': 'PressureTendency'}, + 'past_twenty_four_hour_temperature_departure': {'key': 'pastTwentyFourHourTemperatureDeparture', 'type': 'WeatherValue'}, + 'apparent_temperature': {'key': 'apparentTemperature', 'type': 'WeatherValue'}, + 'wind_chill_temperature': {'key': 'windChillTemperature', 'type': 'WeatherValue'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherValue'}, + 'precipitation_summary': {'key': 'precipitationSummary', 'type': 'PrecipitationSummary'}, + 'temperature_summary': {'key': 'temperatureSummary', 'type': 'TemperatureSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(CurrentConditions, self).__init__(**kwargs) + self.date_time = kwargs.get('date_time', None) + self.description = kwargs.get('description', None) + self.icon_code = kwargs.get('icon_code', None) + self.has_precipitation = kwargs.get('has_precipitation', None) + self.is_daytime = kwargs.get('is_daytime', None) + self.temperature = kwargs.get('temperature', None) + self.real_feel_temperature = kwargs.get('real_feel_temperature', None) + self.real_feel_temperature_shade = kwargs.get('real_feel_temperature_shade', None) + self.relative_humidity = kwargs.get('relative_humidity', None) + self.dew_point = kwargs.get('dew_point', None) + self.wind = kwargs.get('wind', None) + self.wind_gust = kwargs.get('wind_gust', None) + self.uv_index = kwargs.get('uv_index', None) + self.uv_index_description = kwargs.get('uv_index_description', None) + self.visibility = kwargs.get('visibility', None) + self.obstructions_to_visibility = kwargs.get('obstructions_to_visibility', None) + self.cloud_cover = kwargs.get('cloud_cover', None) + self.cloud_ceiling = kwargs.get('cloud_ceiling', None) + self.pressure = kwargs.get('pressure', None) + self.pressure_tendency = kwargs.get('pressure_tendency', None) + self.past_twenty_four_hour_temperature_departure = kwargs.get('past_twenty_four_hour_temperature_departure', None) + self.apparent_temperature = kwargs.get('apparent_temperature', None) + self.wind_chill_temperature = kwargs.get('wind_chill_temperature', None) + self.wet_bulb_temperature = kwargs.get('wet_bulb_temperature', None) + self.precipitation_summary = kwargs.get('precipitation_summary', None) + self.temperature_summary = kwargs.get('temperature_summary', None) + + +class CurrentConditionsResponse(msrest.serialization.Model): + """CurrentConditionsResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: Detailed current weather conditions. + :vartype results: list[~azure.maps.weather.models.CurrentConditions] + """ + + _validation = { + 'results': {'readonly': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': '[CurrentConditions]'}, + } + + def __init__( + self, + **kwargs + ): + super(CurrentConditionsResponse, self).__init__(**kwargs) + self.results = None + + +class DailyForecast(msrest.serialization.Model): + """DailyForecast. + + :param date_time: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param temperature: Temperature values for the day. + :type temperature: ~azure.maps.weather.models.WeatherValueRange + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValueRange + :param real_feel_temperature_shade: RealFeel™ Temperature being returned. Describes what the + temperature really feels like in the shade. + :type real_feel_temperature_shade: ~azure.maps.weather.models.WeatherValueRange + :param hours_of_sun: Hours of sun. + :type hours_of_sun: float + :param mean_temperature_deviation: Summary for mean temperature of Heating Degree Day or + Cooling Degree Day information. + :type mean_temperature_deviation: ~azure.maps.weather.models.DegreeDaySummary + :param air_quality: Air quality. + :type air_quality: list[~azure.maps.weather.models.AirAndPollen] + :param daytime_forecast: Day forecast detail. + :type daytime_forecast: ~azure.maps.weather.models.DailyForecastDetail + :param nighttime_forecast: Night forecast detail. + :type nighttime_forecast: ~azure.maps.weather.models.DailyForecastDetail + :param sources: Source(s) of the forecast data. + :type sources: list[str] + """ + + _attribute_map = { + 'date_time': {'key': 'date', 'type': 'iso-8601'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValueRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValueRange'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherValueRange'}, + 'hours_of_sun': {'key': 'hoursOfSun', 'type': 'float'}, + 'mean_temperature_deviation': {'key': 'degreeDaySummary', 'type': 'DegreeDaySummary'}, + 'air_quality': {'key': 'airAndPollen', 'type': '[AirAndPollen]'}, + 'daytime_forecast': {'key': 'day', 'type': 'DailyForecastDetail'}, + 'nighttime_forecast': {'key': 'night', 'type': 'DailyForecastDetail'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecast, self).__init__(**kwargs) + self.date_time = kwargs.get('date_time', None) + self.temperature = kwargs.get('temperature', None) + self.real_feel_temperature = kwargs.get('real_feel_temperature', None) + self.real_feel_temperature_shade = kwargs.get('real_feel_temperature_shade', None) + self.hours_of_sun = kwargs.get('hours_of_sun', None) + self.mean_temperature_deviation = kwargs.get('mean_temperature_deviation', None) + self.air_quality = kwargs.get('air_quality', None) + self.daytime_forecast = kwargs.get('daytime_forecast', None) + self.nighttime_forecast = kwargs.get('nighttime_forecast', None) + self.sources = kwargs.get('sources', None) + + +class DailyForecastDetail(msrest.serialization.Model): + """DailyForecastDetail. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param icon_phrase: Phrase description of the icon. Displayed in specified language. For + example, 'Sunny'. + :type icon_phrase: str + :param local_source: Local weather data provider information. + :type local_source: ~azure.maps.weather.models.LocalSource + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param precipitation_type: Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). + If dbz is zero, precipitationType is not present in the response. Possible values include: + "Rain", "Snow", "Ice", "Mix". + :type precipitation_type: str or ~azure.maps.weather.models.PrecipitationType + :param precipitation_intensity: Description of the intensity. + :type precipitation_intensity: str + :param short_description: Phrase description of the forecast in specified language. Azure Maps + attempts to keep this phrase under 30 characters in length, but some languages/weather events + may result in a longer phrase length, exceeding 30 characters. + :type short_description: str + :param long_phrase: Phrase description of the forecast in specified language. Azure Maps + attempts to keep this phrase under 100 characters in length, but some languages/weather events + may result in a longer phrase length, exceeding 100 characters. + :type long_phrase: str + :param precipitation_probability: Percent representing the probability of precipitation. For + example, '20'. + :type precipitation_probability: int + :param thunderstorm_probability: Percent representing the probability of a thunderstorm. For + example, '80'. + :type thunderstorm_probability: int + :param rain_probability: Percent representing the probability of rain. For example, '40'. + :type rain_probability: int + :param snow_probability: Percent representing the probability of snow. For example, '30'. + :type snow_probability: int + :param ice_probability: Percent representing the probability of ice. For example, '30'. + :type ice_probability: int + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param total_liquid: Total liquid equivalent of precipitation during the forecast period. + :type total_liquid: ~azure.maps.weather.models.WeatherValue + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherValue + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherValue + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherValue + :param hours_of_precipitation: Hours of precipitation. + :type hours_of_precipitation: float + :param hours_of_rain: Hours of rain. + :type hours_of_rain: float + :param hours_of_snow: Hours of snow. + :type hours_of_snow: float + :param hours_of_ice: Hours of ice. + :type hours_of_ice: float + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'icon_phrase': {'key': 'iconPhrase', 'type': 'str'}, + 'local_source': {'key': 'localSource', 'type': 'LocalSource'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'precipitation_type': {'key': 'precipitationType', 'type': 'str'}, + 'precipitation_intensity': {'key': 'precipitationIntensity', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'long_phrase': {'key': 'longPhrase', 'type': 'str'}, + 'precipitation_probability': {'key': 'precipitationProbability', 'type': 'int'}, + 'thunderstorm_probability': {'key': 'thunderstormProbability', 'type': 'int'}, + 'rain_probability': {'key': 'rainProbability', 'type': 'int'}, + 'snow_probability': {'key': 'snowProbability', 'type': 'int'}, + 'ice_probability': {'key': 'iceProbability', 'type': 'int'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'total_liquid': {'key': 'totalLiquid', 'type': 'WeatherValue'}, + 'rain': {'key': 'rain', 'type': 'WeatherValue'}, + 'snow': {'key': 'snow', 'type': 'WeatherValue'}, + 'ice': {'key': 'ice', 'type': 'WeatherValue'}, + 'hours_of_precipitation': {'key': 'hoursOfPrecipitation', 'type': 'float'}, + 'hours_of_rain': {'key': 'hoursOfRain', 'type': 'float'}, + 'hours_of_snow': {'key': 'hoursOfSnow', 'type': 'float'}, + 'hours_of_ice': {'key': 'hoursOfIce', 'type': 'float'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecastDetail, self).__init__(**kwargs) + self.icon_code = kwargs.get('icon_code', None) + self.icon_phrase = kwargs.get('icon_phrase', None) + self.local_source = kwargs.get('local_source', None) + self.has_precipitation = kwargs.get('has_precipitation', None) + self.precipitation_type = kwargs.get('precipitation_type', None) + self.precipitation_intensity = kwargs.get('precipitation_intensity', None) + self.short_description = kwargs.get('short_description', None) + self.long_phrase = kwargs.get('long_phrase', None) + self.precipitation_probability = kwargs.get('precipitation_probability', None) + self.thunderstorm_probability = kwargs.get('thunderstorm_probability', None) + self.rain_probability = kwargs.get('rain_probability', None) + self.snow_probability = kwargs.get('snow_probability', None) + self.ice_probability = kwargs.get('ice_probability', None) + self.wind = kwargs.get('wind', None) + self.wind_gust = kwargs.get('wind_gust', None) + self.total_liquid = kwargs.get('total_liquid', None) + self.rain = kwargs.get('rain', None) + self.snow = kwargs.get('snow', None) + self.ice = kwargs.get('ice', None) + self.hours_of_precipitation = kwargs.get('hours_of_precipitation', None) + self.hours_of_rain = kwargs.get('hours_of_rain', None) + self.hours_of_snow = kwargs.get('hours_of_snow', None) + self.hours_of_ice = kwargs.get('hours_of_ice', None) + self.cloud_cover = kwargs.get('cloud_cover', None) + + +class DailyForecastResponse(msrest.serialization.Model): + """DailyForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary for the main conditions for the requested time period. Notice that + summary can cover only part of the time period. + :vartype summary: ~azure.maps.weather.models.DailyForecastSummary + :ivar forecasts: Forecast data for each requested day. + :vartype forecasts: list[~azure.maps.weather.models.DailyForecast] + """ + + _validation = { + 'summary': {'readonly': True}, + 'forecasts': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'DailyForecastSummary'}, + 'forecasts': {'key': 'forecasts', 'type': '[DailyForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecastResponse, self).__init__(**kwargs) + self.summary = None + self.forecasts = None + + +class DailyForecastSummary(msrest.serialization.Model): + """Summary for the main conditions for the requested time period. Notice that summary can cover only part of the time period. + + :param start_date: Date and time that the summary is in effect, displayed in ISO 8601 format, + for example, 2019-10-27T19:39:57-08:00. + :type start_date: ~datetime.datetime + :param end_date: Date and time that the summary period ends, displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type end_date: ~datetime.datetime + :param severity: severity. + :type severity: int + :param phrase: Summary phrase of the daily forecast. Displayed in specified language. + :type phrase: str + :param category: one or 2 word(s) to summarize the phrase. + :type category: str + """ + + _attribute_map = { + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'severity': {'key': 'severity', 'type': 'int'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecastSummary, self).__init__(**kwargs) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.severity = kwargs.get('severity', None) + self.phrase = kwargs.get('phrase', None) + self.category = kwargs.get('category', None) + + +class DailyIndex(msrest.serialization.Model): + """Information about a daily index. + + :param index_name: Name of the index, for example, "Construction", "Outdoor Activity", "Flight + Delays". + :type index_name: str + :param index_id: Numeric ID used to identify the specific index. Please refer to `Weather + Service Concepts `_ for details and to see the + supported index IDs. For example, the index ID can support UI visualization scenarios. + :type index_id: int + :param date_time: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param value: Index value. Ranges from 0.0 to 10.0. Please refer to `Weather Service Concepts + `_ for details and to see the supported ranges. + :type value: float + :param category_description: Textual description for ``categoryValue`` corresponding to the + level that the index value falls under, for example "Very Good". + :type category_description: str + :param category_value: Level that the index value falls under, represented by an integer. This + value can be 1 through 5 and should be used in combination with the ``ascending`` flag because + it can differ among indices. For example, the following values apply for Mosquito Activity: + Low=1, Moderate=2, High=3, Very High=4, and Extreme=5. + :type category_value: int + :param is_ascending: Describes the direction of the ``value`` and ``categoryValue``. For + example, when set to ``true``\ , the poorest index value is 0 and the best index value is 10. + When set to ``true``\ , the poorest index value is 10 and the best index value is 0. + :type is_ascending: bool + :param description: A textual explanation that can be used for display purposes to summarize + the index value and category. For example, when the index value for Flight Delays is very good, + the description will be "Conditions are excellent for flying!". + :type description: str + """ + + _attribute_map = { + 'index_name': {'key': 'indexName', 'type': 'str'}, + 'index_id': {'key': 'indexId', 'type': 'int'}, + 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': 'float'}, + 'category_description': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + 'is_ascending': {'key': 'ascending', 'type': 'bool'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyIndex, self).__init__(**kwargs) + self.index_name = kwargs.get('index_name', None) + self.index_id = kwargs.get('index_id', None) + self.date_time = kwargs.get('date_time', None) + self.value = kwargs.get('value', None) + self.category_description = kwargs.get('category_description', None) + self.category_value = kwargs.get('category_value', None) + self.is_ascending = kwargs.get('is_ascending', None) + self.description = kwargs.get('description', None) + + +class DailyIndicesResponse(msrest.serialization.Model): + """This object is returned from a successful Get Daily Indices call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: A list of all daily indices for the queried location. + :vartype results: list[~azure.maps.weather.models.DailyIndex] + """ + + _validation = { + 'results': {'readonly': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': '[DailyIndex]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyIndicesResponse, self).__init__(**kwargs) + self.results = None + + +class DegreeDaySummary(msrest.serialization.Model): + """DegreeDaySummary. + + :param heating: Number of degrees that the mean temperature is below 65 degrees F/ 18 degree C. + :type heating: ~azure.maps.weather.models.WeatherValue + :param cooling: Number of degrees that the mean temperature is above 65 degrees F/ 18 degree C. + :type cooling: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'heating': {'key': 'heating', 'type': 'WeatherValue'}, + 'cooling': {'key': 'cooling', 'type': 'WeatherValue'}, + } + + def __init__( + self, + **kwargs + ): + super(DegreeDaySummary, self).__init__(**kwargs) + self.heating = kwargs.get('heating', None) + self.cooling = kwargs.get('cooling', None) + + +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.weather.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.weather.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.weather.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 ForecastInterval(msrest.serialization.Model): + """ForecastInterval. + + :param start_time: The date and time for the start of the interval in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type start_time: ~datetime.datetime + :param minute: The first minute for the interval. + :type minute: int + :param decibel_relative_to_z: A unit that represents forecasted precipitation intensity. + :type decibel_relative_to_z: float + :param short_description: A short phrase describing precipitation condition for the interval. + :type short_description: str + :param threshold: Key that specifies the threshold value. Along with precipitationType, can be + used to determine the simplifiedColor. If dbz is zero, not present in the response. + :type threshold: str + :param color: The full spectrum color that maps to the dBZ (decibel relative to Z). If dbz is + zero, color is not present in the response. + :type color: ~azure.maps.weather.models.ColorValue + :param simplified_color: The band color that maps to the precipitation type and threshold. If + dbz is zero, not present in the response. + :type simplified_color: ~azure.maps.weather.models.ColorValue + :param precipitation_type: Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). + If dbz is zero, precipitationType is not present in the response. Possible values include: + "Rain", "Snow", "Ice", "Mix". + :type precipitation_type: str or ~azure.maps.weather.models.PrecipitationType + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'minute': {'key': 'minute', 'type': 'int'}, + 'decibel_relative_to_z': {'key': 'dbz', 'type': 'float'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'ColorValue'}, + 'simplified_color': {'key': 'simplifiedColor', 'type': 'ColorValue'}, + 'precipitation_type': {'key': 'precipitationType', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ForecastInterval, self).__init__(**kwargs) + self.start_time = kwargs.get('start_time', None) + self.minute = kwargs.get('minute', None) + self.decibel_relative_to_z = kwargs.get('decibel_relative_to_z', None) + self.short_description = kwargs.get('short_description', None) + self.threshold = kwargs.get('threshold', None) + self.color = kwargs.get('color', None) + self.simplified_color = kwargs.get('simplified_color', None) + self.precipitation_type = kwargs.get('precipitation_type', None) + self.icon_code = kwargs.get('icon_code', None) + self.cloud_cover = kwargs.get('cloud_cover', None) + + +class HazardDetail(msrest.serialization.Model): + """HazardDetail. + + :param hazard_index: A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. Possible values include: 0, 1, 2, 3, 4. + :type hazard_index: str or ~azure.maps.weather.models.HazardIndex + :param hazard_code: A unique identifier (non-displayable) for each type of hazard: LightRain, + ModerateRain, HeavyRain, LightMix, ModerateMix, HeavyMix, LightSnow, ModerateSnow, HeavySnow, + LightIce, ModerateIce, HeavyIce, Hail, LargeHail, SunGlare, SunGlareHigh, Lightning, + SevereLightning, WindModerate, WindHigh, WindExtreme, FloodWarning, FlashFloodWarning, + TornadoWarning, TsunamiWarning, SevereThunderstormWarning. + :type hazard_code: str + :param short_description: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_description: str + """ + + _attribute_map = { + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HazardDetail, self).__init__(**kwargs) + self.hazard_index = kwargs.get('hazard_index', None) + self.hazard_code = kwargs.get('hazard_code', None) + self.short_description = kwargs.get('short_description', None) + + +class HourlyForecast(msrest.serialization.Model): + """HourlyForecast. + + :param date_time: Date and time of the forecast in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param icon_phrase: Phrase description of the weather icon. + :type icon_phrase: str + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param is_daylight: Specifies whether or not it is daylight. True indicates day light. + :type is_daylight: bool + :param temperature: Temperature being returned. + :type temperature: ~azure.maps.weather.models.WeatherValue + :param real_feel_temperature: RealFeel™ Temperature being returned. Describes what the + temperature really feels like in the shade. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValue + :param wet_bulb_temperature: The temperature to which air may be cooled by evaporating water + into it at constant pressure until it reaches saturation. + :type wet_bulb_temperature: ~azure.maps.weather.models.WeatherValue + :param dew_point: The dewpoint temperature in specified unit. The dewpoint temperature is the + temperature that the air must be cooled to in order to reach saturation. + :type dew_point: ~azure.maps.weather.models.WeatherValue + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param relative_humidity: Relative humidity is the amount of water vapor present in air + expressed as a percentage of the amount needed for saturation at the same temperature. + :type relative_humidity: int + :param visibility: Visibility in specified unit. A measure of the distance at which an object + or light can be clearly discerned. + :type visibility: ~azure.maps.weather.models.WeatherValue + :param cloud_ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the + height of the base of the lowest clouds. + :type cloud_ceiling: ~azure.maps.weather.models.WeatherValue + :param uv_index: Measure of the strength of the ultraviolet radiation from the sun. Supported + values are: + + + * ``0-2`` - Low danger from the sun's UV rays or the average person. + * ``3-5`` - Moderate risk of harm from unprotected sun exposure. + * ``6-7`` - High risk of harm from unprotected sun exposure. + * ``8-10`` - Very high risk of harm from unprotected sun exposure. + * ``11+`` - Extreme risk of harm from unprotected sun exposure. + :type uv_index: int + :param uv_index_description: Phrase associated with the ``uvIndex``. + :type uv_index_description: str + :param precipitation_probability: Percent representing the probability of precipitation. For + example, '20'. + :type precipitation_probability: int + :param rain_probability: Percent representing the probability of rain. For example, '50'. + :type rain_probability: int + :param snow_probability: Percent representing the probability of snow. For example, '50'. + :type snow_probability: int + :param ice_probability: Percent representing the probability of snow. For example, '5'. + :type ice_probability: int + :param total_liquid: Total liquid equivalent of precipitation during the forecast period. + :type total_liquid: ~azure.maps.weather.models.WeatherValue + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherValue + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherValue + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherValue + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'date_time': {'key': 'date', 'type': 'iso-8601'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'icon_phrase': {'key': 'iconPhrase', 'type': 'str'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'is_daylight': {'key': 'isDaylight', 'type': 'bool'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValue'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValue'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherValue'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherValue'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherValue'}, + 'cloud_ceiling': {'key': 'ceiling', 'type': 'WeatherValue'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_description': {'key': 'uvIndexPhrase', 'type': 'str'}, + 'precipitation_probability': {'key': 'precipitationProbability', 'type': 'int'}, + 'rain_probability': {'key': 'rainProbability', 'type': 'int'}, + 'snow_probability': {'key': 'snowProbability', 'type': 'int'}, + 'ice_probability': {'key': 'iceProbability', 'type': 'int'}, + 'total_liquid': {'key': 'totalLiquid', 'type': 'WeatherValue'}, + 'rain': {'key': 'rain', 'type': 'WeatherValue'}, + 'snow': {'key': 'snow', 'type': 'WeatherValue'}, + 'ice': {'key': 'ice', 'type': 'WeatherValue'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(HourlyForecast, self).__init__(**kwargs) + self.date_time = kwargs.get('date_time', None) + self.icon_code = kwargs.get('icon_code', None) + self.icon_phrase = kwargs.get('icon_phrase', None) + self.has_precipitation = kwargs.get('has_precipitation', None) + self.is_daylight = kwargs.get('is_daylight', None) + self.temperature = kwargs.get('temperature', None) + self.real_feel_temperature = kwargs.get('real_feel_temperature', None) + self.wet_bulb_temperature = kwargs.get('wet_bulb_temperature', None) + self.dew_point = kwargs.get('dew_point', None) + self.wind = kwargs.get('wind', None) + self.wind_gust = kwargs.get('wind_gust', None) + self.relative_humidity = kwargs.get('relative_humidity', None) + self.visibility = kwargs.get('visibility', None) + self.cloud_ceiling = kwargs.get('cloud_ceiling', None) + self.uv_index = kwargs.get('uv_index', None) + self.uv_index_description = kwargs.get('uv_index_description', None) + self.precipitation_probability = kwargs.get('precipitation_probability', None) + self.rain_probability = kwargs.get('rain_probability', None) + self.snow_probability = kwargs.get('snow_probability', None) + self.ice_probability = kwargs.get('ice_probability', None) + self.total_liquid = kwargs.get('total_liquid', None) + self.rain = kwargs.get('rain', None) + self.snow = kwargs.get('snow', None) + self.ice = kwargs.get('ice', None) + self.cloud_cover = kwargs.get('cloud_cover', None) + + +class HourlyForecastResponse(msrest.serialization.Model): + """HourlyForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar forecasts: Forecast data for each returned hour. + :vartype forecasts: list[~azure.maps.weather.models.HourlyForecast] + """ + + _validation = { + 'forecasts': {'readonly': True}, + } + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[HourlyForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(HourlyForecastResponse, self).__init__(**kwargs) + self.forecasts = None + + +class IntervalSummary(msrest.serialization.Model): + """IntervalSummary. + + :param start_minute: The first minute to which the summary applies. + :type start_minute: int + :param end_minute: The last minute to which the summary applies. + :type end_minute: int + :param total_minutes: The number of minutes for which the summary applies. + :type total_minutes: int + :param short_description: Short summary phrase. Phrase length is approximately 25 characters. + :type short_description: str + :param brief_description: Brief summary phrase. Phrase length is approximately 60 characters. + :type brief_description: str + :param long_phrase: Long summary phrase. Phrase length is 60+ characters. + :type long_phrase: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + """ + + _attribute_map = { + 'start_minute': {'key': 'startMinute', 'type': 'int'}, + 'end_minute': {'key': 'endMinute', 'type': 'int'}, + 'total_minutes': {'key': 'totalMinutes', 'type': 'int'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_description': {'key': 'briefPhrase', 'type': 'str'}, + 'long_phrase': {'key': 'longPhrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(IntervalSummary, self).__init__(**kwargs) + self.start_minute = kwargs.get('start_minute', None) + self.end_minute = kwargs.get('end_minute', None) + self.total_minutes = kwargs.get('total_minutes', None) + self.short_description = kwargs.get('short_description', None) + self.brief_description = kwargs.get('brief_description', None) + self.long_phrase = kwargs.get('long_phrase', None) + self.icon_code = kwargs.get('icon_code', None) + + +class LatestStatus(msrest.serialization.Model): + """The latest status on the alert in the current area. + + :param localized: The latest status keyword for the alert, in the specified language. By + default, returned in English (en-US). + :type localized: str + :param english: Latest status keyword for the alert, in English (en-US). Possible values + include: "New", "Extend", "Cancel", "Correct", "Expire", "Upgrade", "Continue", "Update". + :type english: str or ~azure.maps.weather.models.LatestStatusKeyword + """ + + _attribute_map = { + 'localized': {'key': 'localized', 'type': 'str'}, + 'english': {'key': 'english', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LatestStatus, self).__init__(**kwargs) + self.localized = kwargs.get('localized', None) + self.english = kwargs.get('english', None) + + +class LocalSource(msrest.serialization.Model): + """Local weather data provider information. + + :param id: Numeric identifier, unique to the local data provider. + :type id: int + :param name: Name of the local data provider. Name is displayed in the language specified by + language code in URL, if available. Otherwise, Name is displayed in English or the language in + which the name was provided. + :type name: str + :param weather_code: Weather code provided by the local data provider. This weather code allows + the forecast to be matched to icons provided by the local data provider instead of Azure Maps + icons. + :type weather_code: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'weather_code': {'key': 'weatherCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LocalSource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs.get('name', None) + self.weather_code = kwargs.get('weather_code', None) + + +class MinuteForecastResponse(msrest.serialization.Model): + """MinuteForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Phrase summaries for the entire forecast period. + :vartype summary: ~azure.maps.weather.models.MinuteForecastSummary + :ivar interval_summaries: Summary information for each interval in the forecast. The Summaries + breaks down each potential interval where precipitation starts and stops. + :vartype interval_summaries: list[~azure.maps.weather.models.IntervalSummary] + :ivar intervals: Forecast data for each interval in the forecast. + :vartype intervals: list[~azure.maps.weather.models.ForecastInterval] + """ + + _validation = { + 'summary': {'readonly': True}, + 'interval_summaries': {'readonly': True}, + 'intervals': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'MinuteForecastSummary'}, + 'interval_summaries': {'key': 'intervalSummaries', 'type': '[IntervalSummary]'}, + 'intervals': {'key': 'intervals', 'type': '[ForecastInterval]'}, + } + + def __init__( + self, + **kwargs + ): + super(MinuteForecastResponse, self).__init__(**kwargs) + self.summary = None + self.interval_summaries = None + self.intervals = None + + +class MinuteForecastSummary(msrest.serialization.Model): + """Phrase summaries for the entire forecast period. + + :param brief_phrase60: Summary phrase for the next 60 minutes. Phrase length is approximately + 60 characters. + :type brief_phrase60: str + :param short_description: Short summary phrase for the next 120 minutes. Phrase length is + approximately 25 characters. + :type short_description: str + :param brief_description: Summary phrase for the next 120 minutes. Phrase length is + approximately 60 characters. + :type brief_description: str + :param long_phrase: Long summary phrase for the next 120 minutes. Phrase length is 60+ + characters. + :type long_phrase: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + """ + + _attribute_map = { + 'brief_phrase60': {'key': 'briefPhrase60', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_description': {'key': 'briefPhrase', 'type': 'str'}, + 'long_phrase': {'key': 'longPhrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(MinuteForecastSummary, self).__init__(**kwargs) + self.brief_phrase60 = kwargs.get('brief_phrase60', None) + self.short_description = kwargs.get('short_description', None) + self.brief_description = kwargs.get('brief_description', None) + self.long_phrase = kwargs.get('long_phrase', None) + self.icon_code = kwargs.get('icon_code', None) + + +class PastHoursTemperature(msrest.serialization.Model): + """Summary of temperature fluctuations over the number of past hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherValue + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherValue'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherValue'}, + } + + def __init__( + self, + **kwargs + ): + super(PastHoursTemperature, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + + +class PrecipitationSummary(msrest.serialization.Model): + """PrecipitationSummary. + + :param past_hour: The amount of precipitation (liquid equivalent) that has fallen in the past + hour. + :type past_hour: ~azure.maps.weather.models.WeatherValue + :param past_three_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past three hours. + :type past_three_hours: ~azure.maps.weather.models.WeatherValue + :param past_six_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past six hours. Contains Metric and Imperial Values. + :type past_six_hours: ~azure.maps.weather.models.WeatherValue + :param past_nine_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past nine hours. + :type past_nine_hours: ~azure.maps.weather.models.WeatherValue + :param past_twelve_hours: The amount of precipitation (liquid equivalent) that has fallen in + the past 12 hours. + :type past_twelve_hours: ~azure.maps.weather.models.WeatherValue + :param past_eighteen_hours: The amount of precipitation (liquid equivalent) that has fallen in + the past 18 hours. + :type past_eighteen_hours: ~azure.maps.weather.models.WeatherValue + :param past_twenty_four_hours: The amount of precipitation (liquid equivalent) that has fallen + in the past 24 hours. + :type past_twenty_four_hours: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'past_hour': {'key': 'pastHour', 'type': 'WeatherValue'}, + 'past_three_hours': {'key': 'pastThreeHours', 'type': 'WeatherValue'}, + 'past_six_hours': {'key': 'pastSixHours', 'type': 'WeatherValue'}, + 'past_nine_hours': {'key': 'pastNineHours', 'type': 'WeatherValue'}, + 'past_twelve_hours': {'key': 'pastTwelveHours', 'type': 'WeatherValue'}, + 'past_eighteen_hours': {'key': 'pastEighteenHours', 'type': 'WeatherValue'}, + 'past_twenty_four_hours': {'key': 'pastTwentyFourHours', 'type': 'WeatherValue'}, + } + + def __init__( + self, + **kwargs + ): + super(PrecipitationSummary, self).__init__(**kwargs) + self.past_hour = kwargs.get('past_hour', None) + self.past_three_hours = kwargs.get('past_three_hours', None) + self.past_six_hours = kwargs.get('past_six_hours', None) + self.past_nine_hours = kwargs.get('past_nine_hours', None) + self.past_twelve_hours = kwargs.get('past_twelve_hours', None) + self.past_eighteen_hours = kwargs.get('past_eighteen_hours', None) + self.past_twenty_four_hours = kwargs.get('past_twenty_four_hours', None) + + +class PressureTendency(msrest.serialization.Model): + """PressureTendency. + + :param description: Description of the pressure tendency in specified language. + :type description: str + :param code: Pressure tendency code regardless of language. One of F=Falling, S=Steady, + R=Rising. + :type code: str + """ + + _attribute_map = { + 'description': {'key': 'localizedDescription', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PressureTendency, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.code = kwargs.get('code', None) + + +class QuarterDayForecast(msrest.serialization.Model): + """QuarterDayForecast. + + :param date_time: Date of the forecast as example, 2019-10-27T00:00:00. + :type date_time: ~datetime.datetime + :param effective_date: Date and time of the beginning of the forecast quarter displayed in ISO + 8601 format, for example, 2019-10-27T19:39:57-08:00. + :type effective_date: ~datetime.datetime + :param quarter: Quarter of the day. Possible values include: 0, 1, 2, 3. + :type quarter: str or ~azure.maps.weather.models.DayQuarter + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param icon_phrase: Phrase description of the icon. Displayed in specified language. For + example, 'Sunny'. + :type icon_phrase: str + :param phrase: Short summary phrase summary for quarter. + :type phrase: str + :param temperature: Temperature values for the quarter. + :type temperature: ~azure.maps.weather.models.WeatherValueRange + :param real_feel_temperature: RealFeel™ Temperature values for the quarter. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValueRange + :param dew_point: The dewpoint temperature in specified unit. The dewpoint temperature is the + temperature that the air must be cooled to in order to reach saturation. + :type dew_point: ~azure.maps.weather.models.WeatherValue + :param relative_humidity: Relative humidity is the amount of water vapor present in air + expressed as a percentage of the amount needed for saturation at the same temperature. + :type relative_humidity: int + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param visibility: Visibility in specified unit. A measure of the distance at which an object + or light can be clearly discerned. + :type visibility: ~azure.maps.weather.models.WeatherValue + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param precipitation_type: Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). + If dbz is zero, precipitationType is not present in the response. Possible values include: + "Rain", "Snow", "Ice", "Mix". + :type precipitation_type: str or ~azure.maps.weather.models.PrecipitationType + :param precipitation_intensity: Description of the intensity. + :type precipitation_intensity: str + :param precipitation_probability: Percent representing the probability of precipitation. For + example, '20'. + :type precipitation_probability: int + :param thunderstorm_probability: Percent representing the probability of a thunderstorm. For + example, '10'. + :type thunderstorm_probability: int + :param total_liquid: Total liquid equivalent of precipitation during the forecast period. + :type total_liquid: ~azure.maps.weather.models.WeatherValue + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherValue + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherValue + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'date_time': {'key': 'date', 'type': 'iso-8601'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'iso-8601'}, + 'quarter': {'key': 'quarter', 'type': 'int'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'icon_phrase': {'key': 'iconPhrase', 'type': 'str'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValueRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValueRange'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherValue'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherValue'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'precipitation_type': {'key': 'precipitationType', 'type': 'str'}, + 'precipitation_intensity': {'key': 'precipitationIntensity', 'type': 'str'}, + 'precipitation_probability': {'key': 'precipitationProbability', 'type': 'int'}, + 'thunderstorm_probability': {'key': 'thunderstormProbability', 'type': 'int'}, + 'total_liquid': {'key': 'totalLiquid', 'type': 'WeatherValue'}, + 'rain': {'key': 'rain', 'type': 'WeatherValue'}, + 'snow': {'key': 'snow', 'type': 'WeatherValue'}, + 'ice': {'key': 'ice', 'type': 'WeatherValue'}, + } + + def __init__( + self, + **kwargs + ): + super(QuarterDayForecast, self).__init__(**kwargs) + self.date_time = kwargs.get('date_time', None) + self.effective_date = kwargs.get('effective_date', None) + self.quarter = kwargs.get('quarter', None) + self.icon_code = kwargs.get('icon_code', None) + self.icon_phrase = kwargs.get('icon_phrase', None) + self.phrase = kwargs.get('phrase', None) + self.temperature = kwargs.get('temperature', None) + self.real_feel_temperature = kwargs.get('real_feel_temperature', None) + self.dew_point = kwargs.get('dew_point', None) + self.relative_humidity = kwargs.get('relative_humidity', None) + self.wind = kwargs.get('wind', None) + self.wind_gust = kwargs.get('wind_gust', None) + self.visibility = kwargs.get('visibility', None) + self.cloud_cover = kwargs.get('cloud_cover', None) + self.has_precipitation = kwargs.get('has_precipitation', None) + self.precipitation_type = kwargs.get('precipitation_type', None) + self.precipitation_intensity = kwargs.get('precipitation_intensity', None) + self.precipitation_probability = kwargs.get('precipitation_probability', None) + self.thunderstorm_probability = kwargs.get('thunderstorm_probability', None) + self.total_liquid = kwargs.get('total_liquid', None) + self.rain = kwargs.get('rain', None) + self.snow = kwargs.get('snow', None) + self.ice = kwargs.get('ice', None) + + +class QuarterDayForecastResponse(msrest.serialization.Model): + """QuarterDayForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar forecasts: Forecast data for each quarter in the response. + :vartype forecasts: list[~azure.maps.weather.models.QuarterDayForecast] + """ + + _validation = { + 'forecasts': {'readonly': True}, + } + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[QuarterDayForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuarterDayForecastResponse, self).__init__(**kwargs) + self.forecasts = None + + +class SevereWeatherAlert(msrest.serialization.Model): + """Information about a severe weather alert. + + :param country_code: 2-character ISO 3166-1 Alpha-2 country code, for example, "US". + :type country_code: str + :param alert_id: A unique numerical identifier for a weather alert. + :type alert_id: int + :param description: Description of the alert. + :type description: ~azure.maps.weather.models.SevereWeatherAlertDescription + :param category: Category of the alert. + :type category: str + :param priority: Number signifying the importance or ranking order of the given alert within + the country/region it has originated. A lower number signifies a higher priority. For example, + 1 is the highest priority. The number varies by country/region and can change over time as each + country/region evolves their alert systems. + :type priority: int + :param classification: Classification of the alert. This field is not available for all + countries and therefore not always returned. + :type classification: str + :param level: Severity level of the alert. This field is not available for all countries and + therefore not always returned. + :type level: str + :param source: The provider of the alert information. By default the source is returned in + English (en-US). The alerts are from official Government Meteorological Agencies and leading + global weather alert providers. + :type source: str + :param source_id: A numerical identifier associated with the source provider name of the alert + data. + :type source_id: int + :param disclaimer: A disclaimer regarding the source of the alert information. This field is + not always available. For example, disclaimer may include details about the delays or potential + issues related to the alarm. + :type disclaimer: str + :param alert_details: Information about the alert specific to the affected area(s). + :type alert_details: list[~azure.maps.weather.models.AlertDetails] + """ + + _attribute_map = { + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'alert_id': {'key': 'alertId', 'type': 'int'}, + 'description': {'key': 'description', 'type': 'SevereWeatherAlertDescription'}, + 'category': {'key': 'category', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'classification': {'key': 'class', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'source_id': {'key': 'sourceId', 'type': 'int'}, + 'disclaimer': {'key': 'disclaimer', 'type': 'str'}, + 'alert_details': {'key': 'alertAreas', 'type': '[AlertDetails]'}, + } + + def __init__( + self, + **kwargs + ): + super(SevereWeatherAlert, self).__init__(**kwargs) + self.country_code = kwargs.get('country_code', None) + self.alert_id = kwargs.get('alert_id', None) + self.description = kwargs.get('description', None) + self.category = kwargs.get('category', None) + self.priority = kwargs.get('priority', None) + self.classification = kwargs.get('classification', None) + self.level = kwargs.get('level', None) + self.source = kwargs.get('source', None) + self.source_id = kwargs.get('source_id', None) + self.disclaimer = kwargs.get('disclaimer', None) + self.alert_details = kwargs.get('alert_details', None) + + +class SevereWeatherAlertDescription(msrest.serialization.Model): + """Description of a severe weather alert. + + :param description: Description of the alert in the specified language. By default English + (en-US) is returned if the language parameter is not specified in the request. + :type description: str + :param status: Description of the alert in English (en-US). + :type status: str + """ + + _attribute_map = { + 'description': {'key': 'localized', 'type': 'str'}, + 'status': {'key': 'english', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SevereWeatherAlertDescription, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.status = kwargs.get('status', None) + + +class SevereWeatherAlertsResponse(msrest.serialization.Model): + """This object is returned from a successful Get Severe Weather Alerts call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: A list of all severe weather alerts for the queried location. + :vartype results: list[~azure.maps.weather.models.SevereWeatherAlert] + """ + + _validation = { + 'results': {'readonly': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': '[SevereWeatherAlert]'}, + } + + def __init__( + self, + **kwargs + ): + super(SevereWeatherAlertsResponse, self).__init__(**kwargs) + self.results = None + + +class SunGlare(msrest.serialization.Model): + """A rating that indicates how blinding the sun is for the driver. + + :param calculated_vehicle_heading: If the vehicle heading value is not provided for a waypoint, + then the service will calculate a heading based upon the location of neighboring waypoints if + provided. + :type calculated_vehicle_heading: int + :param glare_index: An index from 0 to 100 indicating sun glare intensity for a driver. A value + of 50 and above can be considered a hazard for some drivers and a value of 100 signifies the + driver is driving straight into the sun and atmospheric conditions are clear allowing for the + full intensity of the sun to blind the driver. + :type glare_index: int + """ + + _attribute_map = { + 'calculated_vehicle_heading': {'key': 'calculatedVehicleHeading', 'type': 'int'}, + 'glare_index': {'key': 'glareIndex', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(SunGlare, self).__init__(**kwargs) + self.calculated_vehicle_heading = kwargs.get('calculated_vehicle_heading', None) + self.glare_index = kwargs.get('glare_index', None) + + +class TemperatureSummary(msrest.serialization.Model): + """TemperatureSummary. + + :param past_six_hours: Summary of temperature fluctuations over the past 6 hours. + :type past_six_hours: ~azure.maps.weather.models.PastHoursTemperature + :param past_twelve_hours: Summary of temperature fluctuations over the past 12 hours. + :type past_twelve_hours: ~azure.maps.weather.models.PastHoursTemperature + :param past_twenty_four_hours: Summary of temperature fluctuations over the past 24 hours. + :type past_twenty_four_hours: ~azure.maps.weather.models.PastHoursTemperature + """ + + _attribute_map = { + 'past_six_hours': {'key': 'pastSixHours', 'type': 'PastHoursTemperature'}, + 'past_twelve_hours': {'key': 'pastTwelveHours', 'type': 'PastHoursTemperature'}, + 'past_twenty_four_hours': {'key': 'pastTwentyFourHours', 'type': 'PastHoursTemperature'}, + } + + def __init__( + self, + **kwargs + ): + super(TemperatureSummary, self).__init__(**kwargs) + self.past_six_hours = kwargs.get('past_six_hours', None) + self.past_twelve_hours = kwargs.get('past_twelve_hours', None) + self.past_twenty_four_hours = kwargs.get('past_twenty_four_hours', None) + + +class WaypointForecast(msrest.serialization.Model): + """WaypointForecast. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param short_description: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_description: str + :param is_daytime: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_daytime: bool + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + :param temperature: Specific value of a given unit related to weather. + :type temperature: ~azure.maps.weather.models.WeatherValue + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind details being returned including speed and direction. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param precipitation: Precipitation forecast of the weather along the route. + :type precipitation: ~azure.maps.weather.models.WeatherAlongRoutePrecipitation + :param lightning_count: Estimation of thunderstorm intensity on an open scale. A value of 0 + means there is no thunderstorm; values of 1 and higher mean there is a thunderstorm in + increasing intensity. + :type lightning_count: int + :param sun_glare: A rating that indicates how blinding the sun is for the driver. + :type sun_glare: ~azure.maps.weather.models.SunGlare + :param hazards: Description of the weather hazard affecting the trip. + :type hazards: ~azure.maps.weather.models.WeatherHazards + :param notifications: List of weather hazard notifications. + :type notifications: list[~azure.maps.weather.models.WeatherNotification] + """ + + _attribute_map = { + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'is_daytime': {'key': 'isDayTime', 'type': 'bool'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValue'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'precipitation': {'key': 'precipitation', 'type': 'WeatherAlongRoutePrecipitation'}, + 'lightning_count': {'key': 'lightningCount', 'type': 'int'}, + 'sun_glare': {'key': 'sunGlare', 'type': 'SunGlare'}, + 'hazards': {'key': 'hazards', 'type': 'WeatherHazards'}, + 'notifications': {'key': 'notifications', 'type': '[WeatherNotification]'}, + } + + def __init__( + self, + **kwargs + ): + super(WaypointForecast, self).__init__(**kwargs) + self.icon_code = kwargs.get('icon_code', None) + self.short_description = kwargs.get('short_description', None) + self.is_daytime = kwargs.get('is_daytime', None) + self.cloud_cover = kwargs.get('cloud_cover', None) + self.temperature = kwargs.get('temperature', None) + self.wind = kwargs.get('wind', None) + self.wind_gust = kwargs.get('wind_gust', None) + self.precipitation = kwargs.get('precipitation', None) + self.lightning_count = kwargs.get('lightning_count', None) + self.sun_glare = kwargs.get('sun_glare', None) + self.hazards = kwargs.get('hazards', None) + self.notifications = kwargs.get('notifications', None) + + +class WeatherAlongRoutePrecipitation(msrest.serialization.Model): + """Precipitation forecast of the weather along the route. + + :param dbz: The forecasted precipitation intensity in dBZ (decibels relative to Z) from 0.0 to + 100.0. + :type dbz: float + :param type: Precipitation type. If precipitation should occur, the type that it will be: + "RAIN," "HAIL," "SNOW," "ICE," or "MIX.". + :type type: str + """ + + _attribute_map = { + 'dbz': {'key': 'dbz', 'type': 'float'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherAlongRoutePrecipitation, self).__init__(**kwargs) + self.dbz = kwargs.get('dbz', None) + self.type = kwargs.get('type', None) + + +class WeatherAlongRouteResponse(msrest.serialization.Model): + """This object is returned from a successful Weather Along Route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Short summary of the weather along the route. + :vartype summary: ~azure.maps.weather.models.WeatherAlongRouteSummary + :ivar waypoints: Data for each waypoint returned in the same order as specified in the request. + :vartype waypoints: list[~azure.maps.weather.models.WaypointForecast] + """ + + _validation = { + 'summary': {'readonly': True}, + 'waypoints': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'WeatherAlongRouteSummary'}, + 'waypoints': {'key': 'waypoints', 'type': '[WaypointForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherAlongRouteResponse, self).__init__(**kwargs) + self.summary = None + self.waypoints = None + + +class WeatherAlongRouteSummary(msrest.serialization.Model): + """Short summary of the weather along the route. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param hazards: Description of the weather hazard affecting the trip. + :type hazards: ~azure.maps.weather.models.WeatherHazards + """ + + _attribute_map = { + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'hazards': {'key': 'hazards', 'type': 'WeatherHazards'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherAlongRouteSummary, self).__init__(**kwargs) + self.icon_code = kwargs.get('icon_code', None) + self.hazards = kwargs.get('hazards', None) + + +class WeatherHazards(msrest.serialization.Model): + """Description of the weather hazard affecting the trip. + + :param max_hazard_index: A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. Possible values include: 0, 1, 2, 3, 4. + :type max_hazard_index: str or ~azure.maps.weather.models.HazardIndex + :param details: Details of the weather hazards affecting the trip. + :type details: list[~azure.maps.weather.models.HazardDetail] + """ + + _attribute_map = { + 'max_hazard_index': {'key': 'maxHazardIndex', 'type': 'int'}, + 'details': {'key': 'hazardDetails', 'type': '[HazardDetail]'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherHazards, self).__init__(**kwargs) + self.max_hazard_index = kwargs.get('max_hazard_index', None) + self.details = kwargs.get('details', None) + + +class WeatherNotification(msrest.serialization.Model): + """WeatherNotification. + + :param type: A type of notification generated to warn drivers of the onset of a hazard, or + increase in intensity of a hazard. + :type type: str + :param hazard_index: A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. Possible values include: 0, 1, 2, 3, 4. + :type hazard_index: str or ~azure.maps.weather.models.HazardIndex + :param hazard_code: A unique identifier (non-displayable) for each type of hazard: LightRain, + ModerateRain, HeavyRain, LightMix, ModerateMix, HeavyMix, LightSnow, ModerateSnow, HeavySnow, + LightIce, ModerateIce, HeavyIce, Hail, LargeHail, SunGlare, SunGlareHigh, Lightning, + SevereLightning, WindModerate, WindHigh, WindExtreme, FloodWarning, FlashFloodWarning, + TornadoWarning, TsunamiWarning, SevereThunderstormWarning. + :type hazard_code: str + :param short_description: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_description: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherNotification, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.hazard_index = kwargs.get('hazard_index', None) + self.hazard_code = kwargs.get('hazard_code', None) + self.short_description = kwargs.get('short_description', None) + + +class WeatherValue(msrest.serialization.Model): + """Specific value of a given unit related to weather. + + :param value: Rounded value. + :type value: float + :param unit_label: Type of unit for the returned value. + :type unit_label: str + :param unit_type: Numeric ID value associated with the type of unit being displayed. Can be + used for unit translation. Please refer to `Weather Service Concepts + `_ for details. Possible values include: 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31. + :type unit_type: str or ~azure.maps.weather.models.UnitType + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'float'}, + 'unit_label': {'key': 'unit', 'type': 'str'}, + 'unit_type': {'key': 'unitType', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherValue, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.unit_label = kwargs.get('unit_label', None) + self.unit_type = kwargs.get('unit_type', None) + + +class WeatherValueRange(msrest.serialization.Model): + """Returned temperature values. + + :param minimum: Minimum temperature for the time period. + :type minimum: ~azure.maps.weather.models.WeatherValue + :param maximum: Maximum temperature for the time period. + :type maximum: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherValue'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherValue'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherValueRange, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + + +class WindDetails(msrest.serialization.Model): + """Wind details being returned including speed and direction. + + :param direction: Wind direction. + :type direction: ~azure.maps.weather.models.WindDirection + :param speed: Speed of the wind in specified unit. + :type speed: ~azure.maps.weather.models.WindSpeed + """ + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'WindDirection'}, + 'speed': {'key': 'speed', 'type': 'WindSpeed'}, + } + + def __init__( + self, + **kwargs + ): + super(WindDetails, self).__init__(**kwargs) + self.direction = kwargs.get('direction', None) + self.speed = kwargs.get('speed', None) + + +class WindDirection(msrest.serialization.Model): + """Wind direction. + + :param degrees: Wind direction in Azimuth degrees, starting at true North and continuing in + clockwise direction. North is 0 degrees, east is 90 degrees, south is 180 degrees, west is 270 + degrees. Possible values 0-359. + :type degrees: int + :param description: Direction abbreviation in the specified language. + :type description: str + """ + + _attribute_map = { + 'degrees': {'key': 'degrees', 'type': 'int'}, + 'description': {'key': 'localizedDescription', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WindDirection, self).__init__(**kwargs) + self.degrees = kwargs.get('degrees', None) + self.description = kwargs.get('description', None) + + +class WindSpeed(msrest.serialization.Model): + """Speed of wind in specified unit. + + :param value: Rounded value of the speed. + :type value: float + :param unit: Type of unit for the speed value. + :type unit: str + :param unit_type: Numeric ID value associated with the type of unit being displayed. Can be + used for unit translation. Please refer to `Weather Service Concepts + `_ for details. Possible values include: 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31. + :type unit_type: str or ~azure.maps.weather.models.UnitType + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_type': {'key': 'unitType', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(WindSpeed, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.unit = kwargs.get('unit', None) + self.unit_type = kwargs.get('unit_type', None) diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models_py3.py b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models_py3.py new file mode 100644 index 000000000000..12568e93a229 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models_py3.py @@ -0,0 +1,2242 @@ +# 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 List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._weather_client_enums import * + + +class AirAndPollen(msrest.serialization.Model): + """AirAndPollen. + + :param description: Name of the pollen or pollutant. For example, grass, mold, weed, air + quality, tree and UV index. + :type description: str + :param value: Value of the given type above. Values associated with mold, grass, weed and tree + are in units of parts per cubic meter. Both air quality and UV are indices, so they are + unitless. + :type value: int + :param category: Category of the air quality or pollution type. For example, low, high, good, + moderate, unhealthy, hazardous. + :type category: str + :param category_value: Value associated with the air quality or pollution category. These + values range from 1 to 6. 1 implying good conditions, 6 implying hazardous conditions. + :type category_value: int + :param air_quality_type: Only exists for air quality. Examples include ozone and particle + pollution. + :type air_quality_type: str + """ + + _attribute_map = { + 'description': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + 'category': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + 'air_quality_type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + value: Optional[int] = None, + category: Optional[str] = None, + category_value: Optional[int] = None, + air_quality_type: Optional[str] = None, + **kwargs + ): + super(AirAndPollen, self).__init__(**kwargs) + self.description = description + self.value = value + self.category = category + self.category_value = category_value + self.air_quality_type = air_quality_type + + +class AlertDetails(msrest.serialization.Model): + """Information about a severe weather alert issued within an affected area(s). If multiple alerts are active for the same location, the alerts will be returned in order of ``priority`` within the API response, with the highest priority alert being returned at the top of the response. + + :param name: The name of an area which is affected by the alert. The location that was + requested falls under the alert area. + :type name: str + :param description: Text summarizing the alert in the returned area. + :type description: str + :param start_time: The start date and time of the alert in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. If the alert crosses multiple time zones the returned time in the + response is the local time to the requested coordinate location. + :type start_time: ~datetime.datetime + :param end_time: The end date and time of the alert in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. If the alert crosses multiple time zones the returned time in the + response is the local time to the requested coordinate location. + :type end_time: ~datetime.datetime + :param latest_status: The latest status of the alert in the current area. + :type latest_status: ~azure.maps.weather.models.LatestStatus + :param details: Full details associated with the alert. Returned if ``details``\ =True. This + field is always returned in the language(s) of choice by the issuing provider and Azure Maps + only returns what is created by the provider. Please note, some countries/regions may offer + their native language and English. Language parameter won’t apply to this field. + :type details: str + :param language: Language of the ``alertDetails``. This field helps to point out that the + language of the ``alertDetails`` may differ from the requested language parameter. Returned if + ``details``\ =True. Language code has been derived from the ISO 639-1 Alpha-2 codes. + :type language: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'summary', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'latest_status': {'key': 'latestStatus', 'type': 'LatestStatus'}, + 'details': {'key': 'alertDetails', 'type': 'str'}, + 'language': {'key': 'alertDetailsLanguageCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + description: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + latest_status: Optional["LatestStatus"] = None, + details: Optional[str] = None, + language: Optional[str] = None, + **kwargs + ): + super(AlertDetails, self).__init__(**kwargs) + self.name = name + self.description = description + self.start_time = start_time + self.end_time = end_time + self.latest_status = latest_status + self.details = details + self.language = language + + +class ColorValue(msrest.serialization.Model): + """ColorValue. + + :param red: Red component of the RGB value. + :type red: int + :param green: Green component of the RGB value. + :type green: int + :param blue: Blue component of the RGB value. + :type blue: int + :param hex: Hexadecimal color value. + :type hex: str + """ + + _attribute_map = { + 'red': {'key': 'red', 'type': 'int'}, + 'green': {'key': 'green', 'type': 'int'}, + 'blue': {'key': 'blue', 'type': 'int'}, + 'hex': {'key': 'hex', 'type': 'str'}, + } + + def __init__( + self, + *, + red: Optional[int] = None, + green: Optional[int] = None, + blue: Optional[int] = None, + hex: Optional[str] = None, + **kwargs + ): + super(ColorValue, self).__init__(**kwargs) + self.red = red + self.green = green + self.blue = blue + self.hex = hex + + +class CurrentConditions(msrest.serialization.Model): + """CurrentConditions. + + :param date_time: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param description: Phrase description of the current weather condition. Displayed in + specified language. + :type description: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param is_daytime: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_daytime: bool + :param temperature: Temperature being returned. + :type temperature: ~azure.maps.weather.models.WeatherValue + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValue + :param real_feel_temperature_shade: RealFeel™ Temperature being returned. Describes what the + temperature really feels like in the shade. + :type real_feel_temperature_shade: ~azure.maps.weather.models.WeatherValue + :param relative_humidity: Relative humidity is the amount of water vapor present in air + expressed as a percentage of the amount needed for saturation at the same temperature. + :type relative_humidity: int + :param dew_point: The dewpoint temperature in specified unit. The dewpoint temperature is the + temperature that the air must be cooled to in order to reach saturation. + :type dew_point: ~azure.maps.weather.models.WeatherValue + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param uv_index: Measure of the strength of the ultraviolet radiation from the sun. Supported + values are: + + + * ``0-2`` - Low danger from the sun's UV rays or the average person. + * ``3-5`` - Moderate risk of harm from unprotected sun exposure. + * ``6-7`` - High risk of harm from unprotected sun exposure. + * ``8-10`` - Very high risk of harm from unprotected sun exposure. + * ``11+`` - Extreme risk of harm from unprotected sun exposure. + :type uv_index: int + :param uv_index_description: Phrase associated with the ``uvIndex``. + :type uv_index_description: str + :param visibility: Visibility in specified unit. A measure of the distance at which an object + or light can be clearly discerned. + :type visibility: ~azure.maps.weather.models.WeatherValue + :param obstructions_to_visibility: Cause of limited visibility. + :type obstructions_to_visibility: str + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + :param cloud_ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the + height of the base of the lowest clouds. + :type cloud_ceiling: ~azure.maps.weather.models.WeatherValue + :param pressure: Atmospheric pressure in specified unit. + :type pressure: ~azure.maps.weather.models.WeatherValue + :param pressure_tendency: Atmospheric pressure change. + :type pressure_tendency: ~azure.maps.weather.models.PressureTendency + :param past_twenty_four_hour_temperature_departure: Departure from the temperature observed 24 + hours ago in specified unit. + :type past_twenty_four_hour_temperature_departure: ~azure.maps.weather.models.WeatherValue + :param apparent_temperature: Perceived outdoor temperature caused by the combination of air + temperature, relative humidity, and wind speed in specified unit. + :type apparent_temperature: ~azure.maps.weather.models.WeatherValue + :param wind_chill_temperature: Perceived air temperature on exposed skin due to wind. + :type wind_chill_temperature: ~azure.maps.weather.models.WeatherValue + :param wet_bulb_temperature: The temperature to which air may be cooled by evaporating water + into it at constant pressure until it reaches saturation. + :type wet_bulb_temperature: ~azure.maps.weather.models.WeatherValue + :param precipitation_summary: Summary of precipitation amounts over the past 24 hours. + :type precipitation_summary: ~azure.maps.weather.models.PrecipitationSummary + :param temperature_summary: Summary of temperature fluctuations over the past 6, 12, and 24 + hours. + :type temperature_summary: ~azure.maps.weather.models.TemperatureSummary + """ + + _attribute_map = { + 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, + 'description': {'key': 'phrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'is_daytime': {'key': 'isDayTime', 'type': 'bool'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValue'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValue'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherValue'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherValue'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_description': {'key': 'uvIndexPhrase', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherValue'}, + 'obstructions_to_visibility': {'key': 'obstructionsToVisibility', 'type': 'str'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'cloud_ceiling': {'key': 'ceiling', 'type': 'WeatherValue'}, + 'pressure': {'key': 'pressure', 'type': 'WeatherValue'}, + 'pressure_tendency': {'key': 'pressureTendency', 'type': 'PressureTendency'}, + 'past_twenty_four_hour_temperature_departure': {'key': 'pastTwentyFourHourTemperatureDeparture', 'type': 'WeatherValue'}, + 'apparent_temperature': {'key': 'apparentTemperature', 'type': 'WeatherValue'}, + 'wind_chill_temperature': {'key': 'windChillTemperature', 'type': 'WeatherValue'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherValue'}, + 'precipitation_summary': {'key': 'precipitationSummary', 'type': 'PrecipitationSummary'}, + 'temperature_summary': {'key': 'temperatureSummary', 'type': 'TemperatureSummary'}, + } + + def __init__( + self, + *, + date_time: Optional[datetime.datetime] = None, + description: Optional[str] = None, + icon_code: Optional[Union[int, "IconCode"]] = None, + has_precipitation: Optional[bool] = None, + is_daytime: Optional[bool] = None, + temperature: Optional["WeatherValue"] = None, + real_feel_temperature: Optional["WeatherValue"] = None, + real_feel_temperature_shade: Optional["WeatherValue"] = None, + relative_humidity: Optional[int] = None, + dew_point: Optional["WeatherValue"] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + uv_index: Optional[int] = None, + uv_index_description: Optional[str] = None, + visibility: Optional["WeatherValue"] = None, + obstructions_to_visibility: Optional[str] = None, + cloud_cover: Optional[int] = None, + cloud_ceiling: Optional["WeatherValue"] = None, + pressure: Optional["WeatherValue"] = None, + pressure_tendency: Optional["PressureTendency"] = None, + past_twenty_four_hour_temperature_departure: Optional["WeatherValue"] = None, + apparent_temperature: Optional["WeatherValue"] = None, + wind_chill_temperature: Optional["WeatherValue"] = None, + wet_bulb_temperature: Optional["WeatherValue"] = None, + precipitation_summary: Optional["PrecipitationSummary"] = None, + temperature_summary: Optional["TemperatureSummary"] = None, + **kwargs + ): + super(CurrentConditions, self).__init__(**kwargs) + self.date_time = date_time + self.description = description + self.icon_code = icon_code + self.has_precipitation = has_precipitation + self.is_daytime = is_daytime + self.temperature = temperature + self.real_feel_temperature = real_feel_temperature + self.real_feel_temperature_shade = real_feel_temperature_shade + self.relative_humidity = relative_humidity + self.dew_point = dew_point + self.wind = wind + self.wind_gust = wind_gust + self.uv_index = uv_index + self.uv_index_description = uv_index_description + self.visibility = visibility + self.obstructions_to_visibility = obstructions_to_visibility + self.cloud_cover = cloud_cover + self.cloud_ceiling = cloud_ceiling + self.pressure = pressure + self.pressure_tendency = pressure_tendency + self.past_twenty_four_hour_temperature_departure = past_twenty_four_hour_temperature_departure + self.apparent_temperature = apparent_temperature + self.wind_chill_temperature = wind_chill_temperature + self.wet_bulb_temperature = wet_bulb_temperature + self.precipitation_summary = precipitation_summary + self.temperature_summary = temperature_summary + + +class CurrentConditionsResponse(msrest.serialization.Model): + """CurrentConditionsResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: Detailed current weather conditions. + :vartype results: list[~azure.maps.weather.models.CurrentConditions] + """ + + _validation = { + 'results': {'readonly': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': '[CurrentConditions]'}, + } + + def __init__( + self, + **kwargs + ): + super(CurrentConditionsResponse, self).__init__(**kwargs) + self.results = None + + +class DailyForecast(msrest.serialization.Model): + """DailyForecast. + + :param date_time: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param temperature: Temperature values for the day. + :type temperature: ~azure.maps.weather.models.WeatherValueRange + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValueRange + :param real_feel_temperature_shade: RealFeel™ Temperature being returned. Describes what the + temperature really feels like in the shade. + :type real_feel_temperature_shade: ~azure.maps.weather.models.WeatherValueRange + :param hours_of_sun: Hours of sun. + :type hours_of_sun: float + :param mean_temperature_deviation: Summary for mean temperature of Heating Degree Day or + Cooling Degree Day information. + :type mean_temperature_deviation: ~azure.maps.weather.models.DegreeDaySummary + :param air_quality: Air quality. + :type air_quality: list[~azure.maps.weather.models.AirAndPollen] + :param daytime_forecast: Day forecast detail. + :type daytime_forecast: ~azure.maps.weather.models.DailyForecastDetail + :param nighttime_forecast: Night forecast detail. + :type nighttime_forecast: ~azure.maps.weather.models.DailyForecastDetail + :param sources: Source(s) of the forecast data. + :type sources: list[str] + """ + + _attribute_map = { + 'date_time': {'key': 'date', 'type': 'iso-8601'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValueRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValueRange'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherValueRange'}, + 'hours_of_sun': {'key': 'hoursOfSun', 'type': 'float'}, + 'mean_temperature_deviation': {'key': 'degreeDaySummary', 'type': 'DegreeDaySummary'}, + 'air_quality': {'key': 'airAndPollen', 'type': '[AirAndPollen]'}, + 'daytime_forecast': {'key': 'day', 'type': 'DailyForecastDetail'}, + 'nighttime_forecast': {'key': 'night', 'type': 'DailyForecastDetail'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__( + self, + *, + date_time: Optional[datetime.datetime] = None, + temperature: Optional["WeatherValueRange"] = None, + real_feel_temperature: Optional["WeatherValueRange"] = None, + real_feel_temperature_shade: Optional["WeatherValueRange"] = None, + hours_of_sun: Optional[float] = None, + mean_temperature_deviation: Optional["DegreeDaySummary"] = None, + air_quality: Optional[List["AirAndPollen"]] = None, + daytime_forecast: Optional["DailyForecastDetail"] = None, + nighttime_forecast: Optional["DailyForecastDetail"] = None, + sources: Optional[List[str]] = None, + **kwargs + ): + super(DailyForecast, self).__init__(**kwargs) + self.date_time = date_time + self.temperature = temperature + self.real_feel_temperature = real_feel_temperature + self.real_feel_temperature_shade = real_feel_temperature_shade + self.hours_of_sun = hours_of_sun + self.mean_temperature_deviation = mean_temperature_deviation + self.air_quality = air_quality + self.daytime_forecast = daytime_forecast + self.nighttime_forecast = nighttime_forecast + self.sources = sources + + +class DailyForecastDetail(msrest.serialization.Model): + """DailyForecastDetail. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param icon_phrase: Phrase description of the icon. Displayed in specified language. For + example, 'Sunny'. + :type icon_phrase: str + :param local_source: Local weather data provider information. + :type local_source: ~azure.maps.weather.models.LocalSource + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param precipitation_type: Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). + If dbz is zero, precipitationType is not present in the response. Possible values include: + "Rain", "Snow", "Ice", "Mix". + :type precipitation_type: str or ~azure.maps.weather.models.PrecipitationType + :param precipitation_intensity: Description of the intensity. + :type precipitation_intensity: str + :param short_description: Phrase description of the forecast in specified language. Azure Maps + attempts to keep this phrase under 30 characters in length, but some languages/weather events + may result in a longer phrase length, exceeding 30 characters. + :type short_description: str + :param long_phrase: Phrase description of the forecast in specified language. Azure Maps + attempts to keep this phrase under 100 characters in length, but some languages/weather events + may result in a longer phrase length, exceeding 100 characters. + :type long_phrase: str + :param precipitation_probability: Percent representing the probability of precipitation. For + example, '20'. + :type precipitation_probability: int + :param thunderstorm_probability: Percent representing the probability of a thunderstorm. For + example, '80'. + :type thunderstorm_probability: int + :param rain_probability: Percent representing the probability of rain. For example, '40'. + :type rain_probability: int + :param snow_probability: Percent representing the probability of snow. For example, '30'. + :type snow_probability: int + :param ice_probability: Percent representing the probability of ice. For example, '30'. + :type ice_probability: int + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param total_liquid: Total liquid equivalent of precipitation during the forecast period. + :type total_liquid: ~azure.maps.weather.models.WeatherValue + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherValue + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherValue + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherValue + :param hours_of_precipitation: Hours of precipitation. + :type hours_of_precipitation: float + :param hours_of_rain: Hours of rain. + :type hours_of_rain: float + :param hours_of_snow: Hours of snow. + :type hours_of_snow: float + :param hours_of_ice: Hours of ice. + :type hours_of_ice: float + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'icon_phrase': {'key': 'iconPhrase', 'type': 'str'}, + 'local_source': {'key': 'localSource', 'type': 'LocalSource'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'precipitation_type': {'key': 'precipitationType', 'type': 'str'}, + 'precipitation_intensity': {'key': 'precipitationIntensity', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'long_phrase': {'key': 'longPhrase', 'type': 'str'}, + 'precipitation_probability': {'key': 'precipitationProbability', 'type': 'int'}, + 'thunderstorm_probability': {'key': 'thunderstormProbability', 'type': 'int'}, + 'rain_probability': {'key': 'rainProbability', 'type': 'int'}, + 'snow_probability': {'key': 'snowProbability', 'type': 'int'}, + 'ice_probability': {'key': 'iceProbability', 'type': 'int'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'total_liquid': {'key': 'totalLiquid', 'type': 'WeatherValue'}, + 'rain': {'key': 'rain', 'type': 'WeatherValue'}, + 'snow': {'key': 'snow', 'type': 'WeatherValue'}, + 'ice': {'key': 'ice', 'type': 'WeatherValue'}, + 'hours_of_precipitation': {'key': 'hoursOfPrecipitation', 'type': 'float'}, + 'hours_of_rain': {'key': 'hoursOfRain', 'type': 'float'}, + 'hours_of_snow': {'key': 'hoursOfSnow', 'type': 'float'}, + 'hours_of_ice': {'key': 'hoursOfIce', 'type': 'float'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + *, + icon_code: Optional[Union[int, "IconCode"]] = None, + icon_phrase: Optional[str] = None, + local_source: Optional["LocalSource"] = None, + has_precipitation: Optional[bool] = None, + precipitation_type: Optional[Union[str, "PrecipitationType"]] = None, + precipitation_intensity: Optional[str] = None, + short_description: Optional[str] = None, + long_phrase: Optional[str] = None, + precipitation_probability: Optional[int] = None, + thunderstorm_probability: Optional[int] = None, + rain_probability: Optional[int] = None, + snow_probability: Optional[int] = None, + ice_probability: Optional[int] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + total_liquid: Optional["WeatherValue"] = None, + rain: Optional["WeatherValue"] = None, + snow: Optional["WeatherValue"] = None, + ice: Optional["WeatherValue"] = None, + hours_of_precipitation: Optional[float] = None, + hours_of_rain: Optional[float] = None, + hours_of_snow: Optional[float] = None, + hours_of_ice: Optional[float] = None, + cloud_cover: Optional[int] = None, + **kwargs + ): + super(DailyForecastDetail, self).__init__(**kwargs) + self.icon_code = icon_code + self.icon_phrase = icon_phrase + self.local_source = local_source + self.has_precipitation = has_precipitation + self.precipitation_type = precipitation_type + self.precipitation_intensity = precipitation_intensity + self.short_description = short_description + self.long_phrase = long_phrase + self.precipitation_probability = precipitation_probability + self.thunderstorm_probability = thunderstorm_probability + self.rain_probability = rain_probability + self.snow_probability = snow_probability + self.ice_probability = ice_probability + self.wind = wind + self.wind_gust = wind_gust + self.total_liquid = total_liquid + self.rain = rain + self.snow = snow + self.ice = ice + self.hours_of_precipitation = hours_of_precipitation + self.hours_of_rain = hours_of_rain + self.hours_of_snow = hours_of_snow + self.hours_of_ice = hours_of_ice + self.cloud_cover = cloud_cover + + +class DailyForecastResponse(msrest.serialization.Model): + """DailyForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary for the main conditions for the requested time period. Notice that + summary can cover only part of the time period. + :vartype summary: ~azure.maps.weather.models.DailyForecastSummary + :ivar forecasts: Forecast data for each requested day. + :vartype forecasts: list[~azure.maps.weather.models.DailyForecast] + """ + + _validation = { + 'summary': {'readonly': True}, + 'forecasts': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'DailyForecastSummary'}, + 'forecasts': {'key': 'forecasts', 'type': '[DailyForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecastResponse, self).__init__(**kwargs) + self.summary = None + self.forecasts = None + + +class DailyForecastSummary(msrest.serialization.Model): + """Summary for the main conditions for the requested time period. Notice that summary can cover only part of the time period. + + :param start_date: Date and time that the summary is in effect, displayed in ISO 8601 format, + for example, 2019-10-27T19:39:57-08:00. + :type start_date: ~datetime.datetime + :param end_date: Date and time that the summary period ends, displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type end_date: ~datetime.datetime + :param severity: severity. + :type severity: int + :param phrase: Summary phrase of the daily forecast. Displayed in specified language. + :type phrase: str + :param category: one or 2 word(s) to summarize the phrase. + :type category: str + """ + + _attribute_map = { + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'severity': {'key': 'severity', 'type': 'int'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + def __init__( + self, + *, + start_date: Optional[datetime.datetime] = None, + end_date: Optional[datetime.datetime] = None, + severity: Optional[int] = None, + phrase: Optional[str] = None, + category: Optional[str] = None, + **kwargs + ): + super(DailyForecastSummary, self).__init__(**kwargs) + self.start_date = start_date + self.end_date = end_date + self.severity = severity + self.phrase = phrase + self.category = category + + +class DailyIndex(msrest.serialization.Model): + """Information about a daily index. + + :param index_name: Name of the index, for example, "Construction", "Outdoor Activity", "Flight + Delays". + :type index_name: str + :param index_id: Numeric ID used to identify the specific index. Please refer to `Weather + Service Concepts `_ for details and to see the + supported index IDs. For example, the index ID can support UI visualization scenarios. + :type index_id: int + :param date_time: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param value: Index value. Ranges from 0.0 to 10.0. Please refer to `Weather Service Concepts + `_ for details and to see the supported ranges. + :type value: float + :param category_description: Textual description for ``categoryValue`` corresponding to the + level that the index value falls under, for example "Very Good". + :type category_description: str + :param category_value: Level that the index value falls under, represented by an integer. This + value can be 1 through 5 and should be used in combination with the ``ascending`` flag because + it can differ among indices. For example, the following values apply for Mosquito Activity: + Low=1, Moderate=2, High=3, Very High=4, and Extreme=5. + :type category_value: int + :param is_ascending: Describes the direction of the ``value`` and ``categoryValue``. For + example, when set to ``true``\ , the poorest index value is 0 and the best index value is 10. + When set to ``true``\ , the poorest index value is 10 and the best index value is 0. + :type is_ascending: bool + :param description: A textual explanation that can be used for display purposes to summarize + the index value and category. For example, when the index value for Flight Delays is very good, + the description will be "Conditions are excellent for flying!". + :type description: str + """ + + _attribute_map = { + 'index_name': {'key': 'indexName', 'type': 'str'}, + 'index_id': {'key': 'indexId', 'type': 'int'}, + 'date_time': {'key': 'dateTime', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': 'float'}, + 'category_description': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + 'is_ascending': {'key': 'ascending', 'type': 'bool'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + index_name: Optional[str] = None, + index_id: Optional[int] = None, + date_time: Optional[datetime.datetime] = None, + value: Optional[float] = None, + category_description: Optional[str] = None, + category_value: Optional[int] = None, + is_ascending: Optional[bool] = None, + description: Optional[str] = None, + **kwargs + ): + super(DailyIndex, self).__init__(**kwargs) + self.index_name = index_name + self.index_id = index_id + self.date_time = date_time + self.value = value + self.category_description = category_description + self.category_value = category_value + self.is_ascending = is_ascending + self.description = description + + +class DailyIndicesResponse(msrest.serialization.Model): + """This object is returned from a successful Get Daily Indices call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: A list of all daily indices for the queried location. + :vartype results: list[~azure.maps.weather.models.DailyIndex] + """ + + _validation = { + 'results': {'readonly': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': '[DailyIndex]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyIndicesResponse, self).__init__(**kwargs) + self.results = None + + +class DegreeDaySummary(msrest.serialization.Model): + """DegreeDaySummary. + + :param heating: Number of degrees that the mean temperature is below 65 degrees F/ 18 degree C. + :type heating: ~azure.maps.weather.models.WeatherValue + :param cooling: Number of degrees that the mean temperature is above 65 degrees F/ 18 degree C. + :type cooling: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'heating': {'key': 'heating', 'type': 'WeatherValue'}, + 'cooling': {'key': 'cooling', 'type': 'WeatherValue'}, + } + + def __init__( + self, + *, + heating: Optional["WeatherValue"] = None, + cooling: Optional["WeatherValue"] = None, + **kwargs + ): + super(DegreeDaySummary, self).__init__(**kwargs) + self.heating = heating + self.cooling = cooling + + +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.weather.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.weather.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.weather.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 ForecastInterval(msrest.serialization.Model): + """ForecastInterval. + + :param start_time: The date and time for the start of the interval in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type start_time: ~datetime.datetime + :param minute: The first minute for the interval. + :type minute: int + :param decibel_relative_to_z: A unit that represents forecasted precipitation intensity. + :type decibel_relative_to_z: float + :param short_description: A short phrase describing precipitation condition for the interval. + :type short_description: str + :param threshold: Key that specifies the threshold value. Along with precipitationType, can be + used to determine the simplifiedColor. If dbz is zero, not present in the response. + :type threshold: str + :param color: The full spectrum color that maps to the dBZ (decibel relative to Z). If dbz is + zero, color is not present in the response. + :type color: ~azure.maps.weather.models.ColorValue + :param simplified_color: The band color that maps to the precipitation type and threshold. If + dbz is zero, not present in the response. + :type simplified_color: ~azure.maps.weather.models.ColorValue + :param precipitation_type: Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). + If dbz is zero, precipitationType is not present in the response. Possible values include: + "Rain", "Snow", "Ice", "Mix". + :type precipitation_type: str or ~azure.maps.weather.models.PrecipitationType + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'minute': {'key': 'minute', 'type': 'int'}, + 'decibel_relative_to_z': {'key': 'dbz', 'type': 'float'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'str'}, + 'color': {'key': 'color', 'type': 'ColorValue'}, + 'simplified_color': {'key': 'simplifiedColor', 'type': 'ColorValue'}, + 'precipitation_type': {'key': 'precipitationType', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + *, + start_time: Optional[datetime.datetime] = None, + minute: Optional[int] = None, + decibel_relative_to_z: Optional[float] = None, + short_description: Optional[str] = None, + threshold: Optional[str] = None, + color: Optional["ColorValue"] = None, + simplified_color: Optional["ColorValue"] = None, + precipitation_type: Optional[Union[str, "PrecipitationType"]] = None, + icon_code: Optional[Union[int, "IconCode"]] = None, + cloud_cover: Optional[int] = None, + **kwargs + ): + super(ForecastInterval, self).__init__(**kwargs) + self.start_time = start_time + self.minute = minute + self.decibel_relative_to_z = decibel_relative_to_z + self.short_description = short_description + self.threshold = threshold + self.color = color + self.simplified_color = simplified_color + self.precipitation_type = precipitation_type + self.icon_code = icon_code + self.cloud_cover = cloud_cover + + +class HazardDetail(msrest.serialization.Model): + """HazardDetail. + + :param hazard_index: A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. Possible values include: 0, 1, 2, 3, 4. + :type hazard_index: str or ~azure.maps.weather.models.HazardIndex + :param hazard_code: A unique identifier (non-displayable) for each type of hazard: LightRain, + ModerateRain, HeavyRain, LightMix, ModerateMix, HeavyMix, LightSnow, ModerateSnow, HeavySnow, + LightIce, ModerateIce, HeavyIce, Hail, LargeHail, SunGlare, SunGlareHigh, Lightning, + SevereLightning, WindModerate, WindHigh, WindExtreme, FloodWarning, FlashFloodWarning, + TornadoWarning, TsunamiWarning, SevereThunderstormWarning. + :type hazard_code: str + :param short_description: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_description: str + """ + + _attribute_map = { + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + } + + def __init__( + self, + *, + hazard_index: Optional[Union[int, "HazardIndex"]] = None, + hazard_code: Optional[str] = None, + short_description: Optional[str] = None, + **kwargs + ): + super(HazardDetail, self).__init__(**kwargs) + self.hazard_index = hazard_index + self.hazard_code = hazard_code + self.short_description = short_description + + +class HourlyForecast(msrest.serialization.Model): + """HourlyForecast. + + :param date_time: Date and time of the forecast in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. + :type date_time: ~datetime.datetime + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param icon_phrase: Phrase description of the weather icon. + :type icon_phrase: str + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param is_daylight: Specifies whether or not it is daylight. True indicates day light. + :type is_daylight: bool + :param temperature: Temperature being returned. + :type temperature: ~azure.maps.weather.models.WeatherValue + :param real_feel_temperature: RealFeel™ Temperature being returned. Describes what the + temperature really feels like in the shade. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValue + :param wet_bulb_temperature: The temperature to which air may be cooled by evaporating water + into it at constant pressure until it reaches saturation. + :type wet_bulb_temperature: ~azure.maps.weather.models.WeatherValue + :param dew_point: The dewpoint temperature in specified unit. The dewpoint temperature is the + temperature that the air must be cooled to in order to reach saturation. + :type dew_point: ~azure.maps.weather.models.WeatherValue + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param relative_humidity: Relative humidity is the amount of water vapor present in air + expressed as a percentage of the amount needed for saturation at the same temperature. + :type relative_humidity: int + :param visibility: Visibility in specified unit. A measure of the distance at which an object + or light can be clearly discerned. + :type visibility: ~azure.maps.weather.models.WeatherValue + :param cloud_ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the + height of the base of the lowest clouds. + :type cloud_ceiling: ~azure.maps.weather.models.WeatherValue + :param uv_index: Measure of the strength of the ultraviolet radiation from the sun. Supported + values are: + + + * ``0-2`` - Low danger from the sun's UV rays or the average person. + * ``3-5`` - Moderate risk of harm from unprotected sun exposure. + * ``6-7`` - High risk of harm from unprotected sun exposure. + * ``8-10`` - Very high risk of harm from unprotected sun exposure. + * ``11+`` - Extreme risk of harm from unprotected sun exposure. + :type uv_index: int + :param uv_index_description: Phrase associated with the ``uvIndex``. + :type uv_index_description: str + :param precipitation_probability: Percent representing the probability of precipitation. For + example, '20'. + :type precipitation_probability: int + :param rain_probability: Percent representing the probability of rain. For example, '50'. + :type rain_probability: int + :param snow_probability: Percent representing the probability of snow. For example, '50'. + :type snow_probability: int + :param ice_probability: Percent representing the probability of snow. For example, '5'. + :type ice_probability: int + :param total_liquid: Total liquid equivalent of precipitation during the forecast period. + :type total_liquid: ~azure.maps.weather.models.WeatherValue + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherValue + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherValue + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherValue + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'date_time': {'key': 'date', 'type': 'iso-8601'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'icon_phrase': {'key': 'iconPhrase', 'type': 'str'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'is_daylight': {'key': 'isDaylight', 'type': 'bool'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValue'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValue'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherValue'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherValue'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherValue'}, + 'cloud_ceiling': {'key': 'ceiling', 'type': 'WeatherValue'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_description': {'key': 'uvIndexPhrase', 'type': 'str'}, + 'precipitation_probability': {'key': 'precipitationProbability', 'type': 'int'}, + 'rain_probability': {'key': 'rainProbability', 'type': 'int'}, + 'snow_probability': {'key': 'snowProbability', 'type': 'int'}, + 'ice_probability': {'key': 'iceProbability', 'type': 'int'}, + 'total_liquid': {'key': 'totalLiquid', 'type': 'WeatherValue'}, + 'rain': {'key': 'rain', 'type': 'WeatherValue'}, + 'snow': {'key': 'snow', 'type': 'WeatherValue'}, + 'ice': {'key': 'ice', 'type': 'WeatherValue'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + *, + date_time: Optional[datetime.datetime] = None, + icon_code: Optional[Union[int, "IconCode"]] = None, + icon_phrase: Optional[str] = None, + has_precipitation: Optional[bool] = None, + is_daylight: Optional[bool] = None, + temperature: Optional["WeatherValue"] = None, + real_feel_temperature: Optional["WeatherValue"] = None, + wet_bulb_temperature: Optional["WeatherValue"] = None, + dew_point: Optional["WeatherValue"] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + relative_humidity: Optional[int] = None, + visibility: Optional["WeatherValue"] = None, + cloud_ceiling: Optional["WeatherValue"] = None, + uv_index: Optional[int] = None, + uv_index_description: Optional[str] = None, + precipitation_probability: Optional[int] = None, + rain_probability: Optional[int] = None, + snow_probability: Optional[int] = None, + ice_probability: Optional[int] = None, + total_liquid: Optional["WeatherValue"] = None, + rain: Optional["WeatherValue"] = None, + snow: Optional["WeatherValue"] = None, + ice: Optional["WeatherValue"] = None, + cloud_cover: Optional[int] = None, + **kwargs + ): + super(HourlyForecast, self).__init__(**kwargs) + self.date_time = date_time + self.icon_code = icon_code + self.icon_phrase = icon_phrase + self.has_precipitation = has_precipitation + self.is_daylight = is_daylight + self.temperature = temperature + self.real_feel_temperature = real_feel_temperature + self.wet_bulb_temperature = wet_bulb_temperature + self.dew_point = dew_point + self.wind = wind + self.wind_gust = wind_gust + self.relative_humidity = relative_humidity + self.visibility = visibility + self.cloud_ceiling = cloud_ceiling + self.uv_index = uv_index + self.uv_index_description = uv_index_description + self.precipitation_probability = precipitation_probability + self.rain_probability = rain_probability + self.snow_probability = snow_probability + self.ice_probability = ice_probability + self.total_liquid = total_liquid + self.rain = rain + self.snow = snow + self.ice = ice + self.cloud_cover = cloud_cover + + +class HourlyForecastResponse(msrest.serialization.Model): + """HourlyForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar forecasts: Forecast data for each returned hour. + :vartype forecasts: list[~azure.maps.weather.models.HourlyForecast] + """ + + _validation = { + 'forecasts': {'readonly': True}, + } + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[HourlyForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(HourlyForecastResponse, self).__init__(**kwargs) + self.forecasts = None + + +class IntervalSummary(msrest.serialization.Model): + """IntervalSummary. + + :param start_minute: The first minute to which the summary applies. + :type start_minute: int + :param end_minute: The last minute to which the summary applies. + :type end_minute: int + :param total_minutes: The number of minutes for which the summary applies. + :type total_minutes: int + :param short_description: Short summary phrase. Phrase length is approximately 25 characters. + :type short_description: str + :param brief_description: Brief summary phrase. Phrase length is approximately 60 characters. + :type brief_description: str + :param long_phrase: Long summary phrase. Phrase length is 60+ characters. + :type long_phrase: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + """ + + _attribute_map = { + 'start_minute': {'key': 'startMinute', 'type': 'int'}, + 'end_minute': {'key': 'endMinute', 'type': 'int'}, + 'total_minutes': {'key': 'totalMinutes', 'type': 'int'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_description': {'key': 'briefPhrase', 'type': 'str'}, + 'long_phrase': {'key': 'longPhrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + } + + def __init__( + self, + *, + start_minute: Optional[int] = None, + end_minute: Optional[int] = None, + total_minutes: Optional[int] = None, + short_description: Optional[str] = None, + brief_description: Optional[str] = None, + long_phrase: Optional[str] = None, + icon_code: Optional[Union[int, "IconCode"]] = None, + **kwargs + ): + super(IntervalSummary, self).__init__(**kwargs) + self.start_minute = start_minute + self.end_minute = end_minute + self.total_minutes = total_minutes + self.short_description = short_description + self.brief_description = brief_description + self.long_phrase = long_phrase + self.icon_code = icon_code + + +class LatestStatus(msrest.serialization.Model): + """The latest status on the alert in the current area. + + :param localized: The latest status keyword for the alert, in the specified language. By + default, returned in English (en-US). + :type localized: str + :param english: Latest status keyword for the alert, in English (en-US). Possible values + include: "New", "Extend", "Cancel", "Correct", "Expire", "Upgrade", "Continue", "Update". + :type english: str or ~azure.maps.weather.models.LatestStatusKeyword + """ + + _attribute_map = { + 'localized': {'key': 'localized', 'type': 'str'}, + 'english': {'key': 'english', 'type': 'str'}, + } + + def __init__( + self, + *, + localized: Optional[str] = None, + english: Optional[Union[str, "LatestStatusKeyword"]] = None, + **kwargs + ): + super(LatestStatus, self).__init__(**kwargs) + self.localized = localized + self.english = english + + +class LocalSource(msrest.serialization.Model): + """Local weather data provider information. + + :param id: Numeric identifier, unique to the local data provider. + :type id: int + :param name: Name of the local data provider. Name is displayed in the language specified by + language code in URL, if available. Otherwise, Name is displayed in English or the language in + which the name was provided. + :type name: str + :param weather_code: Weather code provided by the local data provider. This weather code allows + the forecast to be matched to icons provided by the local data provider instead of Azure Maps + icons. + :type weather_code: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'weather_code': {'key': 'weatherCode', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + weather_code: Optional[str] = None, + **kwargs + ): + super(LocalSource, self).__init__(**kwargs) + self.id = id + self.name = name + self.weather_code = weather_code + + +class MinuteForecastResponse(msrest.serialization.Model): + """MinuteForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Phrase summaries for the entire forecast period. + :vartype summary: ~azure.maps.weather.models.MinuteForecastSummary + :ivar interval_summaries: Summary information for each interval in the forecast. The Summaries + breaks down each potential interval where precipitation starts and stops. + :vartype interval_summaries: list[~azure.maps.weather.models.IntervalSummary] + :ivar intervals: Forecast data for each interval in the forecast. + :vartype intervals: list[~azure.maps.weather.models.ForecastInterval] + """ + + _validation = { + 'summary': {'readonly': True}, + 'interval_summaries': {'readonly': True}, + 'intervals': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'MinuteForecastSummary'}, + 'interval_summaries': {'key': 'intervalSummaries', 'type': '[IntervalSummary]'}, + 'intervals': {'key': 'intervals', 'type': '[ForecastInterval]'}, + } + + def __init__( + self, + **kwargs + ): + super(MinuteForecastResponse, self).__init__(**kwargs) + self.summary = None + self.interval_summaries = None + self.intervals = None + + +class MinuteForecastSummary(msrest.serialization.Model): + """Phrase summaries for the entire forecast period. + + :param brief_phrase60: Summary phrase for the next 60 minutes. Phrase length is approximately + 60 characters. + :type brief_phrase60: str + :param short_description: Short summary phrase for the next 120 minutes. Phrase length is + approximately 25 characters. + :type short_description: str + :param brief_description: Summary phrase for the next 120 minutes. Phrase length is + approximately 60 characters. + :type brief_description: str + :param long_phrase: Long summary phrase for the next 120 minutes. Phrase length is 60+ + characters. + :type long_phrase: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + """ + + _attribute_map = { + 'brief_phrase60': {'key': 'briefPhrase60', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_description': {'key': 'briefPhrase', 'type': 'str'}, + 'long_phrase': {'key': 'longPhrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + } + + def __init__( + self, + *, + brief_phrase60: Optional[str] = None, + short_description: Optional[str] = None, + brief_description: Optional[str] = None, + long_phrase: Optional[str] = None, + icon_code: Optional[Union[int, "IconCode"]] = None, + **kwargs + ): + super(MinuteForecastSummary, self).__init__(**kwargs) + self.brief_phrase60 = brief_phrase60 + self.short_description = short_description + self.brief_description = brief_description + self.long_phrase = long_phrase + self.icon_code = icon_code + + +class PastHoursTemperature(msrest.serialization.Model): + """Summary of temperature fluctuations over the number of past hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherValue + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherValue'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherValue'}, + } + + def __init__( + self, + *, + minimum: Optional["WeatherValue"] = None, + maximum: Optional["WeatherValue"] = None, + **kwargs + ): + super(PastHoursTemperature, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + + +class PrecipitationSummary(msrest.serialization.Model): + """PrecipitationSummary. + + :param past_hour: The amount of precipitation (liquid equivalent) that has fallen in the past + hour. + :type past_hour: ~azure.maps.weather.models.WeatherValue + :param past_three_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past three hours. + :type past_three_hours: ~azure.maps.weather.models.WeatherValue + :param past_six_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past six hours. Contains Metric and Imperial Values. + :type past_six_hours: ~azure.maps.weather.models.WeatherValue + :param past_nine_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past nine hours. + :type past_nine_hours: ~azure.maps.weather.models.WeatherValue + :param past_twelve_hours: The amount of precipitation (liquid equivalent) that has fallen in + the past 12 hours. + :type past_twelve_hours: ~azure.maps.weather.models.WeatherValue + :param past_eighteen_hours: The amount of precipitation (liquid equivalent) that has fallen in + the past 18 hours. + :type past_eighteen_hours: ~azure.maps.weather.models.WeatherValue + :param past_twenty_four_hours: The amount of precipitation (liquid equivalent) that has fallen + in the past 24 hours. + :type past_twenty_four_hours: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'past_hour': {'key': 'pastHour', 'type': 'WeatherValue'}, + 'past_three_hours': {'key': 'pastThreeHours', 'type': 'WeatherValue'}, + 'past_six_hours': {'key': 'pastSixHours', 'type': 'WeatherValue'}, + 'past_nine_hours': {'key': 'pastNineHours', 'type': 'WeatherValue'}, + 'past_twelve_hours': {'key': 'pastTwelveHours', 'type': 'WeatherValue'}, + 'past_eighteen_hours': {'key': 'pastEighteenHours', 'type': 'WeatherValue'}, + 'past_twenty_four_hours': {'key': 'pastTwentyFourHours', 'type': 'WeatherValue'}, + } + + def __init__( + self, + *, + past_hour: Optional["WeatherValue"] = None, + past_three_hours: Optional["WeatherValue"] = None, + past_six_hours: Optional["WeatherValue"] = None, + past_nine_hours: Optional["WeatherValue"] = None, + past_twelve_hours: Optional["WeatherValue"] = None, + past_eighteen_hours: Optional["WeatherValue"] = None, + past_twenty_four_hours: Optional["WeatherValue"] = None, + **kwargs + ): + super(PrecipitationSummary, self).__init__(**kwargs) + self.past_hour = past_hour + self.past_three_hours = past_three_hours + self.past_six_hours = past_six_hours + self.past_nine_hours = past_nine_hours + self.past_twelve_hours = past_twelve_hours + self.past_eighteen_hours = past_eighteen_hours + self.past_twenty_four_hours = past_twenty_four_hours + + +class PressureTendency(msrest.serialization.Model): + """PressureTendency. + + :param description: Description of the pressure tendency in specified language. + :type description: str + :param code: Pressure tendency code regardless of language. One of F=Falling, S=Steady, + R=Rising. + :type code: str + """ + + _attribute_map = { + 'description': {'key': 'localizedDescription', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + code: Optional[str] = None, + **kwargs + ): + super(PressureTendency, self).__init__(**kwargs) + self.description = description + self.code = code + + +class QuarterDayForecast(msrest.serialization.Model): + """QuarterDayForecast. + + :param date_time: Date of the forecast as example, 2019-10-27T00:00:00. + :type date_time: ~datetime.datetime + :param effective_date: Date and time of the beginning of the forecast quarter displayed in ISO + 8601 format, for example, 2019-10-27T19:39:57-08:00. + :type effective_date: ~datetime.datetime + :param quarter: Quarter of the day. Possible values include: 0, 1, 2, 3. + :type quarter: str or ~azure.maps.weather.models.DayQuarter + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param icon_phrase: Phrase description of the icon. Displayed in specified language. For + example, 'Sunny'. + :type icon_phrase: str + :param phrase: Short summary phrase summary for quarter. + :type phrase: str + :param temperature: Temperature values for the quarter. + :type temperature: ~azure.maps.weather.models.WeatherValueRange + :param real_feel_temperature: RealFeel™ Temperature values for the quarter. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherValueRange + :param dew_point: The dewpoint temperature in specified unit. The dewpoint temperature is the + temperature that the air must be cooled to in order to reach saturation. + :type dew_point: ~azure.maps.weather.models.WeatherValue + :param relative_humidity: Relative humidity is the amount of water vapor present in air + expressed as a percentage of the amount needed for saturation at the same temperature. + :type relative_humidity: int + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind gust. Wind gust is a sudden, brief increase in speed of the wind. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param visibility: Visibility in specified unit. A measure of the distance at which an object + or light can be clearly discerned. + :type visibility: ~azure.maps.weather.models.WeatherValue + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + :param has_precipitation: Indicates the presence or absence of precipitation. True indicates + the presence of precipitation, false indicates the absence of precipitation. + :type has_precipitation: bool + :param precipitation_type: Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). + If dbz is zero, precipitationType is not present in the response. Possible values include: + "Rain", "Snow", "Ice", "Mix". + :type precipitation_type: str or ~azure.maps.weather.models.PrecipitationType + :param precipitation_intensity: Description of the intensity. + :type precipitation_intensity: str + :param precipitation_probability: Percent representing the probability of precipitation. For + example, '20'. + :type precipitation_probability: int + :param thunderstorm_probability: Percent representing the probability of a thunderstorm. For + example, '10'. + :type thunderstorm_probability: int + :param total_liquid: Total liquid equivalent of precipitation during the forecast period. + :type total_liquid: ~azure.maps.weather.models.WeatherValue + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherValue + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherValue + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'date_time': {'key': 'date', 'type': 'iso-8601'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'iso-8601'}, + 'quarter': {'key': 'quarter', 'type': 'int'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'icon_phrase': {'key': 'iconPhrase', 'type': 'str'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValueRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherValueRange'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherValue'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherValue'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'precipitation_type': {'key': 'precipitationType', 'type': 'str'}, + 'precipitation_intensity': {'key': 'precipitationIntensity', 'type': 'str'}, + 'precipitation_probability': {'key': 'precipitationProbability', 'type': 'int'}, + 'thunderstorm_probability': {'key': 'thunderstormProbability', 'type': 'int'}, + 'total_liquid': {'key': 'totalLiquid', 'type': 'WeatherValue'}, + 'rain': {'key': 'rain', 'type': 'WeatherValue'}, + 'snow': {'key': 'snow', 'type': 'WeatherValue'}, + 'ice': {'key': 'ice', 'type': 'WeatherValue'}, + } + + def __init__( + self, + *, + date_time: Optional[datetime.datetime] = None, + effective_date: Optional[datetime.datetime] = None, + quarter: Optional[Union[int, "DayQuarter"]] = None, + icon_code: Optional[Union[int, "IconCode"]] = None, + icon_phrase: Optional[str] = None, + phrase: Optional[str] = None, + temperature: Optional["WeatherValueRange"] = None, + real_feel_temperature: Optional["WeatherValueRange"] = None, + dew_point: Optional["WeatherValue"] = None, + relative_humidity: Optional[int] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + visibility: Optional["WeatherValue"] = None, + cloud_cover: Optional[int] = None, + has_precipitation: Optional[bool] = None, + precipitation_type: Optional[Union[str, "PrecipitationType"]] = None, + precipitation_intensity: Optional[str] = None, + precipitation_probability: Optional[int] = None, + thunderstorm_probability: Optional[int] = None, + total_liquid: Optional["WeatherValue"] = None, + rain: Optional["WeatherValue"] = None, + snow: Optional["WeatherValue"] = None, + ice: Optional["WeatherValue"] = None, + **kwargs + ): + super(QuarterDayForecast, self).__init__(**kwargs) + self.date_time = date_time + self.effective_date = effective_date + self.quarter = quarter + self.icon_code = icon_code + self.icon_phrase = icon_phrase + self.phrase = phrase + self.temperature = temperature + self.real_feel_temperature = real_feel_temperature + self.dew_point = dew_point + self.relative_humidity = relative_humidity + self.wind = wind + self.wind_gust = wind_gust + self.visibility = visibility + self.cloud_cover = cloud_cover + self.has_precipitation = has_precipitation + self.precipitation_type = precipitation_type + self.precipitation_intensity = precipitation_intensity + self.precipitation_probability = precipitation_probability + self.thunderstorm_probability = thunderstorm_probability + self.total_liquid = total_liquid + self.rain = rain + self.snow = snow + self.ice = ice + + +class QuarterDayForecastResponse(msrest.serialization.Model): + """QuarterDayForecastResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar forecasts: Forecast data for each quarter in the response. + :vartype forecasts: list[~azure.maps.weather.models.QuarterDayForecast] + """ + + _validation = { + 'forecasts': {'readonly': True}, + } + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[QuarterDayForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuarterDayForecastResponse, self).__init__(**kwargs) + self.forecasts = None + + +class SevereWeatherAlert(msrest.serialization.Model): + """Information about a severe weather alert. + + :param country_code: 2-character ISO 3166-1 Alpha-2 country code, for example, "US". + :type country_code: str + :param alert_id: A unique numerical identifier for a weather alert. + :type alert_id: int + :param description: Description of the alert. + :type description: ~azure.maps.weather.models.SevereWeatherAlertDescription + :param category: Category of the alert. + :type category: str + :param priority: Number signifying the importance or ranking order of the given alert within + the country/region it has originated. A lower number signifies a higher priority. For example, + 1 is the highest priority. The number varies by country/region and can change over time as each + country/region evolves their alert systems. + :type priority: int + :param classification: Classification of the alert. This field is not available for all + countries and therefore not always returned. + :type classification: str + :param level: Severity level of the alert. This field is not available for all countries and + therefore not always returned. + :type level: str + :param source: The provider of the alert information. By default the source is returned in + English (en-US). The alerts are from official Government Meteorological Agencies and leading + global weather alert providers. + :type source: str + :param source_id: A numerical identifier associated with the source provider name of the alert + data. + :type source_id: int + :param disclaimer: A disclaimer regarding the source of the alert information. This field is + not always available. For example, disclaimer may include details about the delays or potential + issues related to the alarm. + :type disclaimer: str + :param alert_details: Information about the alert specific to the affected area(s). + :type alert_details: list[~azure.maps.weather.models.AlertDetails] + """ + + _attribute_map = { + 'country_code': {'key': 'countryCode', 'type': 'str'}, + 'alert_id': {'key': 'alertId', 'type': 'int'}, + 'description': {'key': 'description', 'type': 'SevereWeatherAlertDescription'}, + 'category': {'key': 'category', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'classification': {'key': 'class', 'type': 'str'}, + 'level': {'key': 'level', 'type': 'str'}, + 'source': {'key': 'source', 'type': 'str'}, + 'source_id': {'key': 'sourceId', 'type': 'int'}, + 'disclaimer': {'key': 'disclaimer', 'type': 'str'}, + 'alert_details': {'key': 'alertAreas', 'type': '[AlertDetails]'}, + } + + def __init__( + self, + *, + country_code: Optional[str] = None, + alert_id: Optional[int] = None, + description: Optional["SevereWeatherAlertDescription"] = None, + category: Optional[str] = None, + priority: Optional[int] = None, + classification: Optional[str] = None, + level: Optional[str] = None, + source: Optional[str] = None, + source_id: Optional[int] = None, + disclaimer: Optional[str] = None, + alert_details: Optional[List["AlertDetails"]] = None, + **kwargs + ): + super(SevereWeatherAlert, self).__init__(**kwargs) + self.country_code = country_code + self.alert_id = alert_id + self.description = description + self.category = category + self.priority = priority + self.classification = classification + self.level = level + self.source = source + self.source_id = source_id + self.disclaimer = disclaimer + self.alert_details = alert_details + + +class SevereWeatherAlertDescription(msrest.serialization.Model): + """Description of a severe weather alert. + + :param description: Description of the alert in the specified language. By default English + (en-US) is returned if the language parameter is not specified in the request. + :type description: str + :param status: Description of the alert in English (en-US). + :type status: str + """ + + _attribute_map = { + 'description': {'key': 'localized', 'type': 'str'}, + 'status': {'key': 'english', 'type': 'str'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + status: Optional[str] = None, + **kwargs + ): + super(SevereWeatherAlertDescription, self).__init__(**kwargs) + self.description = description + self.status = status + + +class SevereWeatherAlertsResponse(msrest.serialization.Model): + """This object is returned from a successful Get Severe Weather Alerts call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar results: A list of all severe weather alerts for the queried location. + :vartype results: list[~azure.maps.weather.models.SevereWeatherAlert] + """ + + _validation = { + 'results': {'readonly': True}, + } + + _attribute_map = { + 'results': {'key': 'results', 'type': '[SevereWeatherAlert]'}, + } + + def __init__( + self, + **kwargs + ): + super(SevereWeatherAlertsResponse, self).__init__(**kwargs) + self.results = None + + +class SunGlare(msrest.serialization.Model): + """A rating that indicates how blinding the sun is for the driver. + + :param calculated_vehicle_heading: If the vehicle heading value is not provided for a waypoint, + then the service will calculate a heading based upon the location of neighboring waypoints if + provided. + :type calculated_vehicle_heading: int + :param glare_index: An index from 0 to 100 indicating sun glare intensity for a driver. A value + of 50 and above can be considered a hazard for some drivers and a value of 100 signifies the + driver is driving straight into the sun and atmospheric conditions are clear allowing for the + full intensity of the sun to blind the driver. + :type glare_index: int + """ + + _attribute_map = { + 'calculated_vehicle_heading': {'key': 'calculatedVehicleHeading', 'type': 'int'}, + 'glare_index': {'key': 'glareIndex', 'type': 'int'}, + } + + def __init__( + self, + *, + calculated_vehicle_heading: Optional[int] = None, + glare_index: Optional[int] = None, + **kwargs + ): + super(SunGlare, self).__init__(**kwargs) + self.calculated_vehicle_heading = calculated_vehicle_heading + self.glare_index = glare_index + + +class TemperatureSummary(msrest.serialization.Model): + """TemperatureSummary. + + :param past_six_hours: Summary of temperature fluctuations over the past 6 hours. + :type past_six_hours: ~azure.maps.weather.models.PastHoursTemperature + :param past_twelve_hours: Summary of temperature fluctuations over the past 12 hours. + :type past_twelve_hours: ~azure.maps.weather.models.PastHoursTemperature + :param past_twenty_four_hours: Summary of temperature fluctuations over the past 24 hours. + :type past_twenty_four_hours: ~azure.maps.weather.models.PastHoursTemperature + """ + + _attribute_map = { + 'past_six_hours': {'key': 'pastSixHours', 'type': 'PastHoursTemperature'}, + 'past_twelve_hours': {'key': 'pastTwelveHours', 'type': 'PastHoursTemperature'}, + 'past_twenty_four_hours': {'key': 'pastTwentyFourHours', 'type': 'PastHoursTemperature'}, + } + + def __init__( + self, + *, + past_six_hours: Optional["PastHoursTemperature"] = None, + past_twelve_hours: Optional["PastHoursTemperature"] = None, + past_twenty_four_hours: Optional["PastHoursTemperature"] = None, + **kwargs + ): + super(TemperatureSummary, self).__init__(**kwargs) + self.past_six_hours = past_six_hours + self.past_twelve_hours = past_twelve_hours + self.past_twenty_four_hours = past_twenty_four_hours + + +class WaypointForecast(msrest.serialization.Model): + """WaypointForecast. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param short_description: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_description: str + :param is_daytime: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_daytime: bool + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + :param temperature: Specific value of a given unit related to weather. + :type temperature: ~azure.maps.weather.models.WeatherValue + :param wind: Wind details being returned including speed and direction. + :type wind: ~azure.maps.weather.models.WindDetails + :param wind_gust: Wind details being returned including speed and direction. + :type wind_gust: ~azure.maps.weather.models.WindDetails + :param precipitation: Precipitation forecast of the weather along the route. + :type precipitation: ~azure.maps.weather.models.WeatherAlongRoutePrecipitation + :param lightning_count: Estimation of thunderstorm intensity on an open scale. A value of 0 + means there is no thunderstorm; values of 1 and higher mean there is a thunderstorm in + increasing intensity. + :type lightning_count: int + :param sun_glare: A rating that indicates how blinding the sun is for the driver. + :type sun_glare: ~azure.maps.weather.models.SunGlare + :param hazards: Description of the weather hazard affecting the trip. + :type hazards: ~azure.maps.weather.models.WeatherHazards + :param notifications: List of weather hazard notifications. + :type notifications: list[~azure.maps.weather.models.WeatherNotification] + """ + + _attribute_map = { + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + 'is_daytime': {'key': 'isDayTime', 'type': 'bool'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherValue'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'precipitation': {'key': 'precipitation', 'type': 'WeatherAlongRoutePrecipitation'}, + 'lightning_count': {'key': 'lightningCount', 'type': 'int'}, + 'sun_glare': {'key': 'sunGlare', 'type': 'SunGlare'}, + 'hazards': {'key': 'hazards', 'type': 'WeatherHazards'}, + 'notifications': {'key': 'notifications', 'type': '[WeatherNotification]'}, + } + + def __init__( + self, + *, + icon_code: Optional[Union[int, "IconCode"]] = None, + short_description: Optional[str] = None, + is_daytime: Optional[bool] = None, + cloud_cover: Optional[int] = None, + temperature: Optional["WeatherValue"] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + precipitation: Optional["WeatherAlongRoutePrecipitation"] = None, + lightning_count: Optional[int] = None, + sun_glare: Optional["SunGlare"] = None, + hazards: Optional["WeatherHazards"] = None, + notifications: Optional[List["WeatherNotification"]] = None, + **kwargs + ): + super(WaypointForecast, self).__init__(**kwargs) + self.icon_code = icon_code + self.short_description = short_description + self.is_daytime = is_daytime + self.cloud_cover = cloud_cover + self.temperature = temperature + self.wind = wind + self.wind_gust = wind_gust + self.precipitation = precipitation + self.lightning_count = lightning_count + self.sun_glare = sun_glare + self.hazards = hazards + self.notifications = notifications + + +class WeatherAlongRoutePrecipitation(msrest.serialization.Model): + """Precipitation forecast of the weather along the route. + + :param dbz: The forecasted precipitation intensity in dBZ (decibels relative to Z) from 0.0 to + 100.0. + :type dbz: float + :param type: Precipitation type. If precipitation should occur, the type that it will be: + "RAIN," "HAIL," "SNOW," "ICE," or "MIX.". + :type type: str + """ + + _attribute_map = { + 'dbz': {'key': 'dbz', 'type': 'float'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + dbz: Optional[float] = None, + type: Optional[str] = None, + **kwargs + ): + super(WeatherAlongRoutePrecipitation, self).__init__(**kwargs) + self.dbz = dbz + self.type = type + + +class WeatherAlongRouteResponse(msrest.serialization.Model): + """This object is returned from a successful Weather Along Route. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Short summary of the weather along the route. + :vartype summary: ~azure.maps.weather.models.WeatherAlongRouteSummary + :ivar waypoints: Data for each waypoint returned in the same order as specified in the request. + :vartype waypoints: list[~azure.maps.weather.models.WaypointForecast] + """ + + _validation = { + 'summary': {'readonly': True}, + 'waypoints': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'WeatherAlongRouteSummary'}, + 'waypoints': {'key': 'waypoints', 'type': '[WaypointForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherAlongRouteResponse, self).__init__(**kwargs) + self.summary = None + self.waypoints = None + + +class WeatherAlongRouteSummary(msrest.serialization.Model): + """Short summary of the weather along the route. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + Possible values include: 1, 2, 3, 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44. + :type icon_code: str or ~azure.maps.weather.models.IconCode + :param hazards: Description of the weather hazard affecting the trip. + :type hazards: ~azure.maps.weather.models.WeatherHazards + """ + + _attribute_map = { + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'hazards': {'key': 'hazards', 'type': 'WeatherHazards'}, + } + + def __init__( + self, + *, + icon_code: Optional[Union[int, "IconCode"]] = None, + hazards: Optional["WeatherHazards"] = None, + **kwargs + ): + super(WeatherAlongRouteSummary, self).__init__(**kwargs) + self.icon_code = icon_code + self.hazards = hazards + + +class WeatherHazards(msrest.serialization.Model): + """Description of the weather hazard affecting the trip. + + :param max_hazard_index: A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. Possible values include: 0, 1, 2, 3, 4. + :type max_hazard_index: str or ~azure.maps.weather.models.HazardIndex + :param details: Details of the weather hazards affecting the trip. + :type details: list[~azure.maps.weather.models.HazardDetail] + """ + + _attribute_map = { + 'max_hazard_index': {'key': 'maxHazardIndex', 'type': 'int'}, + 'details': {'key': 'hazardDetails', 'type': '[HazardDetail]'}, + } + + def __init__( + self, + *, + max_hazard_index: Optional[Union[int, "HazardIndex"]] = None, + details: Optional[List["HazardDetail"]] = None, + **kwargs + ): + super(WeatherHazards, self).__init__(**kwargs) + self.max_hazard_index = max_hazard_index + self.details = details + + +class WeatherNotification(msrest.serialization.Model): + """WeatherNotification. + + :param type: A type of notification generated to warn drivers of the onset of a hazard, or + increase in intensity of a hazard. + :type type: str + :param hazard_index: A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. Possible values include: 0, 1, 2, 3, 4. + :type hazard_index: str or ~azure.maps.weather.models.HazardIndex + :param hazard_code: A unique identifier (non-displayable) for each type of hazard: LightRain, + ModerateRain, HeavyRain, LightMix, ModerateMix, HeavyMix, LightSnow, ModerateSnow, HeavySnow, + LightIce, ModerateIce, HeavyIce, Hail, LargeHail, SunGlare, SunGlareHigh, Lightning, + SevereLightning, WindModerate, WindHigh, WindExtreme, FloodWarning, FlashFloodWarning, + TornadoWarning, TsunamiWarning, SevereThunderstormWarning. + :type hazard_code: str + :param short_description: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_description: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_description': {'key': 'shortPhrase', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + hazard_index: Optional[Union[int, "HazardIndex"]] = None, + hazard_code: Optional[str] = None, + short_description: Optional[str] = None, + **kwargs + ): + super(WeatherNotification, self).__init__(**kwargs) + self.type = type + self.hazard_index = hazard_index + self.hazard_code = hazard_code + self.short_description = short_description + + +class WeatherValue(msrest.serialization.Model): + """Specific value of a given unit related to weather. + + :param value: Rounded value. + :type value: float + :param unit_label: Type of unit for the returned value. + :type unit_label: str + :param unit_type: Numeric ID value associated with the type of unit being displayed. Can be + used for unit translation. Please refer to `Weather Service Concepts + `_ for details. Possible values include: 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31. + :type unit_type: str or ~azure.maps.weather.models.UnitType + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'float'}, + 'unit_label': {'key': 'unit', 'type': 'str'}, + 'unit_type': {'key': 'unitType', 'type': 'int'}, + } + + def __init__( + self, + *, + value: Optional[float] = None, + unit_label: Optional[str] = None, + unit_type: Optional[Union[int, "UnitType"]] = None, + **kwargs + ): + super(WeatherValue, self).__init__(**kwargs) + self.value = value + self.unit_label = unit_label + self.unit_type = unit_type + + +class WeatherValueRange(msrest.serialization.Model): + """Returned temperature values. + + :param minimum: Minimum temperature for the time period. + :type minimum: ~azure.maps.weather.models.WeatherValue + :param maximum: Maximum temperature for the time period. + :type maximum: ~azure.maps.weather.models.WeatherValue + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherValue'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherValue'}, + } + + def __init__( + self, + *, + minimum: Optional["WeatherValue"] = None, + maximum: Optional["WeatherValue"] = None, + **kwargs + ): + super(WeatherValueRange, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + + +class WindDetails(msrest.serialization.Model): + """Wind details being returned including speed and direction. + + :param direction: Wind direction. + :type direction: ~azure.maps.weather.models.WindDirection + :param speed: Speed of the wind in specified unit. + :type speed: ~azure.maps.weather.models.WindSpeed + """ + + _attribute_map = { + 'direction': {'key': 'direction', 'type': 'WindDirection'}, + 'speed': {'key': 'speed', 'type': 'WindSpeed'}, + } + + def __init__( + self, + *, + direction: Optional["WindDirection"] = None, + speed: Optional["WindSpeed"] = None, + **kwargs + ): + super(WindDetails, self).__init__(**kwargs) + self.direction = direction + self.speed = speed + + +class WindDirection(msrest.serialization.Model): + """Wind direction. + + :param degrees: Wind direction in Azimuth degrees, starting at true North and continuing in + clockwise direction. North is 0 degrees, east is 90 degrees, south is 180 degrees, west is 270 + degrees. Possible values 0-359. + :type degrees: int + :param description: Direction abbreviation in the specified language. + :type description: str + """ + + _attribute_map = { + 'degrees': {'key': 'degrees', 'type': 'int'}, + 'description': {'key': 'localizedDescription', 'type': 'str'}, + } + + def __init__( + self, + *, + degrees: Optional[int] = None, + description: Optional[str] = None, + **kwargs + ): + super(WindDirection, self).__init__(**kwargs) + self.degrees = degrees + self.description = description + + +class WindSpeed(msrest.serialization.Model): + """Speed of wind in specified unit. + + :param value: Rounded value of the speed. + :type value: float + :param unit: Type of unit for the speed value. + :type unit: str + :param unit_type: Numeric ID value associated with the type of unit being displayed. Can be + used for unit translation. Please refer to `Weather Service Concepts + `_ for details. Possible values include: 0, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31. + :type unit_type: str or ~azure.maps.weather.models.UnitType + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_type': {'key': 'unitType', 'type': 'int'}, + } + + def __init__( + self, + *, + value: Optional[float] = None, + unit: Optional[str] = None, + unit_type: Optional[Union[int, "UnitType"]] = None, + **kwargs + ): + super(WindSpeed, self).__init__(**kwargs) + self.value = value + self.unit = unit + self.unit_type = unit_type diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/models/_weather_client_enums.py b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_weather_client_enums.py new file mode 100644 index 000000000000..06c66e4aeba8 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_weather_client_enums.py @@ -0,0 +1,253 @@ +# 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 DayQuarter(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """Quarter of the day. + """ + + #: 7:00 am - 1:00 pm / 7:00- 13:00. + FIRST_QUARTER = 0 + #: 1:00 pm - 7:00 pm/ 13:00- 19:00. + SECOND_QUARTER = 1 + #: 7:00 pm - 1:00 am/ 19:00 - 01:00. + THIRD_QUARTER = 2 + #: 1:00 am - 7:00 am/ 01:00 - 07:00. + FORTH_QUARTER = 3 + +class HazardIndex(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """A severity/hazard index. + + + * ``0`` - No hazard. + * ``1`` - Be informed, be aware. + * ``2`` - Pay attention, be prepared. + * ``3`` - Take action. + * ``4`` - Life threatening, emergency. + """ + + #: No hazard. + NO_HAZARD = 0 + #: Be informed. + INFORMED = 1 + #: Pay attention. + PAY_ATTENTION = 2 + #: Take action. + TAKE_ACTION = 3 + #: Emergency. + EMERGENCY = 4 + +class IconCode(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """Numeric value representing an image that displays the ``iconPhrase``. Please refer to `Weather + Service Concepts `_ for details. + """ + + #: Sunny. + SUNNY = 1 + #: Mostly Sunny. + MOSTLY_SUNNY = 2 + #: Partly Sunny. + PARTLY_SUNNY = 3 + #: Intermittent Clouds. + INTERMITTENT_CLOUDS = 4 + #: Hazy Sunshine. + HAZY_SUNSHINE = 5 + #: Mostly Cloudy. + MOSTLY_CLOUDY = 6 + #: Cloudy. + CLOUDY = 7 + #: Dreary (Overcast). + DREARY = 8 + #: Fog. + FOG = 11 + #: Showers. + SHOWERS = 12 + #: Mostly Cloudy with Showers. + MOSTLY_CLOUDY_WITH_SHOWERS = 13 + #: Partly Sunny with Showers. + PARTLY_SUNNY_WITH_SHOWERS = 14 + #: Thunderstorms. + THUNDERSTORMS = 15 + #: Mostly Cloudy with Thunderstorms. + MOSTLY_CLOUDY_WITH_THUNDERSTORMS = 16 + #: Partly Sunny with Thunderstorms. + PARTLY_SUNNY_WITH_THUNDERSTORMS = 17 + #: Rain. + RAIN = 18 + #: Flurries. + FLURRIES = 19 + #: Mostly Cloudy with Flurries. + MOSTLY_CLOUDY_WITH_FLURRIES = 20 + #: Partly Sunny with Flurries. + PARTLY_SUNNY_WITH_FLURRIES = 21 + #: Snow. + SNOW = 22 + #: Mostly Cloudy with Snow. + MOSTLY_CLOUDY_WITH_SNOW = 23 + #: Ice. + ICE = 24 + #: Sleet. + SLEET = 25 + #: Freezing Rain. + FREEZING_RAIN = 26 + #: Rain and Snow. + RAIN_AND_SNOW = 29 + #: Hot. + HOT = 30 + #: Cold. + COLD = 31 + #: Windy. + WINDY = 32 + #: Clear. + CLEAR = 33 + #: Mostly Clear. + MOSTLY_CLEAR = 34 + #: Partly Cloudy. + PARTLY_CLOUDY = 35 + #: Intermittent Clouds (Night). + INTERMITTENT_CLOUDS_NIGHT = 36 + #: Hazy Moonlight. + HAZY_MOONLIGHT = 37 + #: Mostly Cloudy (Night). + MOSTLY_CLOUDY_NIGHT = 38 + #: Partly Cloudy with Showers. + PARTLY_CLOUDY_WITH_SHOWERS = 39 + #: Mostly Cloudy with Showers (Night). + MOSTLY_CLOUDY_WITH_SHOWERS_NIGHT = 40 + #: Partly Cloudy with Thunderstorms. + PARTLY_CLOUDY_WITH_THUNDERSTORMS = 41 + #: Mostly Cloudy with Thunderstorms (Night). + MOSTLY_CLOUDY_WITH_THUNDERSTORMS_NIGHT = 42 + #: Mostly Cloudy with Flurries (Night). + MOSTLY_CLOUDY_WITH_FLURRIES_NIGHT = 43 + #: Mostly Cloudy with Snow (Night). + MOSTLY_CLOUDY_WITH_SNOW_NIGHT = 44 + +class JsonFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class LatestStatusKeyword(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Keyword for the latest status of the alert. + """ + + #: "New" - the status of an alert upon initial issuance. + NEW = "New" + #: "Extend" - the alert has been extended in time, in area, or both since its initial issuance. + EXTEND = "Extend" + #: "Cancel" - the alert has been canceled prior to its original expiration time. + CANCEL = "Cancel" + #: "Correct" - the alert has been modified to correct a previous error. + CORRECT = "Correct" + #: "Expire" - the alert has expired and is no longer active. + EXPIRE = "Expire" + #: "Upgrade" - the alert has been upgraded to a higher class or category since its initial + #: issuance. + UPGRADE = "Upgrade" + #: "Continue" - the alert has been updated since its initial issuance, but no changes were made to + #: ``alertDetails``\ , ``startTime``\ , ``endTime``\ , or ``class``. + CONTINUE_ENUM = "Continue" + #: "Update" - the alert has been updated since its initial issuance. + UPDATE = "Update" + +class PrecipitationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the type of precipitation ("Rain" "Snow" "Ice" or "Mix"). If dbz is zero, + precipitationType is not present in the response. + """ + + #: Rain. + RAIN = "Rain" + #: Snow. + SNOW = "Snow" + #: Ice. + ICE = "Ice" + #: Mix. + MIX = "Mix" + +class UnitType(with_metaclass(_CaseInsensitiveEnumMeta, int, Enum)): + """Numeric ID value associated with the type of unit being displayed. Can be used for unit + translation. Please refer to `Weather Service Concepts + `_ for details. + """ + + #: feet. + FEET = 0 + #: inches. + INCHES = 1 + #: miles. + MILES = 2 + #: millimeter. + MILLIMETER = 3 + #: centimeter. + CENTIMETER = 4 + #: meter. + METER = 5 + #: kilometer. + KILOMETER = 6 + #: kilometersPerHour. + KILOMETERS_PER_HOUR = 7 + #: knots. + KNOTS = 8 + #: milesPerHour. + MILES_PER_HOUR = 9 + #: metersPerSecond. + METERS_PER_SECOND = 10 + #: hectoPascals. + HECTO_PASCALS = 11 + #: inchesOfMercury. + INCHES_OF_MERCURY = 12 + #: kiloPascals. + KILO_PASCALS = 13 + #: millibars. + MILLIBARS = 14 + #: millimetersOfMercury. + MILLIMETERS_OF_MERCURY = 15 + #: poundsPerSquareInch. + POUNDS_PER_SQUARE_INCH = 16 + #: celsius. + CELSIUS = 17 + #: fahrenheit. + FAHRENHEIT = 18 + #: kelvin. + KELVIN = 19 + #: percent. + PERCENT = 20 + #: float. + FLOAT = 21 + #: integer. + INTEGER = 22 + #: MicrogramsPerCubicMeterOfAir. + MICROGRAMS_PER_CUBIC_METER_OF_AIR = 31 + +class WeatherDataUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Return data in metric units. Some example units of metric system are Celsius and kilometer. + METRIC = "metric" + #: Return data in imperial units. Some example units of imperial system are Fahrenheit and mile. + IMPERIAL = "imperial" diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/operations/__init__.py b/sdk/maps/azure-maps-weather/azure/maps/weather/operations/__init__.py new file mode 100644 index 000000000000..89299c2bd587 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/operations/__init__.py @@ -0,0 +1,13 @@ +# 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 ._weather_operations import WeatherOperations + +__all__ = [ + 'WeatherOperations', +] diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/operations/_weather_operations.py b/sdk/maps/azure-maps-weather/azure/maps/weather/operations/_weather_operations.py new file mode 100644 index 000000000000..98f0519e73bd --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/operations/_weather_operations.py @@ -0,0 +1,866 @@ +# 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, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class WeatherOperations(object): + """WeatherOperations 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.weather.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_hourly_forecast( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + unit=None, # type: Optional[Union[str, "_models.WeatherDataUnit"]] + duration=None, # type: Optional[int] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.HourlyForecastResponse" + """**Get Hourly Forecast** + + **Applies to**\ : S0 and S1 pricing tiers. + + Request detailed weather forecast by the hour for the next 1, 12, 24 (1 day), 72 (3 days), 120 + (5 days), and 240 hours (10 days) for the given the given coordinate location. The API returns + details such as temperature, humidity, wind, precipitation, and ultraviolet (UV) index. + + In S0 you can request hourly forecast for the next 1, 12, 24 hours (1 day), and 72 hours (3 + days). In S1 you can also request hourly forecast for the next 120 (5 days) and 240 hours (10 + days). + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param duration: Time frame of the returned weather forecast. By default, the forecast data for + next hour will be returned. Available values are + + + * ``1`` - Return forecast data for the next hour. Default value. + * ``12`` - Return hourly forecast for next 12 hours. + * ``24`` - Return hourly forecast for next 24 hours. + * ``72`` - Return hourly forecast for next 72 hours (3 days). + * ``120`` - Return hourly forecast for next 120 hours (5 days). Only available in S1 SKU. + * ``240`` - Return hourly forecast for next 240 hours (10 days). Only available in S1 SKU. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HourlyForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.HourlyForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HourlyForecastResponse"] + 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_hourly_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('HourlyForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_hourly_forecast.metadata = {'url': '/weather/forecast/hourly/{format}'} # type: ignore + + def get_minute_forecast( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + interval=None, # type: Optional[int] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.MinuteForecastResponse" + """**Get Minute Forecast** + + **Applies to**\ : S1 pricing tier. + + Get Minute Forecast service returns minute-by-minute forecasts for a given location for the + next 120 minutes. Users can request weather forecasts in the interval of 1, 5 and 15 minutes. + The response will include details such as the type of precipitation (including rain, snow, or a + mixture of both), start time, and precipitation intensity value (dBZ). + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param interval: Specifies time interval in minutes for the returned weather forecast. + Supported values are + + + * ``1`` - Retrieve forecast for 1-minute intervals. Returned by default. + * ``5`` - Retrieve forecasts for 5-minute intervals. + * ``15`` - Retrieve forecasts for 15-minute intervals. + :type interval: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MinuteForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.MinuteForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MinuteForecastResponse"] + 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_minute_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if interval is not None: + query_parameters['interval'] = self._serialize.query("interval", interval, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('MinuteForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_minute_forecast.metadata = {'url': '/weather/forecast/minute/{format}'} # type: ignore + + def get_quarter_day_forecast( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + unit=None, # type: Optional[Union[str, "_models.WeatherDataUnit"]] + duration=None, # type: Optional[int] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.QuarterDayForecastResponse" + """**Get Quarter-Day Forecast** + + **Applies to**\ : S0 and S1 pricing tiers. + + Service returns detailed weather forecast by quarter-day for the next 1, 5, 10, or 15 days for + a given location. Response data is presented by quarters of the day - morning, afternoon, + evening, and overnight. Details such as temperature, humidity, wind, precipitation, and UV + index are returned. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param duration: Specifies for how many days the quester-day forecast responses are returned. + Supported values are: + + + * ``1`` - Return forecast data for the next day. Returned by default. + * ``5`` - Return forecast data for the next 5 days. + * ``10`` - Return forecast data for next 10 days. + * ``15`` - Return forecast data for the next 15 days. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuarterDayForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.QuarterDayForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.QuarterDayForecastResponse"] + 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_quarter_day_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('QuarterDayForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_quarter_day_forecast.metadata = {'url': '/weather/forecast/quarterDay/{format}'} # type: ignore + + def get_current_conditions( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + unit=None, # type: Optional[Union[str, "_models.WeatherDataUnit"]] + details=None, # type: Optional[str] + duration=None, # type: Optional[int] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.CurrentConditionsResponse" + """**Get Current Conditions** + + **Applies to**\ : S0 and S1 pricing tiers. + + Get Current Conditions service returns detailed current weather conditions such as + precipitation, temperature and wind for a given coordinate location. Also, observations from + the past 6 or 24 hours for a particular location can be retrieved. The basic information + returned with the response include details such as observation date and time, brief description + of the weather conditions, weather icon, precipitation indicator flags, and temperature. + Additional details such as RealFeel™ Temperature and UV index are also returned. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param details: Return full details for the current conditions. Available values are + + + * ``true`` - Returns full details. By default all details are returned. + * ``false`` - Returns a truncated version of the current condition data, which includes + observation date time, weather phrase, icon code, precipitation indicator flag, and + temperature. + :type details: str + :param duration: Time frame of the returned weather conditions. By default, the most current + weather conditions will be returned. Default value is 0. Supported values are: + + + * ``0`` - Return the most current weather conditions. + * ``6`` - Return weather conditions from past 6 hours. + * ``24`` - Return weather conditions from past 24 hours. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CurrentConditionsResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.CurrentConditionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CurrentConditionsResponse"] + 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_current_conditions.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('CurrentConditionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_current_conditions.metadata = {'url': '/weather/currentConditions/{format}'} # type: ignore + + def get_daily_forecast( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + unit=None, # type: Optional[Union[str, "_models.WeatherDataUnit"]] + duration=None, # type: Optional[int] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.DailyForecastResponse" + """**Get Daily Forecast** + + **Applies to**\ : S0 and S1 pricing tiers. + + The service returns detailed weather forecast such as temperature and wind by day for the next + 1, 5, 10, 15, 25, or 45 days for a given coordinate location. The response include details + such as temperature, wind, precipitation, air quality, and UV index. + + In S0 you can request daily forecast for the next 1, 5, 10, and 15 days. In S1 you can also + request daily forecast for the next 25 days, and 45 days. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param unit: Specifies to return the data in either metric units or imperial units. Default + value is metric. + :type unit: str or ~azure.maps.weather.models.WeatherDataUnit + :param duration: Specifies for how many days the daily forecast responses are returned. + Available values are + + + * ``1`` - Return forecast data for the next day. Returned by default. + * ``5`` - Return forecast data for the next 5 days. + * ``10`` - Return forecast data for the next 10 days. + * ``25`` - Return forecast data for the next 25 days. Only available in S1 SKU. + * ``45`` - Return forecast data for the next 45 days. Only available in S1 SKU. + :type duration: int + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DailyForecastResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.DailyForecastResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DailyForecastResponse"] + 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_daily_forecast.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if unit is not None: + query_parameters['unit'] = self._serialize.query("unit", unit, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('DailyForecastResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_daily_forecast.metadata = {'url': '/weather/forecast/daily/{format}'} # type: ignore + + def get_weather_along_route( + self, + query, # type: str + format="json", # type: Union[str, "_models.JsonFormat"] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.WeatherAlongRouteResponse" + """**Get Weather along route** + + **Applies to**\ : S1 pricing tier. + + Weather along a route API returns hyper local (one kilometer or less), up-to-the-minute + weather nowcasts, weather hazard assessments, and notifications along a route described as a + sequence of waypoints. + This includes a list of weather hazards affecting the waypoint or route, and the aggregated + hazard index for each waypoint might be used to paint each portion of a route according to how + safe it is for the driver. When submitting the waypoints, it is recommended to stay within, or + close to, the distance that can be traveled within 120-mins or shortly after. Data is updated + every five minutes. + + The service supplements Azure Maps `Route Service + `_ that allows you to first request a route + between an origin and a destination and use that as an input for Weather Along Route endpoint. + + In addition, the service supports scenarios to generate weather notifications for waypoints + that experience an increase in intensity of a weather hazard. For example, if the vehicle is + expected to begin experiencing heavy rain as it reaches a waypoint, a weather notification for + heavy rain will be generated for that waypoint allowing the end product to display a heavy rain + notification before the driver reaches that waypoint. + The trigger for when to display the notification for a waypoint could be based, for example, + on a `geofence `_\ , or + selectable distance to the waypoint. + + The API covers all regions of the planet except latitudes above Greenland and Antarctica. + + :param query: Coordinates through which the route is calculated, separated by colon (:) and + entered in chronological order. A minimum of two waypoints is required. A single API call may + contain up to 60 waypoints. + A waypoint indicates location, ETA, and optional heading: latitude,longitude,ETA,heading, + where + + + * ``Latitude`` - Latitude coordinate in decimal degrees. + * ``Longitude`` - Longitude coordinate in decimal degrees. + * ``ETA (estimated time of arrival)`` - The number of minutes from the present time that it + will take for the vehicle to reach the waypoint. Allowed range is from 0.0 to 120.0 minutes. + * ``Heading`` - An optional value indicating the vehicle heading as it passes the waypoint. + Expressed in clockwise degrees relative to true north. This is issued to calculate sun glare as + a driving hazard. Allowed range is from 0.0 to 360.0 degrees. If not provided, a heading will + automatically be derived based on the position of neighboring waypoints. + + It is recommended to stay within, or close to, the distance that can be traveled within + 120-mins or shortly after. This way a more accurate assessment can be provided for the trip and + prevent isolated events not being captured between waypoints. Information can and should be + updated along the route (especially for trips greater than 2 hours) to continuously pull new + waypoints moving forward, but also to ensure that forecast information for content such as + precipitation type and intensity is accurate as storms develop and dissipate over time. + :type query: str + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WeatherAlongRouteResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.WeatherAlongRouteResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WeatherAlongRouteResponse"] + 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_weather_along_route.metadata['url'] # type: ignore + path_format_arguments = { + '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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('WeatherAlongRouteResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_weather_along_route.metadata = {'url': '/weather/route/{format}'} # type: ignore + + def get_severe_weather_alerts( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + language=None, # type: Optional[str] + details=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SevereWeatherAlertsResponse" + """**Get Severe Weather Alerts** + + **Applies to**\ : S0 and S1 pricing tiers. + + Severe weather phenomenon can significantly impact our everyday life and business operations. + For example, severe weather conditions such as tropical storms, high winds or flooding can + close roads and force logistics companies to reroute their fleet causing delays in reaching + destinations and breaking the cold chain of refrigerated food products.  Azure Maps + Severe Weather Alerts API returns the severe weather alerts that are available worldwide + from both official Government Meteorological Agencies and leading global to + regional weather alert providers. The service can return details such as alert type, category, + level and detailed description about the active severe alerts for the requested location, like + hurricanes, thunderstorms, lightning, heat waves or forest fires. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param details: Return full details for the severe weather alerts. Available values are + + + * ``true`` - Returns full details. By default all details are returned. + * ``false`` - Returns a truncated version of the alerts data, which excludes the area-specific + full description of alert details (\ ``alertDetails``\ ). + :type details: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SevereWeatherAlertsResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.SevereWeatherAlertsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SevereWeatherAlertsResponse"] + 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_severe_weather_alerts.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if details is not None: + query_parameters['details'] = self._serialize.query("details", details, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('SevereWeatherAlertsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_severe_weather_alerts.metadata = {'url': '/weather/severe/alerts/{format}'} # type: ignore + + def get_daily_indices( + self, + coordinates, # type: List[float] + format="json", # type: Union[str, "_models.JsonFormat"] + language=None, # type: Optional[str] + duration=None, # type: Optional[int] + index_id=None, # type: Optional[int] + index_group_id=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.DailyIndicesResponse" + """**Get Daily Indices** + + **Applies to**\ : S0 and S1 pricing tiers. + + There may be times when you want to know if the weather conditions are optimal for a specific + activity, for example, for outdoor construction, indoor activities, running or farming + including soil moisture information. Azure Maps Indices API returns index values that will + guide end users to plan future activities. For example, a health mobile application can notify + users that today is good weather for running or for other outdoors activities like for playing + golf, and retail stores can optimize their digital marketing campaigns based on predicted index + values. The service returns in daily indices values for current and next 5, 10 and 15 days + starting from current day. + + :param coordinates: The applicable query specified as a comma separated string composed by + latitude followed by longitude e.g. "47.641268,-122.125679". + :type coordinates: list[float] + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.JsonFormat + :param language: Language in which search results should be returned. Should be one of + supported IETF language tags, case insensitive. When data in specified language is not + available for a specific field, default language is used. + + Please refer to `Supported Languages + `_ for details. + :type language: str + :param duration: Specifies for how many days the daily indices are returned. By default, the + indices data for the current day will be returned. When requesting future indices data, the + current day is included in the response as day 1. Available values are + + + * ``1`` - Return daily index data for the current day. Default value. + * ``5`` - Return 5 days of daily index data starting from the current day. + * ``10`` - Return 10 days of daily index data starting from the current day. + * ``15`` - Return 15 days of daily index data starting from the current day. + :type duration: int + :param index_id: Numeric index identifier that can be used for restricting returned results to + the corresponding index type. Cannot be paired with ``indexGroupId``. Please refer to `Weather + Service Concepts `_ for details and to see the + supported indices. + :type index_id: int + :param index_group_id: Numeric index group identifier that can be used for restricting returned + results to the corresponding subset of indices (index group). Cannot be paired with + ``indexId``. Please refer to `Weather Service Concepts + `_ for details and to see the supported index groups. + :type index_group_id: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DailyIndicesResponse, or the result of cls(response) + :rtype: ~azure.maps.weather.models.DailyIndicesResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DailyIndicesResponse"] + 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_daily_indices.metadata['url'] # type: ignore + path_format_arguments = { + '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("coordinates", coordinates, '[float]', div=',') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if duration is not None: + query_parameters['duration'] = self._serialize.query("duration", duration, 'int') + if index_id is not None: + query_parameters['indexId'] = self._serialize.query("index_id", index_id, 'int') + if index_group_id is not None: + query_parameters['indexGroupId'] = self._serialize.query("index_group_id", index_group_id, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.client_id", self._config.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('DailyIndicesResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_daily_indices.metadata = {'url': '/weather/indices/daily/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-weather/azure/maps/weather/py.typed b/sdk/maps/azure-maps-weather/azure/maps/weather/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-weather/sdk_packaging.toml b/sdk/maps/azure-maps-weather/sdk_packaging.toml new file mode 100644 index 000000000000..6da98be60717 --- /dev/null +++ b/sdk/maps/azure-maps-weather/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-weather" +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-weather/setup.cfg b/sdk/maps/azure-maps-weather/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-weather/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-weather/setup.py b/sdk/maps/azure-maps-weather/setup.py new file mode 100644 index 000000000000..11e39506e882 --- /dev/null +++ b/sdk/maps/azure-maps-weather/setup.py @@ -0,0 +1,90 @@ +#!/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-weather" +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.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'], + } +)