From af88d46217a68327967dd3e4cb44432274f5a345 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 20 Jul 2021 16:05:08 +0000 Subject: [PATCH] CodeGen from PR 14871 in Azure/azure-rest-api-specs [Maps] Add separate Swagger definitions for Maps client libraries (#14871) * Make maps data-plane swagger files compile when taken from api to sdk. * Update correctly the search api * Update common.js and add swagger codegen to maps dataplane. * Fix path issue * fix prettifier error. * Replace mistyped extension. * Fix common type version. * Fix errors for alias.json * run prettier * fix security def and parameters. * Revert "fix security def and parameters." This reverts commit 85370d9b6b3ad0ae615d1931aa7a5eec39957b30. * Revert "run prettier" This reverts commit be16d4423be319cc4b7a957abe977aced26e0fa5. * Revert "Fix errors for alias.json" This reverts commit 0458cbc9489ba8cc05a575517b35001fa4c4a7e8. * fix extension issue * comment out all other errors. * revert changes to package.json files * update files. remove common response as it isn't supported. * update readonly problem * Update error correctly to not be a breaking change * Remove unused definition. * Fix GeoJSONGeometryCollection * Fix naming scheme * fix coord abb * fix geometryCollection error by using a more generic type for inheritance. * update anon def * try without schema * fix naming issue. * add schema * try again * update common file * update route.json file * Revert "update route.json file" This reverts commit 2858248ea19ece1998617afbb83c1b6633487834. * Update geometry collection. * fix go modeler error * remove type * - fix ModelValidation * - enable Java and Python generation * try with new errorDetail. * correct paths * revert changes to odataerror. update python sdk. * fix typo * update error and readonly CoordinateAbbreviated to reuse more. * - try to build Python SDK * - try to forcefully build Python SDK * Add top level java. * update warnings from lint diff * try java generation with the inline file. * update Java compilation with right tags. * Fix compilation warnings * Update readme namespace names * Make enums be modelAsString: true * Add x-ms-error-response to error responses * Remove feedback.json and feedback reference from readme.md. * Fix "security" requirement object to have valid scope for OAuth2 security scheme type * Fix "security" requirement object to have valid scope for OAuth2 security scheme type - add missing file * Use common client parameters - part 1 * Use common client parameters - part 2 * Fix lint errors * update go namespace to the correct one. * Use common response objects to fix duplicate schemas * Fix semantic & model validation W/A for OAV as it is not able to parse Swagger file without "responses" object. * Fix autorest duplicate schema warnings Use common schema for Language, View, xTileIndex & yTileIndex between Render 1.0, Render 2.0, Search 1.0 and Traffic 1.0. * Fix C# generation of StyleRuleBaseType enum type * Fix license header for GO lang * Fix inheritance of the StyleRuleBase type in the FeatureState API * Revert resource-manager changes. * Remove current version. * Update java namespace. * Fix StyleRuleBase type inherited types generation * Fix prettier error * Use common GeoJson naming & fix inheritance * Update 200 response to be 200Async instead of error response. Also update the examples for the given routes. * Fix StyleRuleBase type inherited types generation * Fix 'avoid' parameter in Route service to be actually an array of things to avoid * Rename definitions to have at least two words (fix AZC0012 error) and add missing x-ms-enums. * Fix prettier * Fix GeoJSON type hierarchy and WFS examples * Fix long running operation definitions and examples * Add missing descriptions * Define batch responses in more detail & remove redundant definitions in Search API * Alias - remove unused definitions and empty 204 response * Data - remove unused definitions, empty 204 responses and file upload parameters * Dataset - remove unused definitions and empty 204 response * Fix description and linter validation * Elevation - remove unused definitions, merge some of them to get less models * Conversion, Feature State & Geolocation - remove unused definitions and empty 204 response * Use previous package-1.0-preview until new package-preview-2.0 is fixed. * Fix merge conflicts after rebase and security LintDiff * Fix Alias, Data, Dataset, Conversion, Feature State, Tileset & WFS 2.0 services * Fix linter warnings - Use common definition for ontology * Fix linter errors - LongRunningResponseStatusCode * Fix ApiDocPreview * Use different tag format to not relate with API version used * Use dummy trick to make ApiDocPreview and Avocado work * Another approach for ApiDocPreview * Seems like it is impossible to make ApiDocPreview work until someone takes a look at "REST API CI Script Reporter" in the "OpenAPIPortal-REST-Generator" pipeline and fix it to use referenced Swagger files. * update featureid to local parameter in wfs to see if it fixes error. * Remove dataset from wfs as it is not needed to fix doc preview. * Remove part that should be auto generated. * Fix error with java codegen. * Try to only export new versions of api. * Readd removed api's. Try with wfs v1 to see if api-preview passes. * remove wfs2 * Re-add wfs * update the readme.go to see if it generates install instructions. * add after scripts to bundle install * Remove defaults from route to test if it fixes go sdk problems. * Remove "x-publish" just for api doc preview test * fix JSON typo after removal * Experiment: do not use common responses for WFS 2.0 * Remove required false as it is the default value for query parameters. Remove default value for non required values. * run prettier. * Add onbe error-response individually to see if it fixes alias error. * Revert experimental WFS changes * Remove unused error. * Remove duplicated common file for 2.0 * Use ResponseFormat as a name for JsonFormat as one of the values is Json * Mobility & Render - fix response types, remove unnecessary definitions * Revert renaming TransitRouteType * revert data.json to consume the correct type * Only put at consumes application/json * Update consumes for data. * Render - rename operations to have common names with examples * update python codegen to use track2 correctly * Also change track2 from readme.md * Add track2 and track1 * Don't generate the sdk for arm. * Remove python track1 and add net track2. * Search - reduce number of responses for common cases * Elevation - fix input param for GetDataForPolyLine * Spatial - remove duplicated & unused definitions * Data - fix model validation * Tileset - remove 204 body Add x-ms-pageable to where it suits * Timezone & Traffic - fix "produces" fields and Traffic file responses * Add azure-sdk-for-net-track2 references to the -pr repo * Use azure-sdk-for-net without track2 since it's not enabled in the CI yet. * Weather - remove unused definitions * WFS 1.0 - remove unused definition and standardize naming * WFS 2.0 - remove unused definition and standardize naming * Put TextFormat & GeographicResourceLocation to a common file * Fix double to integer so that calls work. * Skip url encoding for elevation input parameters. * Put url ecoding to correct spot. * update geoemtries to be comma separated array. * Change search parameter order so that textFormat is always first. * Change parameter to udid from udId to be consistent * update wfs limit from float to int * update from string to datetime * Refix elevation. * Fix elevation prettier. * correctly update parameter to udid. * Add geography to all services. * update date-time * Add description to data * Add client flatten * Run prettier * Add geometry to examples. * Update missing routes. * Route - fix added endpoints for missing API * Use autorest v3 for TypeScript code gen * Add arm to python sdk in order to have aad auth. * Run prettier on route. * update get routes fixes. * put correct name for example. * update format * Add missing responses * Add same security for all. * fix copyright and countryCode warnings * remove arm. * fix extra comma * Add long running * Remove unused stuff from readme.md * Run prettifier * see if x-publish fixes linter error. * Replace description. * disable long running operation for put state update * Add schema of type string. * Replace description * Remove schema. * Remove after install to see if go package still fails. * Change credential type to bearer. and remove each sub key param. * - remove XML since our client libs are using JSON only and TS codegen cannot parse responses properly * - fix DWG conversion 200 response to not be an error but actual result with operationId in the body - use 6.0.0-alpha.20210514.1 TS codegen as latest beta has broken LRO support for JS core v1 (cannot use core v2 due to missing API key credential) * Fix Data & Dataset conversion 200 response to not be an error but actual result with operationId in the body * Fix OAuth description for Lint diff & fix prettier * Another try for the LintDiff CI * Yet another try for the LintDiff CI * Remove security from common * fix description message. * Remove preview 1 since preview 2 is added. * remove unused preview 1 files. * Change api version from common to each service. * Add default error. * Update version and route and search with batch. Remove subscription key from examples. * fixes. * Re-add 408. * fixes to errors. * update types. * Update description for batch. * remove unused errors from examples. * fix ci after changes. * fix again errors in examples. * remove package-preview-1.0 from go. * Remove go codegen as track1 isn't supported for data-plane. * Leave go readme. Remove js from ci for now. * remove 200 from dataset. * Put 200 response back to the Maps LROs. Although those paths do not return 200 directly (202 instead) the TS codegen takes 200 definition for the response type, so it is needed to deserialize. * Try to use .NET Track 2 * Workaround TS autogen limitation - loses inherited class properties due to invalid deserialization of base class properties only * Fix 200 to be 400 error(fix duplicate) * change versioning. * commit unsaved files. * fix wrong version. * fix breaking change. * Fix LintDiff errors and azure-sdk-for-net build * fix cSpell * Fix common descriptions for other Swaggers after e0624d2b17a8dcee07acfb08f39508a773a8dc21 * Use the new Azure AD description * Add back API key description * update consumes in data * fix typo. * update creator. * update references * update spatial version to 2. * fix data upload. * move spatial back to 1.0 for now and update batch to have 200 in case of success. * Remove mobility as its deprecated. * move spatial samples. * Update config md files & fix minor versioning issues * Remove unnecessary "produces" and "202Batch" * Use autorest's predefined AADToken & AzureKey * Generate public clients for C# * Prettier fix * change go namespaces * golang track2 config updates * Use latest TypeScript generator with core v2 * Fix Swagger ModelValidation Co-authored-by: Dragos Daian Co-authored-by: ambientlight --- sdk/maps/azure-maps-creator/CHANGELOG.md | 5 + sdk/maps/azure-maps-creator/MANIFEST.in | 6 + sdk/maps/azure-maps-creator/README.md | 27 + sdk/maps/azure-maps-creator/_meta.json | 11 + sdk/maps/azure-maps-creator/azure/__init__.py | 1 + .../azure-maps-creator/azure/maps/__init__.py | 1 + .../azure/maps/creator/__init__.py | 19 + .../azure/maps/creator/_configuration.py | 73 + .../azure/maps/creator/_creator_client.py | 124 + .../azure/maps/creator/_metadata.json | 110 + .../azure/maps/creator/_version.py | 9 + .../azure/maps/creator/aio/__init__.py | 10 + .../azure/maps/creator/aio/_configuration.py | 69 + .../azure/maps/creator/aio/_creator_client.py | 117 + .../maps/creator/aio/operations/__init__.py | 27 + .../aio/operations/_alias_operations.py | 504 ++ .../aio/operations/_conversion_operations.py | 572 ++ .../aio/operations/_data_operations.py | 834 +++ .../aio/operations/_dataset_operations.py | 627 ++ .../operations/_feature_state_operations.py | 620 ++ .../aio/operations/_spatial_operations.py | 944 +++ .../aio/operations/_tileset_operations.py | 501 ++ .../creator/aio/operations/_wfs_operations.py | 672 +++ .../azure/maps/creator/models/__init__.py | 259 + .../creator/models/_creator_client_enums.py | 133 + .../azure/maps/creator/models/_models.py | 2601 ++++++++ .../azure/maps/creator/models/_models_py3.py | 2753 +++++++++ .../azure/maps/creator/operations/__init__.py | 27 + .../creator/operations/_alias_operations.py | 513 ++ .../operations/_conversion_operations.py | 582 ++ .../creator/operations/_data_operations.py | 846 +++ .../creator/operations/_dataset_operations.py | 637 ++ .../operations/_feature_state_operations.py | 632 ++ .../creator/operations/_spatial_operations.py | 957 +++ .../creator/operations/_tileset_operations.py | 511 ++ .../creator/operations/_wfs_operations.py | 684 +++ .../azure/maps/creator/py.typed | 1 + .../azure-maps-creator/sdk_packaging.toml | 9 + sdk/maps/azure-maps-creator/setup.cfg | 2 + sdk/maps/azure-maps-creator/setup.py | 91 + sdk/maps/azure-maps-elevation/CHANGELOG.md | 5 + 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 | 74 + .../azure/maps/elevation/_elevation_client.py | 88 + .../azure/maps/elevation/_metadata.json | 103 + .../azure/maps/elevation/_version.py | 9 + .../azure/maps/elevation/aio/__init__.py | 10 + .../maps/elevation/aio/_configuration.py | 70 + .../maps/elevation/aio/_elevation_client.py | 81 + .../maps/elevation/aio/operations/__init__.py | 13 + .../aio/operations/_elevation_operations.py | 459 ++ .../azure/maps/elevation/models/__init__.py | 49 + .../models/_elevation_client_enums.py | 48 + .../azure/maps/elevation/models/_models.py | 257 + .../maps/elevation/models/_models_py3.py | 269 + .../maps/elevation/operations/__init__.py | 13 + .../operations/_elevation_operations.py | 468 ++ .../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 | 91 + sdk/maps/azure-maps-geolocation/CHANGELOG.md | 5 + 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 | 74 + .../maps/geolocation/_geolocation_client.py | 88 + .../azure/maps/geolocation/_metadata.json | 103 + .../azure/maps/geolocation/_version.py | 9 + .../azure/maps/geolocation/aio/__init__.py | 10 + .../maps/geolocation/aio/_configuration.py | 70 + .../geolocation/aio/_geolocation_client.py | 81 + .../geolocation/aio/operations/__init__.py | 13 + .../aio/operations/_geolocation_operations.py | 108 + .../azure/maps/geolocation/models/__init__.py | 37 + .../models/_geolocation_client_enums.py | 48 + .../azure/maps/geolocation/models/_models.py | 162 + .../maps/geolocation/models/_models_py3.py | 166 + .../maps/geolocation/operations/__init__.py | 13 + .../operations/_geolocation_operations.py | 113 + .../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 | 91 + sdk/maps/azure-maps-render/CHANGELOG.md | 5 + 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 | 73 + .../azure/maps/render/_metadata.json | 104 + .../azure/maps/render/_render_client.py | 93 + .../azure/maps/render/_version.py | 9 + .../azure/maps/render/aio/__init__.py | 10 + .../azure/maps/render/aio/_configuration.py | 69 + .../azure/maps/render/aio/_render_client.py | 86 + .../maps/render/aio/operations/__init__.py | 15 + .../aio/operations/_render_operations.py | 1258 ++++ .../aio/operations/_render_v2_operations.py | 185 + .../azure/maps/render/models/__init__.py | 71 + .../azure/maps/render/models/_models.py | 299 + .../azure/maps/render/models/_models_py3.py | 303 + .../render/models/_render_client_enums.py | 211 + .../azure/maps/render/operations/__init__.py | 15 + .../render/operations/_render_operations.py | 1270 ++++ .../operations/_render_v2_operations.py | 190 + .../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 | 91 + sdk/maps/azure-maps-route/CHANGELOG.md | 5 + 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 | 74 + .../azure/maps/route/_metadata.json | 103 + .../azure/maps/route/_route_client.py | 89 + .../azure/maps/route/_version.py | 9 + .../azure/maps/route/aio/__init__.py | 10 + .../azure/maps/route/aio/_configuration.py | 70 + .../azure/maps/route/aio/_route_client.py | 82 + .../maps/route/aio/operations/__init__.py | 13 + .../route/aio/operations/_route_operations.py | 3354 +++++++++++ .../azure/maps/route/models/__init__.py | 222 + .../azure/maps/route/models/_models.py | 2003 +++++++ .../azure/maps/route/models/_models_py3.py | 2083 +++++++ .../maps/route/models/_route_client_enums.py | 383 ++ .../azure/maps/route/operations/__init__.py | 13 + .../route/operations/_route_operations.py | 3371 +++++++++++ .../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 | 91 + sdk/maps/azure-maps-search/CHANGELOG.md | 5 + 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 | 74 + .../azure/maps/search/_metadata.json | 103 + .../azure/maps/search/_search_client.py | 89 + .../azure/maps/search/_version.py | 9 + .../azure/maps/search/aio/__init__.py | 10 + .../azure/maps/search/aio/_configuration.py | 70 + .../azure/maps/search/aio/_search_client.py | 82 + .../maps/search/aio/operations/__init__.py | 13 + .../aio/operations/_search_operations.py | 5205 ++++++++++++++++ .../azure/maps/search/models/__init__.py | 237 + .../azure/maps/search/models/_models.py | 2268 +++++++ .../azure/maps/search/models/_models_py3.py | 2358 ++++++++ .../search/models/_search_client_enums.py | 175 + .../azure/maps/search/operations/__init__.py | 13 + .../search/operations/_search_operations.py | 5236 +++++++++++++++++ .../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 | 91 + sdk/maps/azure-maps-timezone/CHANGELOG.md | 5 + 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 | 74 + .../azure/maps/timezone/_metadata.json | 103 + .../azure/maps/timezone/_timezone_client.py | 88 + .../azure/maps/timezone/_version.py | 9 + .../azure/maps/timezone/aio/__init__.py | 10 + .../azure/maps/timezone/aio/_configuration.py | 70 + .../maps/timezone/aio/_timezone_client.py | 81 + .../maps/timezone/aio/operations/__init__.py | 13 + .../aio/operations/_timezone_operations.py | 500 ++ .../azure/maps/timezone/models/__init__.py | 72 + .../azure/maps/timezone/models/_models.py | 650 ++ .../azure/maps/timezone/models/_models_py3.py | 660 +++ .../timezone/models/_timezone_client_enums.py | 60 + .../maps/timezone/operations/__init__.py | 13 + .../operations/_timezone_operations.py | 510 ++ .../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 | 91 + sdk/maps/azure-maps-traffic/CHANGELOG.md | 5 + 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 | 74 + .../azure/maps/traffic/_metadata.json | 103 + .../azure/maps/traffic/_traffic_client.py | 88 + .../azure/maps/traffic/_version.py | 9 + .../azure/maps/traffic/aio/__init__.py | 10 + .../azure/maps/traffic/aio/_configuration.py | 70 + .../azure/maps/traffic/aio/_traffic_client.py | 81 + .../maps/traffic/aio/operations/__init__.py | 13 + .../aio/operations/_traffic_operations.py | 589 ++ .../azure/maps/traffic/models/__init__.py | 86 + .../azure/maps/traffic/models/_models.py | 599 ++ .../azure/maps/traffic/models/_models_py3.py | 608 ++ .../traffic/models/_traffic_client_enums.py | 122 + .../azure/maps/traffic/operations/__init__.py | 13 + .../traffic/operations/_traffic_operations.py | 598 ++ .../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 | 91 + sdk/maps/azure-maps-weather/CHANGELOG.md | 5 + 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 | 74 + .../azure/maps/weather/_metadata.json | 103 + .../azure/maps/weather/_version.py | 9 + .../azure/maps/weather/_weather_client.py | 88 + .../azure/maps/weather/aio/__init__.py | 10 + .../azure/maps/weather/aio/_configuration.py | 70 + .../azure/maps/weather/aio/_weather_client.py | 81 + .../maps/weather/aio/operations/__init__.py | 13 + .../aio/operations/_weather_operations.py | 869 +++ .../azure/maps/weather/models/__init__.py | 169 + .../azure/maps/weather/models/_models.py | 1941 ++++++ .../azure/maps/weather/models/_models_py3.py | 2239 +++++++ .../weather/models/_weather_client_enums.py | 91 + .../azure/maps/weather/operations/__init__.py | 13 + .../weather/operations/_weather_operations.py | 881 +++ .../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 | 91 + 250 files changed, 66320 insertions(+) create mode 100644 sdk/maps/azure-maps-creator/CHANGELOG.md create mode 100644 sdk/maps/azure-maps-creator/MANIFEST.in create mode 100644 sdk/maps/azure-maps-creator/README.md create mode 100644 sdk/maps/azure-maps-creator/_meta.json create mode 100644 sdk/maps/azure-maps-creator/azure/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/_version.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py create mode 100644 sdk/maps/azure-maps-creator/azure/maps/creator/py.typed create mode 100644 sdk/maps/azure-maps-creator/sdk_packaging.toml create mode 100644 sdk/maps/azure-maps-creator/setup.cfg create mode 100644 sdk/maps/azure-maps-creator/setup.py create mode 100644 sdk/maps/azure-maps-elevation/CHANGELOG.md 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/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/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_operations.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_operations.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/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/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/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/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/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/MANIFEST.in b/sdk/maps/azure-maps-creator/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /dev/null +++ b/sdk/maps/azure-maps-creator/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/maps/__init__.py + diff --git a/sdk/maps/azure-maps-creator/README.md b/sdk/maps/azure-maps-creator/README.md new file mode 100644 index 000000000000..b630555efe6d --- /dev/null +++ b/sdk/maps/azure-maps-creator/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-creator%2FREADME.png) diff --git a/sdk/maps/azure-maps-creator/_meta.json b/sdk/maps/azure-maps-creator/_meta.json new file mode 100644 index 000000000000..bd05094bcf90 --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/maps/data-plane/Creator/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/maps/data-plane/Creator/readme.md" +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-creator/azure/__init__.py b/sdk/maps/azure-maps-creator/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-creator/azure/maps/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py new file mode 100644 index 000000000000..a498de7096c7 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._creator_client import CreatorClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['CreatorClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py b/sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py new file mode 100644 index 000000000000..e4d1f60285cb --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional, Union + + from azure.core.credentials import TokenCredential + + +class CreatorClientConfiguration(Configuration): + """Configuration for CreatorClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(CreatorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-creator/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py b/sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py new file mode 100644 index 000000000000..bd7ffa7a9dd3 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_creator_client.py @@ -0,0 +1,124 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional, Union + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import CreatorClientConfiguration +from .operations import AliasOperations +from .operations import DataOperations +from .operations import DatasetOperations +from .operations import ConversionOperations +from .operations import FeatureStateOperations +from .operations import SpatialOperations +from .operations import TilesetOperations +from .operations import WFSOperations +from . import models + + +class CreatorClient(object): + """APIs for managing aliases in Azure Maps. + + :ivar alias: AliasOperations operations + :vartype alias: azure.maps.creator.operations.AliasOperations + :ivar data: DataOperations operations + :vartype data: azure.maps.creator.operations.DataOperations + :ivar dataset: DatasetOperations operations + :vartype dataset: azure.maps.creator.operations.DatasetOperations + :ivar conversion: ConversionOperations operations + :vartype conversion: azure.maps.creator.operations.ConversionOperations + :ivar feature_state: FeatureStateOperations operations + :vartype feature_state: azure.maps.creator.operations.FeatureStateOperations + :ivar spatial: SpatialOperations operations + :vartype spatial: azure.maps.creator.operations.SpatialOperations + :ivar tileset: TilesetOperations operations + :vartype tileset: azure.maps.creator.operations.TilesetOperations + :ivar wfs: WFSOperations operations + :vartype wfs: azure.maps.creator.operations.WFSOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = CreatorClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.alias = AliasOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data = DataOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dataset = DatasetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.conversion = ConversionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.feature_state = FeatureStateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.spatial = SpatialOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tileset = TilesetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.wfs = WFSOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> CreatorClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json b/sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json new file mode 100644 index 000000000000..6a47d2ea8ca9 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_metadata.json @@ -0,0 +1,110 @@ +{ + "chosen_version": "", + "total_api_version_list": ["1.0", "2.0"], + "client": { + "name": "CreatorClient", + "filename": "_creator_client", + "description": "APIs for managing aliases in Azure Maps.", + "base_url": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"PipelineClient\"]}, \"local\": {\"._configuration\": [\"CreatorClientConfiguration\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.core\": [\"AsyncPipelineClient\"]}, \"local\": {\"._configuration\": [\"CreatorClientConfiguration\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.creator.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.creator.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "alias": "AliasOperations", + "data": "DataOperations", + "dataset": "DatasetOperations", + "conversion": "ConversionOperations", + "feature_state": "FeatureStateOperations", + "spatial": "SpatialOperations", + "tileset": "TilesetOperations", + "wfs": "WFSOperations" + } +} \ No newline at end of file diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/_version.py b/sdk/maps/azure-maps-creator/azure/maps/creator/_version.py new file mode 100644 index 000000000000..c92f6c4472cf --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "2.0-preview" diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py new file mode 100644 index 000000000000..fb2feed1a1e3 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._creator_client import CreatorClient +__all__ = ['CreatorClient'] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py new file mode 100644 index 000000000000..79e22643ea3b --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_configuration.py @@ -0,0 +1,69 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING, Union + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class CreatorClientConfiguration(Configuration): + """Configuration for CreatorClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(CreatorClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-creator/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py new file mode 100644 index 000000000000..5de869a7d449 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/_creator_client.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING, Union + +from azure.core import AsyncPipelineClient +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import CreatorClientConfiguration +from .operations import AliasOperations +from .operations import DataOperations +from .operations import DatasetOperations +from .operations import ConversionOperations +from .operations import FeatureStateOperations +from .operations import SpatialOperations +from .operations import TilesetOperations +from .operations import WFSOperations +from .. import models + + +class CreatorClient(object): + """APIs for managing aliases in Azure Maps. + + :ivar alias: AliasOperations operations + :vartype alias: azure.maps.creator.aio.operations.AliasOperations + :ivar data: DataOperations operations + :vartype data: azure.maps.creator.aio.operations.DataOperations + :ivar dataset: DatasetOperations operations + :vartype dataset: azure.maps.creator.aio.operations.DatasetOperations + :ivar conversion: ConversionOperations operations + :vartype conversion: azure.maps.creator.aio.operations.ConversionOperations + :ivar feature_state: FeatureStateOperations operations + :vartype feature_state: azure.maps.creator.aio.operations.FeatureStateOperations + :ivar spatial: SpatialOperations operations + :vartype spatial: azure.maps.creator.aio.operations.SpatialOperations + :ivar tileset: TilesetOperations operations + :vartype tileset: azure.maps.creator.aio.operations.TilesetOperations + :ivar wfs: WFSOperations operations + :vartype wfs: azure.maps.creator.aio.operations.WFSOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.creator.models.Geography + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = CreatorClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.alias = AliasOperations( + self._client, self._config, self._serialize, self._deserialize) + self.data = DataOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dataset = DatasetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.conversion = ConversionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.feature_state = FeatureStateOperations( + self._client, self._config, self._serialize, self._deserialize) + self.spatial = SpatialOperations( + self._client, self._config, self._serialize, self._deserialize) + self.tileset = TilesetOperations( + self._client, self._config, self._serialize, self._deserialize) + self.wfs = WFSOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "CreatorClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py new file mode 100644 index 000000000000..caac2ed53e58 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._alias_operations import AliasOperations +from ._data_operations import DataOperations +from ._dataset_operations import DatasetOperations +from ._conversion_operations import ConversionOperations +from ._feature_state_operations import FeatureStateOperations +from ._spatial_operations import SpatialOperations +from ._tileset_operations import TilesetOperations +from ._wfs_operations import WFSOperations + +__all__ = [ + 'AliasOperations', + 'DataOperations', + 'DatasetOperations', + 'ConversionOperations', + 'FeatureStateOperations', + 'SpatialOperations', + 'TilesetOperations', + 'WFSOperations', +] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py new file mode 100644 index 000000000000..14545ab5fb5b --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_alias_operations.py @@ -0,0 +1,504 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AliasOperations: + """AliasOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create( + self, + creator_data_item_id: Optional[str] = None, + **kwargs: Any + ) -> "_models.AliasesCreateResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create an alias. You can also assign the alias during the create + request. An alias can reference an ID generated by a creator service, but cannot reference + another alias ID. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your alias, you will use a ``POST`` request. If you would like to assign the alias + during the creation, you will pass the ``resourceId`` query parameter. + + Create Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Create API returns a HTTP ``201 Created`` response with the alias resource in the body. + + A sample response from creating an alias: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasesCreateResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasesCreateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasesCreateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if creator_data_item_id is not None: + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Access-Control-Expose-Headers']=self._deserialize('str', response.headers.get('Access-Control-Expose-Headers')) + deserialized = self._deserialize('AliasesCreateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/aliases'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AliasListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created aliases. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your aliases, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all aliases in ``json`` format. The response contains + the following details for each alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + yyyy-MM-ddTHH:mm:ss.sssZ + + + A sample response returning 2 alias resources: + + .. code-block:: json + + { + "aliases": [ + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }, + { + "createdTimestamp": "2020-02-18T19:53:33.123Z", + "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + "creatorDataItemId": null, + "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AliasListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.AliasListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AliasListResponse', pipeline_response) + list_of_elem = deserialized.aliases + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/aliases'} # type: ignore + + async def assign( + self, + alias_id: str, + creator_data_item_id: str, + **kwargs: Any + ) -> "_models.AliasListItem": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to assign an alias to reference a resource. + + Submit Assign Request + ^^^^^^^^^^^^^^^^^^^^^ + + To assign your alias to a resource, you will use a ``PUT`` request with the ``aliasId`` in the + path and the ``creatorDataItemId`` passed as a query parameter. + + Assign Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Assign API returns a HTTP ``200 OK`` response with the updated alias resource in the body, + if the alias was assigned successfully. A sample of the assign response is + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.assign.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + assign.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + async def delete( + self, + alias_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a previously created alias. You can also use this API to + delete old/unused aliases to create space for new content.This API does not delete the + references resource, only the alias referencing the resource. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your alias you will issue a ``DELETE`` request where the path will contain the + ``aliasId`` of the alias to delete. + + Delete Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Delete API returns a HTTP ``204 No Content`` response with an empty body, if the alias was + deleted successfully. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + async def get_details( + self, + alias_id: str, + **kwargs: Any + ) -> "_models.AliasListItem": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch the details of a previously created alias. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details of your alias, you will issue a ``GET`` request with the ``aliasId`` in the + path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the previously created alias in ``json`` format. The response + contains the following details for the alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. + + + Here's a sample response: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_details.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_details.metadata = {'url': '/aliases/{aliasId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py new file mode 100644 index 000000000000..3791a560e402 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_conversion_operations.py @@ -0,0 +1,572 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConversionOperations: + """ConversionOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _convert_initial( + self, + udid: str, + output_ontology: str, + description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._convert_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['outputOntology'] = self._serialize.query("output_ontology", output_ontology, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _convert_initial.metadata = {'url': '/conversions'} # type: ignore + + async def begin_convert( + self, + udid: str, + output_ontology: str, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Conversion API lets the caller import a set of DWG design files as a zipped `Drawing + Package `_ into Azure Maps. The `Drawing Package + `_ should first be uploaded using the `Azure Maps Data + Service `_. Once uploaded, use the ``udid`` + returned by the `Data Upload API + `_ to call this Conversion API. + + Convert DWG package + ------------------- + + The Conversion API performs a `long-running request `_. + + Debug DWG package issues + ------------------------ + + During the Conversion process, if there are any issues with the DWG package `errors and + warnings `_ are provided in the response along with a + *diagnostic package* to visualize and diagnose these issues. In case any issues are encountered + with your DWG package, the Conversion operation status process as detailed `here + `_ returns the location of the *diagnostic package* that can + be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + package* location can be found in the properties section of the conversion operation status + response and looks like the following: + + .. code-block:: json + + { + "properties": { + "diagnosticPackageLocation": + "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + } + } + + The *diagnostic package* can be downloaded by executing a ``HTTP GET`` request on the + ``diagnosticPackageLocation``. + For more details on how to use the tool to visualize and diagnose all the errors and warnings + see `Drawing Error Visualizer `_. :code:`
` + + A conversion operation will be marked as *success* if there are zero or more warnings but will + be marked as *failed* if any errors are encountered. + + :param udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: str + :param output_ontology: Output ontology version. "facility-2.0" is the only supported value at + this time. Please refer to this `article + `_ for more + information about Azure Maps Creator ontologies. + :type output_ontology: str + :param description: User provided description of the content being converted. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._convert_initial( + udid=udid, + output_ontology=output_ontology, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_convert.metadata = {'url': '/conversions'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ConversionListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all successful data conversions submitted + previously using the `Conversion API + `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all successful conversions you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Conversion List API returns the complete list of all conversion details in ``json`` + format.:code:`
` + + Here is a sample response returning the details of two successful conversion requests: + + :code:`
` + + .. code-block:: json + + { + "conversions": + [ + { + "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + "udid": "31838736-8b84-11ea-bc55-0242ac130003", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + }, + { + "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + } + ] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConversionListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.ConversionListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ConversionListResponse', pipeline_response) + list_of_elem = deserialized.conversions + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/conversions'} # type: ignore + + async def get( + self, + conversion_id: str, + **kwargs: Any + ) -> "_models.ConversionListDetailInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a successful data conversion submitted previously using the + `Conversion API `_. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConversionListDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConversionListDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConversionListDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + async def delete( + self, + conversion_id: str, + **kwargs: Any + ) -> None: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete any data conversions created previously using the + `Conversion API `_. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your conversion data you will issue a ``DELETE`` request where the path will contain + the ``conversionId`` of the data to delete. + + Conversion Delete Response + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Conversion Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + converted data resources were deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if no resource associated with the + passed-in ``conversionId`` is found. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + async def get_operation( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This path will be obtained from a call to POST /conversions. While in progress, an http200 + will be returned with no extra headers - followed by an http200 with Resource-Location header + once successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/conversions/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py new file mode 100644 index 000000000000..590d4a7b0628 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_data_operations.py @@ -0,0 +1,834 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataOperations: + """DataOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _upload_preview_initial( + self, + upload_data_format: Union[str, "_models.UploadDataFormat"], + upload_content: Union[IO, Any], + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/octet-stream") + accept = "application/json" + + # Construct URL + url = self._upload_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + query_parameters['dataFormat'] = self._serialize.query("upload_data_format", upload_data_format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/octet-stream']: + body_content_kwargs['stream_content'] = upload_content + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + body_content = self._serialize.body(upload_content, 'object') + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/octet-stream', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _upload_preview_initial.metadata = {'url': '/mapData'} # type: ignore + + async def begin_upload_preview( + self, + upload_data_format: Union[str, "_models.UploadDataFormat"], + upload_content: Union[IO, Any], + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + The Data Upload API allows the caller to upload data content to the Azure Maps service. + You can use this API in a scenario like uploading a collection of Geofences in ``GeoJSON`` + format, for use in our `Azure Maps Geofencing Service + `_. + + Submit Upload Request + --------------------- + + To upload your content you will use a ``POST`` request. The request body will contain the data + to upload. The + ``dataFormat`` query parameter will contain the format for the data, the ``dataSharingLevel`` + query parameter + can contain the sharing level for the data. The ``Content-Type`` header will be set to the + content type of the + data. + + For example, to upload a collection of geofences in ``GeoJSON`` format, set the request body + to the geofence + content. Set the ``dataFormat`` query parameter to *geojson*\ , and set the ``Content-Type`` + header to either one + of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for uploading a simple Geofence represented as a circle geometry + using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The Data Upload API performs a + `long-running request `_. + + Data Upload Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param upload_data_format: Data format of the content being uploaded. + :type upload_data_format: str or ~azure.maps.creator.models.UploadDataFormat + :param upload_content: The content to upload. + :type upload_content: IO or any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: str + :keyword str content_type: Media type of the body sent to the API. Default value is "application/octet-stream". + Allowed values are: "application/octet-stream", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._upload_preview_initial( + upload_data_format=upload_data_format, + upload_content=upload_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_upload_preview.metadata = {'url': '/mapData'} # type: ignore + + async def list_preview( + self, + **kwargs: Any + ) -> "_models.MapDataListResponse": + """**Applies to:** see pricing `tiers `_. + + This API allows the caller to fetch a list of all content uploaded previously using the `Data + Upload API `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your map data content you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Data List API returns the complete list of all data in ``json`` format. The response + contains the following details for each data resource: + + .. + + udid - The unique data id for the data resource. + + location - The location of the data resource. Execute a HTTP ``GET`` on this location to + download the data. + + + Here's a sample response returning the ``udid`` and ``location`` of 3 data resources: + + :code:`
` + + .. code-block:: json + + { + "mapDataList": + [ + { + "udid": "9a1288fa-1858-4a3b-b68d-13a8j5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/9a1288fa-1858-4a3b-b68d-13a8j5af7d7c?api-version=1.0", + "sizeInBytes": 29920, + "uploadStatus": "Completed" + }, + { + "udid": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/8b1288fa-1958-4a2b-b68e-13a7i5af7d7c?api-version=1.0", + "sizeInBytes": 1339, + "uploadStatus": "Completed" + }, + { + "udid": "7c1288fa-2058-4a1b-b68f-13a6h5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/7c1288fa-2058-4a1b-b68f-13a6h5af7d7c?api-version=1.0", + "sizeInBytes": 1650, + "uploadStatus": "Pending" + }] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapDataListResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.MapDataListResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapDataListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.list_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('MapDataListResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_preview.metadata = {'url': '/mapData'} # type: ignore + + async def _update_preview_initial( + self, + unique_data_id: str, + update_content: Any, + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(update_content, 'object') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_preview_initial.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def begin_update_preview( + self, + unique_data_id: str, + update_content: Any, + upload_data_description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + The Data Update API allows the caller to update a previously uploaded data content. + + You can use this API in a scenario like adding or removing geofences to or from an existing + collection of geofences. + Geofences are uploaded using the `Data Upload API + `_\ , for + use in the `Azure Maps Geofencing Service `_. + + Please note that the Update API will *replace* and *override* the existing data content. + + Submit Update Request + --------------------- + + To update your content you will use a ``PUT`` request. The request body will contain the new + data that will replace + the existing data. The ``Content-Type`` header will be set to the content type of the data, and + the path will contain + the ``udid`` of the data to be update. + + For example, to update a collection of geofences that were previously uploaded using the Upload + API, place the new + geofence content in the request body. Set the ``udid`` parameter in the path to the ``udid`` of + the data received + previously in the upload API response. And set the ``Content-Type`` header to one of the + following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for updating a simple Geofence. It's represented as a circle + geometry using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The previously uploaded geofence had a radius of 100m. The above request will update it to + 500m. + + The Data Update API performs a + `long-running request `_. + + Data Update Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :param update_content: The new content that will update/replace the previously uploaded + content. + :type update_content: any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_preview_initial( + unique_data_id=unique_data_id, + update_content=update_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def download_preview( + self, + unique_data_id: str, + **kwargs: Any + ) -> IO: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to download a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like downloading an existing collection of geofences + uploaded previously using the `Data Upload API + `_ for use in our + `Azure Maps Geofencing Service `_. + + Submit Download Request + ^^^^^^^^^^^^^^^^^^^^^^^ + + To download your content you will use a ``GET`` request where the path will contain the + ``udid`` of the data to download. Optionally, you can also pass in an ``Accept`` header to + specify a preference for the ``Content-Type`` of the data response. :code:`
` + For example, to download a collection of geofences previously uploaded using the Upload API, + set the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response and set the ``Accept`` header to either one of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Download Data Response + ^^^^^^^^^^^^^^^^^^^^^^ + + The Download API will return a HTTP ``200 OK`` response if the data resource with the passed-in + ``udid`` is found, where the response body will contain the content of the data + resource.:code:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found.:code:`
` + + Here's a sample response body for a simple geofence represented in ``GeoJSON`` uploaded + previously using the Upload API: + :code:`
` + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + }. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json, application/vnd.geo+json, application/octet-stream" + + # Construct URL + url = self.download_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + download_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def delete_preview( + self, + unique_data_id: str, + **kwargs: Any + ) -> None: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to delete a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like removing geofences previously uploaded using the `Data + Upload API `_ for use + in our `Azure Maps Geofencing Service + `_. You can also use this API to delete + old/unused uploaded content and create space for new content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``udid`` of the data to delete.:code:`
`\ :raw-html-m2r:`
` + For example, to delete a collection of geofences previously uploaded using the Upload API, set + the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response. + + Delete Data Response + ^^^^^^^^^^^^^^^^^^^^ + + The Data Delete API returns a HTTP ``204 No Content`` response with an empty body, if the data + resource was deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + async def get_operation_preview( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This path will be obtained from a call to POST /mapData. While in progress, an http200 will be + returned with no extra headers - followed by an http200 with Resource-Location header once + completed. + + :param operation_id: The ID to query the status for the data upload request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation_preview.metadata = {'url': '/mapData/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py new file mode 100644 index 000000000000..4911765318f1 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_dataset_operations.py @@ -0,0 +1,627 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DatasetOperations: + """DatasetOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_initial( + self, + conversion_id: str, + dataset_id: Optional[str] = None, + description_dataset: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['conversionId'] = self._serialize.query("conversion_id", conversion_id, 'str') + if dataset_id is not None: + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description_dataset is not None: + query_parameters['description'] = self._serialize.query("description_dataset", description_dataset, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/datasets'} # type: ignore + + async def begin_create( + self, + conversion_id: str, + dataset_id: Optional[str] = None, + description_dataset: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create a dataset from data that was uploaded to the Azure Maps + Data Service and converted using the Azure Maps Conversion Service. + + You can use this API in a scenario like uploading a DWG zip package for a building, converting + the zip package using the Azure Maps Conversion Service, and creating a dataset from the + converted zip package. The created dataset can be used to create tilesets using the Azure Maps + Tileset Service and can be queried via the Azure Maps WFS Service. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your dataset, you will use a ``POST`` request where the ``conversionId`` query + parameter is an ID that represents the converted DWG zip package, the ``datasetId`` parameter + will be the ID of a previously created dataset to append with the current dataset and, + optionally, the ``description`` query parameter will contain a description (if description is + not provided a default description will be given). + + The Create API is a `long-running request `_. + + :param conversion_id: The unique ID used to create the dataset. The ``conversionId`` must have + been obtained from a successful call to the Conversion Service Convert API and may be provided + with multiple query parameters with same name (if more than one is provided). + :type conversion_id: str + :param dataset_id: The ID for the dataset to append with. The dataset must originate from a + previous dataset creation call that matches the datasetId. + :type dataset_id: str + :param description_dataset: The description to be given to the dataset. + :type description_dataset: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + conversion_id=conversion_id, + dataset_id=dataset_id, + description_dataset=description_dataset, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/datasets'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DatasetListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created datasets. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your datasets, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all datasets in ``json`` format. The response + contains the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of 3 dataset resources: + + .. code-block:: json + + { + "datasets": [ + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }, + { + "timestamp": "2020-01-01T22:57:53.123Z", + "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + "datasetSources": { + "conversionIds": [ + "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + ], + "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatasetListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.DatasetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DatasetListResponse', pipeline_response) + list_of_elem = deserialized.datasets + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/datasets'} # type: ignore + + async def get( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.DatasetDetailInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a previously successfully created dataset. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details for a previously created dataset, you will issue a ``GET`` request with the + ``datasetId`` in the path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the details for a dataset in ``json`` format. The response contains + the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of a dataset resource: + + .. code-block:: json + + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.DatasetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DatasetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + async def delete( + self, + dataset_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + You can also use this API to delete old/unused datasets to create space for new Creator + content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``datasetId`` of the dataset to delete. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + async def get_operation( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This API allows the caller to view the current progress of a dataset operation and the path is + obtained from a call to the Create API. + + Submit Operations Request + ^^^^^^^^^^^^^^^^^^^^^^^^^ + + To view the current progress of a dataset operation, you will use a ``GET`` request where the + ``operationId`` given the path is the ID that represents the operation. + + Operation Response + ^^^^^^^^^^^^^^^^^^ + + While in progress, a ``200-OK`` http status code will be returned with no extra headers. If the + operation succeeds, a ``200-OK`` http status code with Resource-Location header will be + returned. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/datasets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py new file mode 100644 index 000000000000..386317ee7b71 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_feature_state_operations.py @@ -0,0 +1,620 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class FeatureStateOperations: + """FeatureStateOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_stateset( + self, + dataset_id: str, + stateset_create_request_body: "_models.StylesObject", + description: Optional[str] = None, + **kwargs: Any + ) -> "_models.StatesetCreatedResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This POST API allows the user to create a new Stateset and define stateset style using request + body. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. The Feature State API is part of Creator. + + The Feature State service allows the user to update the states of a feature and query them to + be used in other services. The dynamic properties of a feature that don't belong to the dataset + are referred to as *states* here. + + This Feature State service pivot on the Stateset. Like Tileset, Stateset encapsulates the + storage mechanism for feature states for a dataset. + + Once the stateset is created, users can use that statesetId to post feature state updates and + retrieve the current feature states. A feature can have only one state at a given point in + time. + + Feature state is defined by the key name, value and the timestamp. When a feature state update + is posted to Azure Maps, the state value gets updated only if the provided state’s timestamp is + later than the stored timestamp. + + Azure Maps MapControl provides a way to use these feature states to style the features. Please + refer to the State Tile documentation for more information. + + :param dataset_id: The datasetId must have been obtained from a successful `Dataset Create API + `_ call. + :type dataset_id: str + :param stateset_create_request_body: The stateset style JSON data. + :type stateset_create_request_body: ~azure.maps.creator.models.StylesObject + :param description: Description for the stateset. Max length allowed is 1000. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetCreatedResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetCreatedResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetCreatedResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(stateset_create_request_body, 'StylesObject') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetCreatedResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def list_stateset( + self, + **kwargs: Any + ) -> AsyncIterable["_models.StatesetListResponse"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created statesets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StatesetListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.StatesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StatesetListResponse', pipeline_response) + list_of_elem = deserialized.statesets + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + async def put_stateset( + self, + stateset_id: str, + stateset_style_update_request_body: "_models.StylesObject", + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the stateset style rules. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param stateset_style_update_request_body: The stateset style JSON data. Only style rules are + allowed to be updated, update on keyname and type is not allowed. + :type stateset_style_update_request_body: ~azure.maps.creator.models.StylesObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(stateset_style_update_request_body, 'StylesObject') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + put_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def delete_stateset( + self, + stateset_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This DELETE API allows the user to delete the stateset and the associated data. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def get_stateset( + self, + stateset_id: str, + **kwargs: Any + ) -> "_models.StatesetGetResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This GET API allows the user to get the stateset Information. + + The stateset Information includes the datasetId associated to the stateset, and the styles of + that stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetGetResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetGetResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetGetResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetGetResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + async def update_states( + self, + stateset_id: str, + feature_id: str, + feature_state_update_request_body: "_models.FeatureStatesStructure", + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the state of the given feature in the given stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given dataset. If the featureId is not present in + the dataset, Bad Request response will be returned. + :type feature_id: str + :param feature_state_update_request_body: The feature state JSON data. A feature can have only + one state at a given point in time. The specified state keyname must have been defined during + the stateset creation. + :type feature_state_update_request_body: ~azure.maps.creator.models.FeatureStatesStructure + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(feature_state_update_request_body, 'FeatureStatesStructure') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + update_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + async def delete_state( + self, + stateset_id: str, + feature_id: str, + state_key_name: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API deletes the state information identified by the StateKeyName parameter for the + feature identified by the FeatureId parameter in the the stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :param state_key_name: The Name of the state to be deleted. + :type state_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_state.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['stateKeyName'] = self._serialize.query("state_key_name", state_key_name, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_state.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + async def get_states( + self, + stateset_id: str, + feature_id: str, + **kwargs: Any + ) -> "_models.FeatureStatesStructure": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API returns the current state information associated with the given feature in the given + stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureStatesStructure, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureStatesStructure + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureStatesStructure"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureStatesStructure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py new file mode 100644 index 000000000000..28ca5600aecd --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_spatial_operations.py @@ -0,0 +1,944 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SpatialOperations: + """SpatialOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_geofence( + self, + format: Union[str, "_models.ResponseFormat"], + device_id: str, + udid: str, + latitude: float, + longitude: float, + z: Optional[float] = None, + user_time: Optional[datetime.datetime] = None, + search_buffer: Optional[float] = None, + is_async: Optional[bool] = None, + mode: Optional[Union[str, "_models.GeofenceMode"]] = None, + **kwargs: Any + ) -> "_models.GeofenceResponse": + """**Search Geofence Get API** + + **Applies to:** S1 Pricing tier. + + The Geofence Get API allows you to retrieve the proximity of a coordinate to a + geofence that has been uploaded to the Data service. You can use the + `Data Upload API `_ to + upload + a geofence or set of fences. See `Geofencing GeoJSON data + `_ + for more details on the geofence data format. To query the proximity of a coordinate, you + supply the location of the object you are tracking as well + as the ID for the fence or set of fences, and the response will contain information about + the distance from the outer edge of the geofence. A negative value signifies that the + coordinate is inside of the fence while a positive value means that it is outside of the + fence.:code:`
`:code:`
`This API can be used for a variety of scenarios that include + things like asset + tracking, fleet management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + To test this API, you can upload the sample data from Post Geofence API examples(Request Body) + via Data Upload API and replace the [udid] from the sample request below with the udid returned + by Data Upload API. + + Geofencing InnerError code + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + In geofencing response error contract, ``innererror`` is an object containing service specific + information about the error. ``code`` is a property in ``innererror`` which can map to a + specific geofencing error type. The table belows shows the code mapping between all the known + client error type to the corresponding geofencing error ``message``. + + .. list-table:: + :header-rows: 1 + + * - innererror.code + - error.message + * - NullDeviceId + - Device Id should not be null. + * - NullUdid + - Udid should not be null. + * - UdidWrongFormat + - Udid should be acquired from user data ingestion API. + * - InvalidUserTime + - Usertime is invalid. + * - InvalidSearchBuffer + - Searchbuffer is invalid. + * - InvalidSearchRange + - The value range of searchbuffer should be from 0 to 500 meters. + * - InvalidLatLon + - Lat and/or lon parameters are invalid. + * - InvalidIsAsyncValue + - The IsAsync parameter is invalid. + * - InvalidModeValue + - The mode parameter invalid. + * - InvalidJson + - Geofencing data is not a valid json file. + * - NotSupportedGeoJson + - Geofencing data can't be read as a Feature or FeatureCollections. + * - InvalidGeoJson + - Geofencing data is invalid. + * - NoUserDataWithAccountOrSubscription + - Can't find user geofencing data with provided account-id and/or subscription-id. + * - NoUserDataWithUdid + - Can't find user geofencing data with provided udid. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion is used. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.Now. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + async def post_geofence( + self, + format: Union[str, "_models.ResponseFormat"], + device_id: str, + latitude: float, + longitude: float, + search_geofence_request_body: "_models.GeoJsonFeatureCollection", + z: Optional[float] = None, + user_time: Optional[datetime.datetime] = None, + search_buffer: Optional[float] = None, + is_async: Optional[bool] = None, + mode: Optional[Union[str, "_models.GeofenceMode"]] = None, + **kwargs: Any + ) -> "_models.GeofenceResponse": + """**Search Geofence Post API** + **Applies to:** S1 Pricing tier. + The Geofence Post API allows you to retrieve the proximity of a coordinate to a provided + geofence or set of fences. With POST call, you do not have to upload the fence data in advance, + instead you supply the location of the object you are tracking in query parameters as well as + the fence or set of fences data in post request body. See `Geofencing GeoJSON data + `_ for more details on the + geofence data format. The response will contain information about the distance from the outer + edge of the geofence. A negative value signifies that the coordinate is inside of the fence + while a positive value means that it is outside of the fence.:code:`
`:code:`
`This API + can be used for a variety of scenarios that include things like asset tracking, fleet + management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param search_geofence_request_body: The geofencing GeoJSON data. + :type search_geofence_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion geofencing is applied. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.UtcNow. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_geofence_request_body, 'GeoJsonFeatureCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + post_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + async def post_buffer( + self, + format: Union[str, "_models.ResponseFormat"], + buffer_request_body: "_models.BufferRequestBody", + **kwargs: Any + ) -> "_models.BufferResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input may contain a collection of Point, MultiPoint, Polygon, + MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if provided. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param buffer_request_body: The FeatureCollection and the list of distances (one per feature or + one for all features). + :type buffer_request_body: ~azure.maps.creator.models.BufferRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(buffer_request_body, 'BufferRequestBody') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + async def get_buffer( + self, + format: Union[str, "_models.ResponseFormat"], + udid: str, + distances: str, + **kwargs: Any + ) -> "_models.BufferResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input features are provided by a GeoJSON file which is uploaded + via `Data Upload API `_ and + referenced by a unique udid. The GeoJSON file may contain a collection of Point, MultiPoint, + Polygon, MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if + provided. + + To test this API, you can upload the sample data from `Post Buffer API + `_ examples(Request + Body without distances array) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the udid + returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param distances: The list of distances (one per feature or one for all features), delimited by + semicolons. For example, 12.34;-56.78. Positive distance will generate a buffer outside of the + feature, whereas negative distance will generate a buffer inside of the feature. If the + negative distance larger than the geometry itself, an empty polygon will be returned. + :type distances: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['distances'] = self._serialize.query("distances", distances, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + async def post_closest_point( + self, + format: Union[str, "_models.ResponseFormat"], + latitude: float, + longitude: float, + closest_point_request_body: "_models.GeoJsonFeatureCollection", + number_of_closest_points: Optional[int] = None, + **kwargs: Any + ) -> "_models.ClosestPointResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of target points. The + set of target points is provided by user data in post request body. The user data may only + contain a collection of Point geometry. MultiPoint or other geometries will be ignored if + provided. The algorithm does not take into account routing or traffic. The maximum number of + points accepted is 100,000. Information returned includes closest point latitude, longitude, + and distance in meters from the closest point. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param closest_point_request_body: The FeatureCollection of Point geometries from which closest + point to source point should be determined. All the feature's properties should contain + ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + :type closest_point_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(closest_point_request_body, 'GeoJsonFeatureCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + async def get_closest_point( + self, + format: Union[str, "_models.ResponseFormat"], + udid: str, + latitude: float, + longitude: float, + number_of_closest_points: Optional[int] = None, + **kwargs: Any + ) -> "_models.ClosestPointResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of points in the user + uploaded data set identified by udid. The set of target points is provided by a GeoJSON file + which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may only contain a collection of Point geometry. MultiPoint or + other geometries will be ignored if provided. The maximum number of points accepted is 100,000. + The algorithm does not take into account routing or traffic. Information returned includes + closest point latitude, longitude, and distance in meters from the closest point. + + To test this API, you can upload the sample data from `Post Closest Point API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + async def post_point_in_polygon( + self, + format: Union[str, "_models.ResponseFormat"], + latitude: float, + longitude: float, + point_in_polygon_request_body: "_models.GeoJsonFeatureCollection", + **kwargs: Any + ) -> "_models.PointInPolygonResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + user data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if + provided. If the point is inside or on the boundary of one of these polygons, the value + returned is true. In all other cases, the value returned is false. When the point is inside + multiple polygons, the result will give intersecting geometries section to show all valid + geometries (referenced by geometryId) in user data. The maximum number of vertices accepted to + form a Polygon is 10,000. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param point_in_polygon_request_body: A FeatureCollection with a set of Polygon/MultiPolygon + geometries. The maximum number of vertices accepted to form a Polygon is 10,000. All the + feature's properties should contain ``geometryId``\ , which is used for identifying the + geometry and is case-sensitive. + :type point_in_polygon_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(point_in_polygon_request_body, 'GeoJsonFeatureCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + async def get_point_in_polygon( + self, + format: Union[str, "_models.ResponseFormat"], + udid: str, + latitude: float, + longitude: float, + **kwargs: Any + ) -> "_models.PointInPolygonResponse": + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + set of polygons is provided by a GeoJSON file which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries + will be ignored if provided. If the point is inside or on the boundary of one of these + polygons, the value returned is true. In all other cases, the value returned is false. When the + point is inside multiple polygons, the result will give intersecting geometries section to show + all valid geometries(referenced by geometryId) in user data. The maximum number of vertices + accepted to form a Polygon is 10,000. + + To test this API, you can upload the sample data from `Post Point In Polygon API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + async def get_great_circle_distance( + self, + format: Union[str, "_models.ResponseFormat"], + query: str, + **kwargs: Any + ) -> "_models.GreatCircleDistanceResponse": + """**Applies to**\ : S1 pricing tier. + + This API will return the great-circle or shortest distance between two points on the surface of + a sphere, measured along the surface of the sphere. This differs from calculating a straight + line through the sphere's interior. This method is helpful for estimating travel distances for + airplanes by calculating the shortest distance between airports. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param query: The Coordinates through which the distance is calculated, delimited by a colon. + Two coordinates are required. The first one is the source point coordinate and the last is the + target point coordinate. For example, 47.622942,122.316456:57.673988,127.121513. + :type query: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GreatCircleDistanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GreatCircleDistanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GreatCircleDistanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_great_circle_distance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GreatCircleDistanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_great_circle_distance.metadata = {'url': '/spatial/greatCircleDistance/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py new file mode 100644 index 000000000000..fee72365ff9d --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_tileset_operations.py @@ -0,0 +1,501 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class TilesetOperations: + """TilesetOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_initial( + self, + dataset_id: str, + description: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.LongRunningOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/tilesets'} # type: ignore + + async def begin_create( + self, + dataset_id: str, + description: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.LongRunningOperationResult"]: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. + + The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains + a set of tiles that can be consumed + from the `Get Map Tile `_ to retrieve custom tiles. To make a + dataset, use the + `DataSet Create API `_. + + Submit Create Request + --------------------- + + To create your tileset you will make a ``POST`` request with an empty body. The ``datasetId`` + query parameter will be + used as the source of the tileset data. + + The Create Tileset API is a + `long-running request `_. + + :param dataset_id: The unique ``datasetId`` that the tileset create API uses to retrieve + features to generate tiles. The ``datasetId`` must have been obtained from a successful + `Dataset Create API `_ call. + :type dataset_id: str + :param description: User provided description of the tileset. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncLROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + dataset_id=dataset_id, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = AsyncLROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/tilesets'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.TilesetListResponse"]: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all tilesets created.\ :raw-html-m2r:`
` + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TilesetListResponse or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.maps.creator.models.TilesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TilesetListResponse', pipeline_response) + list_of_elem = deserialized.tilesets + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/tilesets'} # type: ignore + + async def get( + self, + tileset_id: str, + **kwargs: Any + ) -> "_models.TilesetDetailInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a tileset. + + :param tileset_id: The Tileset Id. + :type tileset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TilesetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.TilesetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TilesetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + async def delete( + self, + tileset_id: str, + **kwargs: Any + ) -> None: + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a created tileset.:code:`
`\ :raw-html-m2r:`
` + You can use this API if a tileset is no longer needed. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``tilesetId`` of the tileset to delete.:code:`
` + + Delete request "Successful" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The Tileset Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + tileset was deleted successfully.:code:`
` + + Delete request "Failed" + ~~~~~~~~~~~~~~~~~~~~~~~ + + A HTTP ``400 Bad Request`` error response will be returned if the tileset with the passed-in + ``tilesetId`` is not found. + + Here is a sample error response: + + :code:`
` + + .. code-block:: json + + { + "error": { + "code": "400 BadRequest", + "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce does not + exist." + } + }. + + :param tileset_id: The Tileset Id. + :type tileset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + async def get_operation( + self, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """This path will be obtained from a call to /tilesets/create. While in progress, an http200 will + be returned with no extra headers - followed by an http200 with Resource-Location header once + successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/tilesets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py new file mode 100644 index 000000000000..6709ba7160eb --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/aio/operations/_wfs_operations.py @@ -0,0 +1,672 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WFSOperations: + """WFSOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_landing_page( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.LandingPageResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Landing Page API provides links to the API definition, the Conformance statements and + the metadata about the feature data in this dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LandingPageResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LandingPageResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LandingPageResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_landing_page.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LandingPageResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_landing_page.metadata = {'url': '/wfs/datasets/{datasetId}/'} # type: ignore + + async def get_conformance( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.ConformanceResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Requirements Classes lists all requirements classes specified in the standard that the + server conforms to. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConformanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConformanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConformanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_conformance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConformanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_conformance.metadata = {'url': '/wfs/datasets/{datasetId}/conformance'} # type: ignore + + async def get_collections( + self, + dataset_id: str, + **kwargs: Any + ) -> "_models.CollectionsResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Collections Description API provides descriptions of all the collections in a given + dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collections.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collections.metadata = {'url': '/wfs/datasets/{datasetId}/collections'} # type: ignore + + async def get_collection( + self, + dataset_id: str, + collection_id: str, + **kwargs: Any + ) -> "_models.CollectionInfo": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Description API provides the description of a given collection. It includes the + links to the operations that can be performed on the collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}'} # type: ignore + + async def get_collection_definition( + self, + dataset_id: str, + collection_id: str, + **kwargs: Any + ) -> "_models.CollectionDefinitionResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. WFS API follows the `Open + Geospatial Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Definition API provides the detailed data model of a given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionDefinitionResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionDefinitionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionDefinitionResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection_definition.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionDefinitionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection_definition.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/definition'} # type: ignore + + async def get_features( + self, + dataset_id: str, + collection_id: str, + limit: Optional[int] = None, + bbox: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> "_models.ExtendedGeoJsonFeatureCollection": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Features API returns the list of features in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param limit: The optional limit parameter limits the number of features that are presented in + the response document. + Only features that are on the first level of the collection in the response document are + counted. Nested objects contained within the explicitly requested features shall not be + counted. + + + * Minimum = 1 * Maximum = 50 * Default = 10. + :type limit: int + :param bbox: Only features that have a geometry that intersects the supplied bounding box are + selected. + + + * Lower left corner, coordinate axis 1 * Lower left corner, coordinate axis 2 * Upper right + corner, coordinate axis 1 * Upper right corner, coordinate axis 2 + The coordinate reference system of the values is WGS84 longitude/latitude + (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system + is specified in the parameter ``bbox-crs``. + For WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, + minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans + the antimeridian the first value (west-most box edge) is larger than the third value (east-most + box edge). + :type bbox: str + :param filter: Filter expression to search for features with specific property values in a + given collection. Only feature properties of scalar type and equals operator are supported. + This is a special parameter where the parameter name is a case sensitive property name. The + scheme for this parameter is {property name}={property value}. Unless "filter" is one of the + property names in the collection, "filter" should not be used as a parameter name. To search + for features with "name" property value "21N13", use "name=21N13". + Multiple filters are supported and should be represented as multiple query parameters. E.g., + :code:``=:code:``&:code:``=:code:`` String values are + case sensitive. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedGeoJsonFeatureCollection, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ExtendedGeoJsonFeatureCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedGeoJsonFeatureCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_features.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=50, minimum=1) + if bbox is not None: + query_parameters['bbox'] = self._serialize.query("bbox", bbox, 'str') + if filter is not None: + query_parameters['filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ExtendedGeoJsonFeatureCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_features.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items'} # type: ignore + + async def get_feature( + self, + dataset_id: str, + collection_id: str, + feature_id: str, + **kwargs: Any + ) -> "_models.FeatureResponse": + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Feature API returns the feature identified by the provided id in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore + + async def delete_feature( + self, + dataset_id: str, + collection_id: str, + feature_id: str, + **kwargs: Any + ) -> None: + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Delete Feature API deletes the feature identified by the provided id in the given + collection. At this point this API supports only facility features. Deleting a facility feature + deletes all the child features of that facility recursively. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py new file mode 100644 index 000000000000..6f6a90b20af7 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/__init__.py @@ -0,0 +1,259 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AliasListItem + from ._models_py3 import AliasListResponse + from ._models_py3 import AliasesCreateResponse + from ._models_py3 import BooleanRuleObject + from ._models_py3 import BooleanTypeStyleRule + from ._models_py3 import BufferRequestBody + from ._models_py3 import BufferResponse + from ._models_py3 import BufferResponseSummary + from ._models_py3 import ClosestPointResponse + from ._models_py3 import ClosestPointResultEntry + from ._models_py3 import ClosestPointSummary + from ._models_py3 import CollectionDefinitionResponse + from ._models_py3 import CollectionInfo + from ._models_py3 import CollectionsResponse + from ._models_py3 import ConformanceResponse + from ._models_py3 import ConversionListDetailInfo + from ._models_py3 import ConversionListResponse + from ._models_py3 import DatasetDetailInfo + from ._models_py3 import DatasetListResponse + from ._models_py3 import DatasetSources + from ._models_py3 import DefinitionProperties + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import ExtendedGeoJsonFeatureCollection + from ._models_py3 import ExtendedGeoJsonFeatureCollectionData + from ._models_py3 import FeatureResponse + from ._models_py3 import FeatureStateObject + from ._models_py3 import FeatureStatesStructure + from ._models_py3 import GeoJsonFeature + from ._models_py3 import GeoJsonFeatureCollection + from ._models_py3 import GeoJsonFeatureCollectionData + from ._models_py3 import GeoJsonFeatureData + from ._models_py3 import GeoJsonGeometry + from ._models_py3 import GeoJsonGeometryCollection + from ._models_py3 import GeoJsonGeometryCollectionData + from ._models_py3 import GeoJsonLineString + from ._models_py3 import GeoJsonLineStringData + from ._models_py3 import GeoJsonMultiLineString + from ._models_py3 import GeoJsonMultiLineStringData + from ._models_py3 import GeoJsonMultiPoint + from ._models_py3 import GeoJsonMultiPointData + from ._models_py3 import GeoJsonMultiPolygon + from ._models_py3 import GeoJsonMultiPolygonData + from ._models_py3 import GeoJsonObject + from ._models_py3 import GeoJsonPoint + from ._models_py3 import GeoJsonPointData + from ._models_py3 import GeoJsonPolygon + from ._models_py3 import GeoJsonPolygonData + from ._models_py3 import GeofenceGeometry + from ._models_py3 import GeofenceResponse + from ._models_py3 import GreatCircleDistanceResponse + from ._models_py3 import GreatCircleDistanceResponseResult + from ._models_py3 import GreatCircleDistanceResponseSummary + from ._models_py3 import LandingPageResponse + from ._models_py3 import LongRunningOperationResult + from ._models_py3 import MapDataDetailInfo + from ._models_py3 import MapDataListResponse + from ._models_py3 import NumberRuleObject + from ._models_py3 import NumberTypeStyleRule + from ._models_py3 import PointInPolygonResponse + from ._models_py3 import PointInPolygonResult + from ._models_py3 import PointInPolygonSummary + from ._models_py3 import RangeObject + from ._models_py3 import SpatialCoordinate + from ._models_py3 import StatesetCreatedResponse + from ._models_py3 import StatesetGetResponse + from ._models_py3 import StatesetInfoObject + from ._models_py3 import StatesetListResponse + from ._models_py3 import StringTypeStyleRule + from ._models_py3 import StyleObject + from ._models_py3 import StylesObject + from ._models_py3 import TilesetDetailInfo + from ._models_py3 import TilesetListResponse + from ._models_py3 import WfsEndpointLink +except (SyntaxError, ImportError): + from ._models import AliasListItem # type: ignore + from ._models import AliasListResponse # type: ignore + from ._models import AliasesCreateResponse # type: ignore + from ._models import BooleanRuleObject # type: ignore + from ._models import BooleanTypeStyleRule # type: ignore + from ._models import BufferRequestBody # type: ignore + from ._models import BufferResponse # type: ignore + from ._models import BufferResponseSummary # type: ignore + from ._models import ClosestPointResponse # type: ignore + from ._models import ClosestPointResultEntry # type: ignore + from ._models import ClosestPointSummary # type: ignore + from ._models import CollectionDefinitionResponse # type: ignore + from ._models import CollectionInfo # type: ignore + from ._models import CollectionsResponse # type: ignore + from ._models import ConformanceResponse # type: ignore + from ._models import ConversionListDetailInfo # type: ignore + from ._models import ConversionListResponse # type: ignore + from ._models import DatasetDetailInfo # type: ignore + from ._models import DatasetListResponse # type: ignore + from ._models import DatasetSources # type: ignore + from ._models import DefinitionProperties # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import ExtendedGeoJsonFeatureCollection # type: ignore + from ._models import ExtendedGeoJsonFeatureCollectionData # type: ignore + from ._models import FeatureResponse # type: ignore + from ._models import FeatureStateObject # type: ignore + from ._models import FeatureStatesStructure # type: ignore + from ._models import GeoJsonFeature # type: ignore + from ._models import GeoJsonFeatureCollection # type: ignore + from ._models import GeoJsonFeatureCollectionData # type: ignore + from ._models import GeoJsonFeatureData # type: ignore + from ._models import GeoJsonGeometry # type: ignore + from ._models import GeoJsonGeometryCollection # type: ignore + from ._models import GeoJsonGeometryCollectionData # type: ignore + from ._models import GeoJsonLineString # type: ignore + from ._models import GeoJsonLineStringData # type: ignore + from ._models import GeoJsonMultiLineString # type: ignore + from ._models import GeoJsonMultiLineStringData # type: ignore + from ._models import GeoJsonMultiPoint # type: ignore + from ._models import GeoJsonMultiPointData # type: ignore + from ._models import GeoJsonMultiPolygon # type: ignore + from ._models import GeoJsonMultiPolygonData # type: ignore + from ._models import GeoJsonObject # type: ignore + from ._models import GeoJsonPoint # type: ignore + from ._models import GeoJsonPointData # type: ignore + from ._models import GeoJsonPolygon # type: ignore + from ._models import GeoJsonPolygonData # type: ignore + from ._models import GeofenceGeometry # type: ignore + from ._models import GeofenceResponse # type: ignore + from ._models import GreatCircleDistanceResponse # type: ignore + from ._models import GreatCircleDistanceResponseResult # type: ignore + from ._models import GreatCircleDistanceResponseSummary # type: ignore + from ._models import LandingPageResponse # type: ignore + from ._models import LongRunningOperationResult # type: ignore + from ._models import MapDataDetailInfo # type: ignore + from ._models import MapDataListResponse # type: ignore + from ._models import NumberRuleObject # type: ignore + from ._models import NumberTypeStyleRule # type: ignore + from ._models import PointInPolygonResponse # type: ignore + from ._models import PointInPolygonResult # type: ignore + from ._models import PointInPolygonSummary # type: ignore + from ._models import RangeObject # type: ignore + from ._models import SpatialCoordinate # type: ignore + from ._models import StatesetCreatedResponse # type: ignore + from ._models import StatesetGetResponse # type: ignore + from ._models import StatesetInfoObject # type: ignore + from ._models import StatesetListResponse # type: ignore + from ._models import StringTypeStyleRule # type: ignore + from ._models import StyleObject # type: ignore + from ._models import StylesObject # type: ignore + from ._models import TilesetDetailInfo # type: ignore + from ._models import TilesetListResponse # type: ignore + from ._models import WfsEndpointLink # type: ignore + +from ._creator_client_enums import ( + GeoJsonGeometryType, + GeoJsonObjectType, + GeofenceMode, + GeographicResourceLocation, + Geography, + LroStatus, + ResponseFormat, + StyleObjectType, + UploadDataFormat, +) + +__all__ = [ + 'AliasListItem', + 'AliasListResponse', + 'AliasesCreateResponse', + 'BooleanRuleObject', + 'BooleanTypeStyleRule', + 'BufferRequestBody', + 'BufferResponse', + 'BufferResponseSummary', + 'ClosestPointResponse', + 'ClosestPointResultEntry', + 'ClosestPointSummary', + 'CollectionDefinitionResponse', + 'CollectionInfo', + 'CollectionsResponse', + 'ConformanceResponse', + 'ConversionListDetailInfo', + 'ConversionListResponse', + 'DatasetDetailInfo', + 'DatasetListResponse', + 'DatasetSources', + 'DefinitionProperties', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ExtendedGeoJsonFeatureCollection', + 'ExtendedGeoJsonFeatureCollectionData', + 'FeatureResponse', + 'FeatureStateObject', + 'FeatureStatesStructure', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'GeofenceGeometry', + 'GeofenceResponse', + 'GreatCircleDistanceResponse', + 'GreatCircleDistanceResponseResult', + 'GreatCircleDistanceResponseSummary', + 'LandingPageResponse', + 'LongRunningOperationResult', + 'MapDataDetailInfo', + 'MapDataListResponse', + 'NumberRuleObject', + 'NumberTypeStyleRule', + 'PointInPolygonResponse', + 'PointInPolygonResult', + 'PointInPolygonSummary', + 'RangeObject', + 'SpatialCoordinate', + 'StatesetCreatedResponse', + 'StatesetGetResponse', + 'StatesetInfoObject', + 'StatesetListResponse', + 'StringTypeStyleRule', + 'StyleObject', + 'StylesObject', + 'TilesetDetailInfo', + 'TilesetListResponse', + 'WfsEndpointLink', + 'GeoJsonGeometryType', + 'GeoJsonObjectType', + 'GeofenceMode', + 'GeographicResourceLocation', + 'Geography', + 'LroStatus', + 'ResponseFormat', + 'StyleObjectType', + 'UploadDataFormat', +] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py new file mode 100644 index 000000000000..8df43612a4dc --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_creator_client_enums.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class GeofenceMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Publish all the query results to Azure Maps account event subscription. + ALL = "All" + #: Only publish result when user location is considered as crossing geofencing boarder. + ENTER_AND_EXIT = "EnterAndExit" + +class GeographicResourceLocation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Used to access an Azure Maps Creator resource in the United States. + US = "us" + #: Used to access an Azure Maps Creator resource in Europe. + EU = "eu" + +class Geography(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This parameter specifies where the Azure Maps Creator resource is located. Valid values are us + and eu. + """ + + US = "us" + EU = "eu" + +class GeoJsonGeometryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """type of geometry returned + """ + + #: ``GeoJSON Point`` geometry. + GEO_JSON_POINT = "Point" + #: ``GeoJSON MultiPoint`` geometry. + GEO_JSON_MULTI_POINT = "MultiPoint" + #: ``GeoJSON LineString`` geometry. + GEO_JSON_LINE_STRING = "LineString" + #: ``GeoJSON MultiLineString`` geometry. + GEO_JSON_MULTI_LINE_STRING = "MultiLineString" + #: ``GeoJSON Polygon`` geometry. + GEO_JSON_POLYGON = "Polygon" + #: ``GeoJSON MultiPolygon`` geometry. + GEO_JSON_MULTI_POLYGON = "MultiPolygon" + #: ``GeoJSON GeometryCollection`` geometry. + GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" + +class GeoJsonObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON object types - Point, + MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and + FeatureCollection. + """ + + #: ``GeoJSON Point`` geometry. + GEO_JSON_POINT = "Point" + #: ``GeoJSON MultiPoint`` geometry. + GEO_JSON_MULTI_POINT = "MultiPoint" + #: ``GeoJSON LineString`` geometry. + GEO_JSON_LINE_STRING = "LineString" + #: ``GeoJSON MultiLineString`` geometry. + GEO_JSON_MULTI_LINE_STRING = "MultiLineString" + #: ``GeoJSON Polygon`` geometry. + GEO_JSON_POLYGON = "Polygon" + #: ``GeoJSON MultiPolygon`` geometry. + GEO_JSON_MULTI_POLYGON = "MultiPolygon" + #: ``GeoJSON GeometryCollection`` geometry. + GEO_JSON_GEOMETRY_COLLECTION = "GeometryCollection" + #: ``GeoJSON Feature`` object. + GEO_JSON_FEATURE = "Feature" + #: ``GeoJSON FeatureCollection`` object. + GEO_JSON_FEATURE_COLLECTION = "FeatureCollection" + +class LroStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status state of the request. + """ + + #: The request has not started processing yet. + NOT_STARTED = "NotStarted" + #: The request has started processing. + RUNNING = "Running" + #: The request has one or more failures. + FAILED = "Failed" + #: The request has successfully completed. + SUCCEEDED = "Succeeded" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class StyleObjectType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of stateset style. + """ + + #: Boolean type of stateset style. + BOOLEAN_TYPE_STYLE_RULE = "boolean" + #: Number type of stateset style. + NUMBER_TYPE_STYLE_RULE = "number" + #: String type of stateset style. + STRING_TYPE_STYLE_RULE = "string" + +class UploadDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `GeoJSON `_ is a JSON based geospatial data interchange + #: format. + GEOJSON = "geojson" + #: Compressed data format. + ZIP = "zip" + #: ZIP package containing DWG file. + DWGZIPPACKAGE = "dwgzippackage" diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py new file mode 100644 index 000000000000..65267f308b9c --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models.py @@ -0,0 +1,2601 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AliasesCreateResponse(msrest.serialization.Model): + """The response model for the Alias Create API for the case when the alias was successfully created. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasesCreateResponse, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListItem(msrest.serialization.Model): + """Detailed information for the alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListItem, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListResponse(msrest.serialization.Model): + """The response model for the List API. Returns a list of all the previously created aliases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar aliases: A list of all the previously created aliases. + :vartype aliases: list[~azure.maps.creator.models.AliasListItem] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'aliases': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'aliases': {'key': 'aliases', 'type': '[AliasListItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListResponse, self).__init__(**kwargs) + self.aliases = None + self.next_link = None + + +class BooleanRuleObject(msrest.serialization.Model): + """The boolean rule. The color is selected based on the logic value of the key. + + :param true: The color when value is true. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type true: str + :param false: The color when value is false. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type false: str + """ + + _attribute_map = { + 'true': {'key': 'true', 'type': 'str'}, + 'false': {'key': 'false', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BooleanRuleObject, self).__init__(**kwargs) + self.true = kwargs.get('true', None) + self.false = kwargs.get('false', None) + + +class StyleObject(msrest.serialization.Model): + """The stateset style model. The style rule could be a numeric type style rule or a boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject definitions `here `_. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BooleanTypeStyleRule, NumberTypeStyleRule, StringTypeStyleRule. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'boolean': 'BooleanTypeStyleRule', 'number': 'NumberTypeStyleRule', 'string': 'StringTypeStyleRule'} + } + + def __init__( + self, + **kwargs + ): + super(StyleObject, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.type = None # type: Optional[str] + + +class BooleanTypeStyleRule(StyleObject): + """The boolean type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Boolean style rules. + :type rules: list[~azure.maps.creator.models.BooleanRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[BooleanRuleObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(BooleanTypeStyleRule, self).__init__(**kwargs) + self.type = 'boolean' # type: str + self.rules = kwargs['rules'] + + +class BufferRequestBody(msrest.serialization.Model): + """An object with a FeatureCollection and a list of distances. All the feature's properties should contain ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + + :param geometries: A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 + `_ for details. + :type geometries: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param distances: List of the distances to compute the buffer for, one-to-one per Feature in + the collection, or one for all Features in the collection. + :type distances: list[float] + """ + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': 'GeoJsonFeatureCollection'}, + 'distances': {'key': 'distances', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferRequestBody, self).__init__(**kwargs) + self.geometries = kwargs.get('geometries', None) + self.distances = kwargs.get('distances', None) + + +class BufferResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Buffer call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary of the call. + :vartype summary: ~azure.maps.creator.models.BufferResponseSummary + :param result: The FeatureCollection of buffers for the input. + :type result: ~azure.maps.creator.models.GeoJsonFeatureCollection + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BufferResponseSummary'}, + 'result': {'key': 'result', 'type': 'GeoJsonFeatureCollection'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class BufferResponseSummary(msrest.serialization.Model): + """Summary of the call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The udid for the user data if one exists. + :vartype udid: str + :ivar information: The information about what happened during the call. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResponseSummary, self).__init__(**kwargs) + self.udid = None + self.information = None + + +class ClosestPointResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Closest Point call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Closest Point Summary object. + :vartype summary: ~azure.maps.creator.models.ClosestPointSummary + :param result: Closest Point Result Array. + :type result: list[~azure.maps.creator.models.ClosestPointResultEntry] + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ClosestPointSummary'}, + 'result': {'key': 'result', 'type': '[ClosestPointResultEntry]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class ClosestPointResultEntry(msrest.serialization.Model): + """Closest Point Result Entry Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The distance in meters from the source point to the closest point. + :vartype distance_in_meters: float + :param position: A location represented as a latitude and longitude. + :type position: ~azure.maps.creator.models.SpatialCoordinate + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + 'geometry_id': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + 'position': {'key': 'position', 'type': 'SpatialCoordinate'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointResultEntry, self).__init__(**kwargs) + self.distance_in_meters = None + self.position = kwargs.get('position', None) + self.geometry_id = None + + +class ClosestPointSummary(msrest.serialization.Model): + """Closest Point Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClosestPointSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.udid = None + self.information = None + + +class CollectionDefinitionResponse(msrest.serialization.Model): + """collection of GeoJSON features. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: describes the collection. + :type description: str + :param id_prefix: Required. prefix of the collection used. + :type id_prefix: str + :param name: Required. identifier of the collection used, for example, in URIs. + :type name: str + :param title: title of collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param geometry_type: Required. type of geometry returned. Possible values include: "Point", + "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection". + :type geometry_type: str or ~azure.maps.creator.models.GeoJsonGeometryType + :param feature_types: Required. type of features returned. + :type feature_types: list[str] + :param properties: attributes of the collection used. + :type properties: list[~azure.maps.creator.models.DefinitionProperties] + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'id_prefix': {'required': True}, + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'geometry_type': {'required': True}, + 'feature_types': {'required': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'id_prefix': {'key': 'idPrefix', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'geometry_type': {'key': 'geometryType', 'type': 'str'}, + 'feature_types': {'key': 'featureTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '[DefinitionProperties]'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionDefinitionResponse, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.id_prefix = kwargs['id_prefix'] + self.name = kwargs['name'] + self.title = kwargs.get('title', None) + self.ontology = None + self.geometry_type = kwargs['geometry_type'] + self.feature_types = kwargs['feature_types'] + self.properties = kwargs.get('properties', None) + self.links = kwargs.get('links', None) + + +class CollectionInfo(msrest.serialization.Model): + """CollectionInfo. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. identifier of the collection used, for example, in URIs. + :type name: str + :param title: human readable title of the collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param description: a description of the features in the collection. + :type description: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionInfo, self).__init__(**kwargs) + self.name = kwargs['name'] + self.title = kwargs.get('title', None) + self.ontology = None + self.description = kwargs.get('description', None) + self.links = kwargs['links'] + + +class CollectionsResponse(msrest.serialization.Model): + """CollectionsResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param collections: Required. All the collections in a given dataset. + :type collections: list[~azure.maps.creator.models.CollectionInfo] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + 'collections': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'collections': {'key': 'collections', 'type': '[CollectionInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(CollectionsResponse, self).__init__(**kwargs) + self.ontology = None + self.links = kwargs['links'] + self.collections = kwargs['collections'] + + +class ConformanceResponse(msrest.serialization.Model): + """ConformanceResponse. + + All required parameters must be populated in order to send to Azure. + + :param conforms_to: Required. List of requirements classes that the server conforms to. + :type conforms_to: list[str] + """ + + _validation = { + 'conforms_to': {'required': True}, + } + + _attribute_map = { + 'conforms_to': {'key': 'conformsTo', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ConformanceResponse, self).__init__(**kwargs) + self.conforms_to = kwargs['conforms_to'] + + +class ConversionListDetailInfo(msrest.serialization.Model): + """Detail information for the conversion requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_id: A unique id that represents the artifact of a *successfully* completed + conversion process. + :vartype conversion_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar udid: The unique id of the content provided to create this conversion. + :vartype udid: str + :ivar created: The date and time of this conversion. + :vartype created: str + :ivar description: User provided description of the content being converted. + :vartype description: str + :ivar feature_counts: A summary of feature counts in this conversion. + :vartype feature_counts: any + """ + + _validation = { + 'conversion_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'udid': {'readonly': True}, + 'created': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'conversion_id': {'key': 'conversionId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListDetailInfo, self).__init__(**kwargs) + self.conversion_id = None + self.ontology = None + self.udid = None + self.created = None + self.description = None + self.feature_counts = None + + +class ConversionListResponse(msrest.serialization.Model): + """The response model for the Conversion List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversions: A list of all the previously submitted conversion requests. + :vartype conversions: list[~azure.maps.creator.models.ConversionListDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'conversions': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'conversions': {'key': 'conversions', 'type': '[ConversionListDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListResponse, self).__init__(**kwargs) + self.conversions = None + self.next_link = None + + +class DatasetDetailInfo(msrest.serialization.Model): + """Detail information for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: The created timestamp for the dataset. + :vartype created: str + :ivar dataset_id: The id for the dataset. + :vartype dataset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar description: The description for the dataset. + :vartype description: str + :param dataset_sources: Information about the details of the create request for the dataset. + :type dataset_sources: ~azure.maps.creator.models.DatasetSources + :ivar feature_counts: The feature counts for the dataset. + :vartype feature_counts: any + """ + + _validation = { + 'created': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_sources': {'key': 'datasetSources', 'type': 'DatasetSources'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetDetailInfo, self).__init__(**kwargs) + self.created = None + self.dataset_id = None + self.ontology = None + self.description = None + self.dataset_sources = kwargs.get('dataset_sources', None) + self.feature_counts = None + + +class DatasetListResponse(msrest.serialization.Model): + """The response model for the Dataset List API. The response body will contain a list of all the previously created datasets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar datasets: A list of all the previously created datasets. + :vartype datasets: list[~azure.maps.creator.models.DatasetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'datasets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'datasets': {'key': 'datasets', 'type': '[DatasetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetListResponse, self).__init__(**kwargs) + self.datasets = None + self.next_link = None + + +class DatasetSources(msrest.serialization.Model): + """Information about the details of the create request for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_ids: The list of ``conversionId`` that were used to create the dataset. + :vartype conversion_ids: list[str] + :ivar append_dataset_id: The dataset that was appended to to create the current dataset. + :vartype append_dataset_id: str + """ + + _validation = { + 'conversion_ids': {'readonly': True}, + 'append_dataset_id': {'readonly': True}, + } + + _attribute_map = { + 'conversion_ids': {'key': 'conversionIds', 'type': '[str]'}, + 'append_dataset_id': {'key': 'appendDatasetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetSources, self).__init__(**kwargs) + self.conversion_ids = None + self.append_dataset_id = None + + +class DefinitionProperties(msrest.serialization.Model): + """DefinitionProperties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. name of attribute. + :type name: str + :param required: Required. is attribute required. + :type required: bool + :param type: Required. type of attribute. + :type type: any + """ + + _validation = { + 'name': {'required': True}, + 'required': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(DefinitionProperties, self).__init__(**kwargs) + self.name = kwargs['name'] + self.required = kwargs['required'] + self.type = kwargs['type'] + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.maps.creator.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.creator.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.maps.creator.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class ExtendedGeoJsonFeatureCollectionData(msrest.serialization.Model): + """ExtendedGeoJsonFeatureCollectionData. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.ontology = None + self.number_returned = kwargs.get('number_returned', None) + self.links = kwargs.get('links', None) + + +class GeoJsonFeatureCollectionData(msrest.serialization.Model): + """GeoJsonFeatureCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + """ + + _validation = { + 'features': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.features = kwargs['features'] + + +class GeoJsonObject(msrest.serialization.Model): + """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonObject, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ExtendedGeoJsonFeatureCollection. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FeatureCollection': 'ExtendedGeoJsonFeatureCollection'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(**kwargs) + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # type: str + + +class ExtendedGeoJsonFeatureCollection(GeoJsonFeatureCollection, ExtendedGeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type extended with numberReturned and links array. Please refer to `RFC 7946 `_ for details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'ontology': {'readonly': True}, + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollection, self).__init__(**kwargs) + self.ontology = None + self.number_returned = kwargs.get('number_returned', None) + self.links = kwargs.get('links', None) + self.type = 'FeatureCollection' # type: str + self.features = kwargs['features'] + self.type = 'FeatureCollection' # type: str + + +class FeatureResponse(msrest.serialization.Model): + """FeatureResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param feature: Required. A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 + `_ for details. + :type feature: ~azure.maps.creator.models.GeoJsonFeature + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'feature': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'feature': {'key': 'feature', 'type': 'GeoJsonFeature'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureResponse, self).__init__(**kwargs) + self.ontology = None + self.feature = kwargs['feature'] + self.links = kwargs.get('links', None) + + +class FeatureStateObject(msrest.serialization.Model): + """Single feature state model. + + :param key_name: Feature state Keyname. Maximum length allowed is 1000. + :type key_name: str + :param value: Value for the feature state. Type should comply with the style definition + attached to the featurestate. Maximum length allowed for string type is 1024. + :type value: str + :param event_timestamp: Valid Timestamp when the feature state was captured. + :type event_timestamp: str + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureStateObject, self).__init__(**kwargs) + self.key_name = kwargs.get('key_name', None) + self.value = kwargs.get('value', None) + self.event_timestamp = kwargs.get('event_timestamp', None) + + +class FeatureStatesStructure(msrest.serialization.Model): + """The feature states model for a feature. + + :param states: The feature states array. + :type states: list[~azure.maps.creator.models.FeatureStateObject] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[FeatureStateObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(FeatureStatesStructure, self).__init__(**kwargs) + self.states = kwargs.get('states', None) + + +class GeofenceGeometry(msrest.serialization.Model): + """The geofencing geometry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_id: ID of the device. + :vartype device_id: str + :ivar ud_id: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :vartype ud_id: str + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + :ivar distance: Distance from the coordinate to the closest border of the geofence. Positive + means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, + but more than the value of searchBuffer away from the closest geofence border, then the value + is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside + the polygon, but more than the value of searchBuffer away from the closest geofencing border, + then the value is -999. A value of 999 means that there is great confidence the coordinate is + well outside the geofence. A value of -999 means that there is great confidence the coordinate + is well within the geofence. + :vartype distance: float + :ivar nearest_lat: Latitude of the nearest point of the geometry. + :vartype nearest_lat: float + :ivar nearest_lon: Longitude of the nearest point of the geometry. + :vartype nearest_lon: float + :ivar nearest_z: Sea level in meter of the nearest point on the 2D extrusion geometry. This + will only be presented in response when value is provided for 'zInMeter' in the request. + :vartype nearest_z: float + """ + + _validation = { + 'device_id': {'readonly': True}, + 'ud_id': {'readonly': True}, + 'geometry_id': {'readonly': True}, + 'distance': {'readonly': True}, + 'nearest_lat': {'readonly': True}, + 'nearest_lon': {'readonly': True}, + 'nearest_z': {'readonly': True}, + } + + _attribute_map = { + 'device_id': {'key': 'deviceId', 'type': 'str'}, + 'ud_id': {'key': 'udId', 'type': 'str'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + 'distance': {'key': 'distance', 'type': 'float'}, + 'nearest_lat': {'key': 'nearestLat', 'type': 'float'}, + 'nearest_lon': {'key': 'nearestLon', 'type': 'float'}, + 'nearest_z': {'key': 'nearestZ', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceGeometry, self).__init__(**kwargs) + self.device_id = None + self.ud_id = None + self.geometry_id = None + self.distance = None + self.nearest_lat = None + self.nearest_lon = None + self.nearest_z = None + + +class GeofenceResponse(msrest.serialization.Model): + """This object is returned from a geofence proximity call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar geometries: Lists the fence geometries that contain the coordinate position or overlap + the searchBuffer around the position. + :vartype geometries: list[~azure.maps.creator.models.GeofenceGeometry] + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. This will only + be presented in response when 'isAsync' query parameter is set to true. + :vartype is_event_published: bool + """ + + _validation = { + 'geometries': {'readonly': True}, + 'expired_geofence_geometry_id': {'readonly': True}, + 'invalid_period_geofence_geometry_id': {'readonly': True}, + 'is_event_published': {'readonly': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeofenceGeometry]'}, + 'expired_geofence_geometry_id': {'key': 'expiredGeofenceGeometryId', 'type': '[str]'}, + 'invalid_period_geofence_geometry_id': {'key': 'invalidPeriodGeofenceGeometryId', 'type': '[str]'}, + 'is_event_published': {'key': 'isEventPublished', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceResponse, self).__init__(**kwargs) + self.geometries = None + self.expired_geofence_geometry_id = None + self.invalid_period_geofence_geometry_id = None + self.is_event_published = None + + +class GeoJsonFeatureData(msrest.serialization.Model): + """GeoJsonFeatureData. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + """ + + _validation = { + 'geometry': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeatureData, self).__init__(**kwargs) + self.geometry = kwargs['geometry'] + self.properties = kwargs.get('properties', None) + self.id = kwargs.get('id', None) + self.feature_type = kwargs.get('feature_type', None) + + +class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): + """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometry': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonFeature, self).__init__(**kwargs) + self.geometry = kwargs['geometry'] + self.properties = kwargs.get('properties', None) + self.id = kwargs.get('id', None) + self.feature_type = kwargs.get('feature_type', None) + self.type = 'Feature' # type: str + self.type = 'Feature' # type: str + + +class GeoJsonGeometry(GeoJsonObject): + """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometry, self).__init__(**kwargs) + self.type = 'GeoJsonGeometry' # type: str + + +class GeoJsonGeometryCollectionData(msrest.serialization.Model): + """GeoJsonGeometryCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + """ + + _validation = { + 'geometries': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) + self.geometries = kwargs['geometries'] + + +class GeoJsonGeometryCollection(GeoJsonGeometry, GeoJsonGeometryCollectionData): + """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometries': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometryCollection, self).__init__(**kwargs) + self.geometries = kwargs['geometries'] + self.type = 'GeometryCollection' # type: str + self.type = 'GeometryCollection' # type: str + + +class GeoJsonLineStringData(msrest.serialization.Model): + """GeoJsonLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonLineStringData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonLineString(GeoJsonGeometry, GeoJsonLineStringData): + """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonLineString, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'LineString' # type: str + self.type = 'LineString' # type: str + + +class GeoJsonMultiLineStringData(msrest.serialization.Model): + """GeoJsonMultiLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiLineStringData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiLineString(GeoJsonGeometry, GeoJsonMultiLineStringData): + """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiLineString, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiLineString' # type: str + self.type = 'MultiLineString' # type: str + + +class GeoJsonMultiPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson MultiPoint``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPointData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiPoint(GeoJsonGeometry, GeoJsonMultiPointData): + """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPoint, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiPoint' # type: str + self.type = 'MultiPoint' # type: str + + +class GeoJsonMultiPolygonData(msrest.serialization.Model): + """GeoJsonMultiPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPolygonData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonMultiPolygon(GeoJsonGeometry, GeoJsonMultiPolygonData): + """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonMultiPolygon, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'MultiPolygon' # type: str + self.type = 'MultiPolygon' # type: str + + +class GeoJsonPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson Point``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPointData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonPoint(GeoJsonGeometry, GeoJsonPointData): + """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPoint, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'Point' # type: str + self.type = 'Point' # type: str + + +class GeoJsonPolygonData(msrest.serialization.Model): + """GeoJsonPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPolygonData, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + + +class GeoJsonPolygon(GeoJsonGeometry, GeoJsonPolygonData): + """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonPolygon, self).__init__(**kwargs) + self.coordinates = kwargs['coordinates'] + self.type = 'Polygon' # type: str + self.type = 'Polygon' # type: str + + +class GreatCircleDistanceResponse(msrest.serialization.Model): + """This object is returned from a successful Great Circle Distance call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object. + :vartype summary: ~azure.maps.creator.models.GreatCircleDistanceResponseSummary + :ivar result: Result Object. + :vartype result: ~azure.maps.creator.models.GreatCircleDistanceResponseResult + """ + + _validation = { + 'summary': {'readonly': True}, + 'result': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'GreatCircleDistanceResponseSummary'}, + 'result': {'key': 'result', 'type': 'GreatCircleDistanceResponseResult'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponse, self).__init__(**kwargs) + self.summary = None + self.result = None + + +class GreatCircleDistanceResponseResult(msrest.serialization.Model): + """Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The great circle distance in meters from the source point to the + target point. + :vartype distance_in_meters: float + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponseResult, self).__init__(**kwargs) + self.distance_in_meters = None + + +class GreatCircleDistanceResponseSummary(msrest.serialization.Model): + """Summary object. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :param target_point: A location represented as a latitude and longitude. + :type target_point: ~azure.maps.creator.models.SpatialCoordinate + """ + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'target_point': {'key': 'targetPoint', 'type': 'SpatialCoordinate'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponseSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.target_point = kwargs.get('target_point', None) + + +class LandingPageResponse(msrest.serialization.Model): + """LandingPageResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + **kwargs + ): + super(LandingPageResponse, self).__init__(**kwargs) + self.ontology = None + self.links = kwargs['links'] + + +class LongRunningOperationResult(msrest.serialization.Model): + """The response model for a Long-Running Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param operation_id: The Id for this long-running operation. + :type operation_id: str + :ivar status: The status state of the request. Possible values include: "NotStarted", + "Running", "Failed", "Succeeded". + :vartype status: str or ~azure.maps.creator.models.LroStatus + :ivar created: The created timestamp. + :vartype created: str + :param error: The error detail. + :type error: ~azure.maps.creator.models.ErrorDetail + :param warning: The error detail. + :type warning: ~azure.maps.creator.models.ErrorDetail + """ + + _validation = { + 'status': {'readonly': True}, + 'created': {'readonly': True}, + } + + _attribute_map = { + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'warning': {'key': 'warning', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(LongRunningOperationResult, self).__init__(**kwargs) + self.operation_id = kwargs.get('operation_id', None) + self.status = None + self.created = None + self.error = kwargs.get('error', None) + self.warning = kwargs.get('warning', None) + + +class MapDataDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The unique data id for the data. + :vartype udid: str + :ivar location: The location of the data. Execute a HTTP ``GET`` on this location to download + the data. + :vartype location: str + :ivar size_in_bytes: The size of the content in bytes. + :vartype size_in_bytes: long + :ivar upload_status: The current upload status of the content. + :vartype upload_status: str + :ivar data_format: The current data format. + :vartype data_format: str + :ivar description: The current description. + :vartype description: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'location': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'upload_status': {'readonly': True}, + 'data_format': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'long'}, + 'upload_status': {'key': 'uploadStatus', 'type': 'str'}, + 'data_format': {'key': 'dataFormat', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataDetailInfo, self).__init__(**kwargs) + self.udid = None + self.location = None + self.size_in_bytes = None + self.upload_status = None + self.data_format = None + self.description = None + + +class MapDataListResponse(msrest.serialization.Model): + """The response model for the Data List API. Returns a list of all the previously uploaded data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar map_data_list: A list of all the previously uploaded data. + :vartype map_data_list: list[~azure.maps.creator.models.MapDataDetailInfo] + """ + + _validation = { + 'map_data_list': {'readonly': True}, + } + + _attribute_map = { + 'map_data_list': {'key': 'mapDataList', 'type': '[MapDataDetailInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataListResponse, self).__init__(**kwargs) + self.map_data_list = None + + +class NumberRuleObject(msrest.serialization.Model): + """The numeric rule. The color is selected from the first range it falls into. + + :param range: The numeric value range for this style rule. If the value is in the range, all + the conditions must hold true. + :type range: ~azure.maps.creator.models.RangeObject + :param color: The color when value is within the range. Color is a JSON string in a variety of + permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA + ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). + Predefined HTML colors names, like yellow and blue, are also permitted. + :type color: str + """ + + _attribute_map = { + 'range': {'key': 'range', 'type': 'RangeObject'}, + 'color': {'key': 'color', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NumberRuleObject, self).__init__(**kwargs) + self.range = kwargs.get('range', None) + self.color = kwargs.get('color', None) + + +class NumberTypeStyleRule(StyleObject): + """The numeric type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Numeric style rules. + :type rules: list[~azure.maps.creator.models.NumberRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[NumberRuleObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(NumberTypeStyleRule, self).__init__(**kwargs) + self.type = 'number' # type: str + self.rules = kwargs['rules'] + + +class PointInPolygonResponse(msrest.serialization.Model): + """Returns true if point is within the polygon, false otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Point In Polygon Summary object. + :vartype summary: ~azure.maps.creator.models.PointInPolygonSummary + :param result: Point In Polygon Result Object. + :type result: ~azure.maps.creator.models.PointInPolygonResult + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'PointInPolygonSummary'}, + 'result': {'key': 'result', 'type': 'PointInPolygonResult'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResponse, self).__init__(**kwargs) + self.summary = None + self.result = kwargs.get('result', None) + + +class PointInPolygonResult(msrest.serialization.Model): + """Point In Polygon Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar point_in_polygons: Point In Polygons Property. + :vartype point_in_polygons: bool + :ivar intersecting_geometries: Geometries array. + :vartype intersecting_geometries: list[str] + """ + + _validation = { + 'point_in_polygons': {'readonly': True}, + 'intersecting_geometries': {'readonly': True}, + } + + _attribute_map = { + 'point_in_polygons': {'key': 'pointInPolygons', 'type': 'bool'}, + 'intersecting_geometries': {'key': 'intersectingGeometries', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResult, self).__init__(**kwargs) + self.point_in_polygons = None + self.intersecting_geometries = None + + +class PointInPolygonSummary(msrest.serialization.Model): + """Point In Polygon Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. Udid is not applicable for POST + spatial operations(set to null). + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonSummary, self).__init__(**kwargs) + self.source_point = kwargs.get('source_point', None) + self.udid = None + self.information = None + + +class RangeObject(msrest.serialization.Model): + """The numeric value range for this style rule. If the value is in the range, all the conditions must hold true. + + :param minimum: All the number x that x ≥ minimum. + :type minimum: float + :param maximum: All the number x that x ≤ maximum. + :type maximum: float + :param exclusive_minimum: All the number x that x > exclusiveMinimum. + :type exclusive_minimum: float + :param exclusive_maximum: All the number x that x < exclusiveMaximum. + :type exclusive_maximum: float + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'exclusive_minimum': {'key': 'exclusiveMinimum', 'type': 'float'}, + 'exclusive_maximum': {'key': 'exclusiveMaximum', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RangeObject, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + self.exclusive_minimum = kwargs.get('exclusive_minimum', None) + self.exclusive_maximum = kwargs.get('exclusive_maximum', None) + + +class SpatialCoordinate(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lat: Latitude property. + :vartype lat: float + :ivar lon: Longitude property. + :vartype lon: float + """ + + _validation = { + 'lat': {'readonly': True}, + 'lon': {'readonly': True}, + } + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SpatialCoordinate, self).__init__(**kwargs) + self.lat = None + self.lon = None + + +class StatesetCreatedResponse(msrest.serialization.Model): + """The response model for the successful Stateset Create API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stateset_id: The ID for the new stateset created. + :vartype stateset_id: str + """ + + _validation = { + 'stateset_id': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetCreatedResponse, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetGetResponse(msrest.serialization.Model): + """The response model for the successful Stateset Get API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetGetResponse, self).__init__(**kwargs) + self.description = None + self.dataset_ids = kwargs.get('dataset_ids', None) + self.stateset_style = kwargs.get('stateset_style', None) + + +class StatesetInfoObject(msrest.serialization.Model): + """The stateset information detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param stateset_id: The stateset ID of this stateset. + :type stateset_id: str + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetInfoObject, self).__init__(**kwargs) + self.stateset_id = kwargs.get('stateset_id', None) + self.description = None + self.dataset_ids = kwargs.get('dataset_ids', None) + self.stateset_style = kwargs.get('stateset_style', None) + + +class StatesetListResponse(msrest.serialization.Model): + """The response model for the successful Stateset List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param statesets: A list of statesets information. + :type statesets: list[~azure.maps.creator.models.StatesetInfoObject] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'statesets': {'key': 'statesets', 'type': '[StatesetInfoObject]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetListResponse, self).__init__(**kwargs) + self.statesets = kwargs.get('statesets', None) + self.next_link = None + + +class StringTypeStyleRule(StyleObject): + """The string type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. String style rules. + :type rules: list[dict[str, str]] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[{str}]'}, + } + + def __init__( + self, + **kwargs + ): + super(StringTypeStyleRule, self).__init__(**kwargs) + self.type = 'string' # type: str + self.rules = kwargs['rules'] + + +class StylesObject(msrest.serialization.Model): + """The styles model. + + :param styles: An array of stateset styles. The style rule could be a numeric or string or a + boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject + definitions `here `_. + :type styles: list[~azure.maps.creator.models.StyleObject] + """ + + _attribute_map = { + 'styles': {'key': 'styles', 'type': '[StyleObject]'}, + } + + def __init__( + self, + **kwargs + ): + super(StylesObject, self).__init__(**kwargs) + self.styles = kwargs.get('styles', None) + + +class TilesetDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tileset_id: The unique tileset id for the tileset. + :vartype tileset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar dataset_id: The unique dataset Id used to create the tileset. + :vartype dataset_id: str + :ivar description: The description the caller provided when creating the tileset. Maximum + length 1024 characters. + :vartype description: str + :ivar min_zoom: The lowest tile zoom level tile generated for the tileset. + :vartype min_zoom: int + :ivar max_zoom: The highest tile zoom level tile generated for the tileset. + :vartype max_zoom: int + :ivar bbox: Bounding box which all features of the tileset lay within. Projection used - + EPSG:3857. Format : 'minLon, minLat, maxLon, maxLat'. + :vartype bbox: list[float] + """ + + _validation = { + 'tileset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'description': {'readonly': True}, + 'min_zoom': {'readonly': True}, + 'max_zoom': {'readonly': True}, + 'bbox': {'readonly': True}, + } + + _attribute_map = { + 'tileset_id': {'key': 'tilesetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'min_zoom': {'key': 'minZoom', 'type': 'int'}, + 'max_zoom': {'key': 'maxZoom', 'type': 'int'}, + 'bbox': {'key': 'bbox', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetDetailInfo, self).__init__(**kwargs) + self.tileset_id = None + self.ontology = None + self.dataset_id = None + self.description = None + self.min_zoom = None + self.max_zoom = None + self.bbox = None + + +class TilesetListResponse(msrest.serialization.Model): + """The response model for the Tileset List API. Returns a list of all tilesets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tilesets: A list of all tilesets. + :vartype tilesets: list[~azure.maps.creator.models.TilesetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'tilesets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'tilesets': {'key': 'tilesets', 'type': '[TilesetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetListResponse, self).__init__(**kwargs) + self.tilesets = None + self.next_link = None + + +class WfsEndpointLink(msrest.serialization.Model): + """Links to other WFS endpoints. + + All required parameters must be populated in order to send to Azure. + + :param href: Required. The link target. + :type href: str + :param rel: The relation type. + :type rel: str + :param type: A hint indicating what the media type of the result of dereferencing the link + should be. + :type type: str + :param hreflang: A hint indicating what the language of the result of dereferencing the link + should be. + :type hreflang: str + :param title: Used to label the destination of a link such that it can be used as a + human-readable identifier (e.g., a menu entry) in the language indicated by the + Content-Language header field (if present). + :type title: str + """ + + _validation = { + 'href': {'required': True}, + } + + _attribute_map = { + 'href': {'key': 'href', 'type': 'str'}, + 'rel': {'key': 'rel', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hreflang': {'key': 'hreflang', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WfsEndpointLink, self).__init__(**kwargs) + self.href = kwargs['href'] + self.rel = kwargs.get('rel', None) + self.type = kwargs.get('type', None) + self.hreflang = kwargs.get('hreflang', None) + self.title = kwargs.get('title', None) diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py new file mode 100644 index 000000000000..2b00344899ed --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/models/_models_py3.py @@ -0,0 +1,2753 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._creator_client_enums import * + + +class AliasesCreateResponse(msrest.serialization.Model): + """The response model for the Alias Create API for the case when the alias was successfully created. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasesCreateResponse, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListItem(msrest.serialization.Model): + """Detailed information for the alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created_timestamp: The created timestamp for the alias. + :vartype created_timestamp: str + :ivar alias_id: The id for the alias. + :vartype alias_id: str + :ivar creator_data_item_id: The id for the creator data item that this alias references (could + be null if the alias has not been assigned). + :vartype creator_data_item_id: str + :ivar last_updated_timestamp: The timestamp of the last time the alias was assigned. + :vartype last_updated_timestamp: str + """ + + _validation = { + 'created_timestamp': {'readonly': True}, + 'alias_id': {'readonly': True}, + 'creator_data_item_id': {'readonly': True}, + 'last_updated_timestamp': {'readonly': True}, + } + + _attribute_map = { + 'created_timestamp': {'key': 'createdTimestamp', 'type': 'str'}, + 'alias_id': {'key': 'aliasId', 'type': 'str'}, + 'creator_data_item_id': {'key': 'creatorDataItemId', 'type': 'str'}, + 'last_updated_timestamp': {'key': 'lastUpdatedTimestamp', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListItem, self).__init__(**kwargs) + self.created_timestamp = None + self.alias_id = None + self.creator_data_item_id = None + self.last_updated_timestamp = None + + +class AliasListResponse(msrest.serialization.Model): + """The response model for the List API. Returns a list of all the previously created aliases. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar aliases: A list of all the previously created aliases. + :vartype aliases: list[~azure.maps.creator.models.AliasListItem] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'aliases': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'aliases': {'key': 'aliases', 'type': '[AliasListItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AliasListResponse, self).__init__(**kwargs) + self.aliases = None + self.next_link = None + + +class BooleanRuleObject(msrest.serialization.Model): + """The boolean rule. The color is selected based on the logic value of the key. + + :param true: The color when value is true. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type true: str + :param false: The color when value is false. Color is a JSON string in a variety of permitted + formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA ("rgba(255, + 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). Predefined HTML + colors names, like yellow and blue, are also permitted. + :type false: str + """ + + _attribute_map = { + 'true': {'key': 'true', 'type': 'str'}, + 'false': {'key': 'false', 'type': 'str'}, + } + + def __init__( + self, + *, + true: Optional[str] = None, + false: Optional[str] = None, + **kwargs + ): + super(BooleanRuleObject, self).__init__(**kwargs) + self.true = true + self.false = false + + +class StyleObject(msrest.serialization.Model): + """The stateset style model. The style rule could be a numeric type style rule or a boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject definitions `here `_. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BooleanTypeStyleRule, NumberTypeStyleRule, StringTypeStyleRule. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'boolean': 'BooleanTypeStyleRule', 'number': 'NumberTypeStyleRule', 'string': 'StringTypeStyleRule'} + } + + def __init__( + self, + *, + key_name: str, + **kwargs + ): + super(StyleObject, self).__init__(**kwargs) + self.key_name = key_name + self.type = None # type: Optional[str] + + +class BooleanTypeStyleRule(StyleObject): + """The boolean type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Boolean style rules. + :type rules: list[~azure.maps.creator.models.BooleanRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[BooleanRuleObject]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List["BooleanRuleObject"], + **kwargs + ): + super(BooleanTypeStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'boolean' # type: str + self.rules = rules + + +class BufferRequestBody(msrest.serialization.Model): + """An object with a FeatureCollection and a list of distances. All the feature's properties should contain ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + + :param geometries: A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 + `_ for details. + :type geometries: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param distances: List of the distances to compute the buffer for, one-to-one per Feature in + the collection, or one for all Features in the collection. + :type distances: list[float] + """ + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': 'GeoJsonFeatureCollection'}, + 'distances': {'key': 'distances', 'type': '[float]'}, + } + + def __init__( + self, + *, + geometries: Optional["GeoJsonFeatureCollection"] = None, + distances: Optional[List[float]] = None, + **kwargs + ): + super(BufferRequestBody, self).__init__(**kwargs) + self.geometries = geometries + self.distances = distances + + +class BufferResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Buffer call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary of the call. + :vartype summary: ~azure.maps.creator.models.BufferResponseSummary + :param result: The FeatureCollection of buffers for the input. + :type result: ~azure.maps.creator.models.GeoJsonFeatureCollection + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BufferResponseSummary'}, + 'result': {'key': 'result', 'type': 'GeoJsonFeatureCollection'}, + } + + def __init__( + self, + *, + result: Optional["GeoJsonFeatureCollection"] = None, + **kwargs + ): + super(BufferResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class BufferResponseSummary(msrest.serialization.Model): + """Summary of the call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The udid for the user data if one exists. + :vartype udid: str + :ivar information: The information about what happened during the call. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BufferResponseSummary, self).__init__(**kwargs) + self.udid = None + self.information = None + + +class ClosestPointResponse(msrest.serialization.Model): + """This object is returned from a successful Spatial Closest Point call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Closest Point Summary object. + :vartype summary: ~azure.maps.creator.models.ClosestPointSummary + :param result: Closest Point Result Array. + :type result: list[~azure.maps.creator.models.ClosestPointResultEntry] + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'ClosestPointSummary'}, + 'result': {'key': 'result', 'type': '[ClosestPointResultEntry]'}, + } + + def __init__( + self, + *, + result: Optional[List["ClosestPointResultEntry"]] = None, + **kwargs + ): + super(ClosestPointResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class ClosestPointResultEntry(msrest.serialization.Model): + """Closest Point Result Entry Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The distance in meters from the source point to the closest point. + :vartype distance_in_meters: float + :param position: A location represented as a latitude and longitude. + :type position: ~azure.maps.creator.models.SpatialCoordinate + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + 'geometry_id': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + 'position': {'key': 'position', 'type': 'SpatialCoordinate'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + } + + def __init__( + self, + *, + position: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(ClosestPointResultEntry, self).__init__(**kwargs) + self.distance_in_meters = None + self.position = position + self.geometry_id = None + + +class ClosestPointSummary(msrest.serialization.Model): + """Closest Point Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + *, + source_point: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(ClosestPointSummary, self).__init__(**kwargs) + self.source_point = source_point + self.udid = None + self.information = None + + +class CollectionDefinitionResponse(msrest.serialization.Model): + """collection of GeoJSON features. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param description: describes the collection. + :type description: str + :param id_prefix: Required. prefix of the collection used. + :type id_prefix: str + :param name: Required. identifier of the collection used, for example, in URIs. + :type name: str + :param title: title of collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param geometry_type: Required. type of geometry returned. Possible values include: "Point", + "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection". + :type geometry_type: str or ~azure.maps.creator.models.GeoJsonGeometryType + :param feature_types: Required. type of features returned. + :type feature_types: list[str] + :param properties: attributes of the collection used. + :type properties: list[~azure.maps.creator.models.DefinitionProperties] + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'id_prefix': {'required': True}, + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'geometry_type': {'required': True}, + 'feature_types': {'required': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'id_prefix': {'key': 'idPrefix', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'geometry_type': {'key': 'geometryType', 'type': 'str'}, + 'feature_types': {'key': 'featureTypes', 'type': '[str]'}, + 'properties': {'key': 'properties', 'type': '[DefinitionProperties]'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + id_prefix: str, + name: str, + geometry_type: Union[str, "GeoJsonGeometryType"], + feature_types: List[str], + description: Optional[str] = None, + title: Optional[str] = None, + properties: Optional[List["DefinitionProperties"]] = None, + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(CollectionDefinitionResponse, self).__init__(**kwargs) + self.description = description + self.id_prefix = id_prefix + self.name = name + self.title = title + self.ontology = None + self.geometry_type = geometry_type + self.feature_types = feature_types + self.properties = properties + self.links = links + + +class CollectionInfo(msrest.serialization.Model): + """CollectionInfo. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. identifier of the collection used, for example, in URIs. + :type name: str + :param title: human readable title of the collection. + :type title: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param description: a description of the features in the collection. + :type description: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'name': {'required': True}, + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + name: str, + links: List["WfsEndpointLink"], + title: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(CollectionInfo, self).__init__(**kwargs) + self.name = name + self.title = title + self.ontology = None + self.description = description + self.links = links + + +class CollectionsResponse(msrest.serialization.Model): + """CollectionsResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param collections: Required. All the collections in a given dataset. + :type collections: list[~azure.maps.creator.models.CollectionInfo] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + 'collections': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'collections': {'key': 'collections', 'type': '[CollectionInfo]'}, + } + + def __init__( + self, + *, + links: List["WfsEndpointLink"], + collections: List["CollectionInfo"], + **kwargs + ): + super(CollectionsResponse, self).__init__(**kwargs) + self.ontology = None + self.links = links + self.collections = collections + + +class ConformanceResponse(msrest.serialization.Model): + """ConformanceResponse. + + All required parameters must be populated in order to send to Azure. + + :param conforms_to: Required. List of requirements classes that the server conforms to. + :type conforms_to: list[str] + """ + + _validation = { + 'conforms_to': {'required': True}, + } + + _attribute_map = { + 'conforms_to': {'key': 'conformsTo', 'type': '[str]'}, + } + + def __init__( + self, + *, + conforms_to: List[str], + **kwargs + ): + super(ConformanceResponse, self).__init__(**kwargs) + self.conforms_to = conforms_to + + +class ConversionListDetailInfo(msrest.serialization.Model): + """Detail information for the conversion requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_id: A unique id that represents the artifact of a *successfully* completed + conversion process. + :vartype conversion_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar udid: The unique id of the content provided to create this conversion. + :vartype udid: str + :ivar created: The date and time of this conversion. + :vartype created: str + :ivar description: User provided description of the content being converted. + :vartype description: str + :ivar feature_counts: A summary of feature counts in this conversion. + :vartype feature_counts: any + """ + + _validation = { + 'conversion_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'udid': {'readonly': True}, + 'created': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'conversion_id': {'key': 'conversionId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListDetailInfo, self).__init__(**kwargs) + self.conversion_id = None + self.ontology = None + self.udid = None + self.created = None + self.description = None + self.feature_counts = None + + +class ConversionListResponse(msrest.serialization.Model): + """The response model for the Conversion List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversions: A list of all the previously submitted conversion requests. + :vartype conversions: list[~azure.maps.creator.models.ConversionListDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'conversions': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'conversions': {'key': 'conversions', 'type': '[ConversionListDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ConversionListResponse, self).__init__(**kwargs) + self.conversions = None + self.next_link = None + + +class DatasetDetailInfo(msrest.serialization.Model): + """Detail information for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: The created timestamp for the dataset. + :vartype created: str + :ivar dataset_id: The id for the dataset. + :vartype dataset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar description: The description for the dataset. + :vartype description: str + :param dataset_sources: Information about the details of the create request for the dataset. + :type dataset_sources: ~azure.maps.creator.models.DatasetSources + :ivar feature_counts: The feature counts for the dataset. + :vartype feature_counts: any + """ + + _validation = { + 'created': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'description': {'readonly': True}, + 'feature_counts': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_sources': {'key': 'datasetSources', 'type': 'DatasetSources'}, + 'feature_counts': {'key': 'featureCounts', 'type': 'object'}, + } + + def __init__( + self, + *, + dataset_sources: Optional["DatasetSources"] = None, + **kwargs + ): + super(DatasetDetailInfo, self).__init__(**kwargs) + self.created = None + self.dataset_id = None + self.ontology = None + self.description = None + self.dataset_sources = dataset_sources + self.feature_counts = None + + +class DatasetListResponse(msrest.serialization.Model): + """The response model for the Dataset List API. The response body will contain a list of all the previously created datasets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar datasets: A list of all the previously created datasets. + :vartype datasets: list[~azure.maps.creator.models.DatasetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'datasets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'datasets': {'key': 'datasets', 'type': '[DatasetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetListResponse, self).__init__(**kwargs) + self.datasets = None + self.next_link = None + + +class DatasetSources(msrest.serialization.Model): + """Information about the details of the create request for the dataset. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar conversion_ids: The list of ``conversionId`` that were used to create the dataset. + :vartype conversion_ids: list[str] + :ivar append_dataset_id: The dataset that was appended to to create the current dataset. + :vartype append_dataset_id: str + """ + + _validation = { + 'conversion_ids': {'readonly': True}, + 'append_dataset_id': {'readonly': True}, + } + + _attribute_map = { + 'conversion_ids': {'key': 'conversionIds', 'type': '[str]'}, + 'append_dataset_id': {'key': 'appendDatasetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatasetSources, self).__init__(**kwargs) + self.conversion_ids = None + self.append_dataset_id = None + + +class DefinitionProperties(msrest.serialization.Model): + """DefinitionProperties. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. name of attribute. + :type name: str + :param required: Required. is attribute required. + :type required: bool + :param type: Required. type of attribute. + :type type: any + """ + + _validation = { + 'name': {'required': True}, + 'required': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + 'type': {'key': 'type', 'type': 'object'}, + } + + def __init__( + self, + *, + name: str, + required: bool, + type: Any, + **kwargs + ): + super(DefinitionProperties, self).__init__(**kwargs) + self.name = name + self.required = required + self.type = type + + +class ErrorAdditionalInfo(msrest.serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + _validation = { + 'type': {'readonly': True}, + 'info': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(msrest.serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.maps.creator.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.maps.creator.models.ErrorAdditionalInfo] + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ErrorDetail]'}, + 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(ErrorDetail, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(msrest.serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + + :param error: The error object. + :type error: ~azure.maps.creator.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +class ExtendedGeoJsonFeatureCollectionData(msrest.serialization.Model): + """ExtendedGeoJsonFeatureCollectionData. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + number_returned: Optional[int] = None, + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.ontology = None + self.number_returned = number_returned + self.links = links + + +class GeoJsonFeatureCollectionData(msrest.serialization.Model): + """GeoJsonFeatureCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + """ + + _validation = { + 'features': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + **kwargs + ): + super(GeoJsonFeatureCollectionData, self).__init__(**kwargs) + self.features = features + + +class GeoJsonObject(msrest.serialization.Model): + """A valid ``GeoJSON`` object. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonFeature, GeoJsonFeatureCollection, GeoJsonGeometry. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Feature': 'GeoJsonFeature', 'FeatureCollection': 'GeoJsonFeatureCollection', 'GeoJsonGeometry': 'GeoJsonGeometry'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonObject, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class GeoJsonFeatureCollection(GeoJsonObject, GeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ExtendedGeoJsonFeatureCollection. + + All required parameters must be populated in order to send to Azure. + + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'FeatureCollection': 'ExtendedGeoJsonFeatureCollection'} + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + **kwargs + ): + super(GeoJsonFeatureCollection, self).__init__(features=features, **kwargs) + self.features = features + self.type = 'FeatureCollection' # type: str + self.type = 'FeatureCollection' # type: str + + +class ExtendedGeoJsonFeatureCollection(GeoJsonFeatureCollection, ExtendedGeoJsonFeatureCollectionData): + """A valid ``GeoJSON FeatureCollection`` object type extended with numberReturned and links array. Please refer to `RFC 7946 `_ for details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param number_returned: Number of returned features. + :type number_returned: int + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + :param features: Required. Contains a list of valid ``GeoJSON Feature`` objects. + :type features: list[~azure.maps.creator.models.GeoJsonFeature] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'ontology': {'readonly': True}, + 'features': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'number_returned': {'key': 'numberReturned', 'type': 'int'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + 'features': {'key': 'features', 'type': '[GeoJsonFeature]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + features: List["GeoJsonFeature"], + number_returned: Optional[int] = None, + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(ExtendedGeoJsonFeatureCollection, self).__init__(features=features, number_returned=number_returned, links=links, **kwargs) + self.ontology = None + self.number_returned = number_returned + self.links = links + self.type = 'FeatureCollection' # type: str + self.features = features + self.type = 'FeatureCollection' # type: str + + +class FeatureResponse(msrest.serialization.Model): + """FeatureResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param feature: Required. A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 + `_ for details. + :type feature: ~azure.maps.creator.models.GeoJsonFeature + :param links: Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'feature': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'feature': {'key': 'feature', 'type': 'GeoJsonFeature'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + feature: "GeoJsonFeature", + links: Optional[List["WfsEndpointLink"]] = None, + **kwargs + ): + super(FeatureResponse, self).__init__(**kwargs) + self.ontology = None + self.feature = feature + self.links = links + + +class FeatureStateObject(msrest.serialization.Model): + """Single feature state model. + + :param key_name: Feature state Keyname. Maximum length allowed is 1000. + :type key_name: str + :param value: Value for the feature state. Type should comply with the style definition + attached to the featurestate. Maximum length allowed for string type is 1024. + :type value: str + :param event_timestamp: Valid Timestamp when the feature state was captured. + :type event_timestamp: str + """ + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'event_timestamp': {'key': 'eventTimestamp', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: Optional[str] = None, + value: Optional[str] = None, + event_timestamp: Optional[str] = None, + **kwargs + ): + super(FeatureStateObject, self).__init__(**kwargs) + self.key_name = key_name + self.value = value + self.event_timestamp = event_timestamp + + +class FeatureStatesStructure(msrest.serialization.Model): + """The feature states model for a feature. + + :param states: The feature states array. + :type states: list[~azure.maps.creator.models.FeatureStateObject] + """ + + _attribute_map = { + 'states': {'key': 'states', 'type': '[FeatureStateObject]'}, + } + + def __init__( + self, + *, + states: Optional[List["FeatureStateObject"]] = None, + **kwargs + ): + super(FeatureStatesStructure, self).__init__(**kwargs) + self.states = states + + +class GeofenceGeometry(msrest.serialization.Model): + """The geofencing geometry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar device_id: ID of the device. + :vartype device_id: str + :ivar ud_id: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :vartype ud_id: str + :ivar geometry_id: The unique id identifies a geometry. + :vartype geometry_id: str + :ivar distance: Distance from the coordinate to the closest border of the geofence. Positive + means the coordinate is outside of the geofence. If the coordinate is outside of the geofence, + but more than the value of searchBuffer away from the closest geofence border, then the value + is 999. Negative means the coordinate is inside of the geofence. If the coordinate is inside + the polygon, but more than the value of searchBuffer away from the closest geofencing border, + then the value is -999. A value of 999 means that there is great confidence the coordinate is + well outside the geofence. A value of -999 means that there is great confidence the coordinate + is well within the geofence. + :vartype distance: float + :ivar nearest_lat: Latitude of the nearest point of the geometry. + :vartype nearest_lat: float + :ivar nearest_lon: Longitude of the nearest point of the geometry. + :vartype nearest_lon: float + :ivar nearest_z: Sea level in meter of the nearest point on the 2D extrusion geometry. This + will only be presented in response when value is provided for 'zInMeter' in the request. + :vartype nearest_z: float + """ + + _validation = { + 'device_id': {'readonly': True}, + 'ud_id': {'readonly': True}, + 'geometry_id': {'readonly': True}, + 'distance': {'readonly': True}, + 'nearest_lat': {'readonly': True}, + 'nearest_lon': {'readonly': True}, + 'nearest_z': {'readonly': True}, + } + + _attribute_map = { + 'device_id': {'key': 'deviceId', 'type': 'str'}, + 'ud_id': {'key': 'udId', 'type': 'str'}, + 'geometry_id': {'key': 'geometryId', 'type': 'str'}, + 'distance': {'key': 'distance', 'type': 'float'}, + 'nearest_lat': {'key': 'nearestLat', 'type': 'float'}, + 'nearest_lon': {'key': 'nearestLon', 'type': 'float'}, + 'nearest_z': {'key': 'nearestZ', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceGeometry, self).__init__(**kwargs) + self.device_id = None + self.ud_id = None + self.geometry_id = None + self.distance = None + self.nearest_lat = None + self.nearest_lon = None + self.nearest_z = None + + +class GeofenceResponse(msrest.serialization.Model): + """This object is returned from a geofence proximity call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar geometries: Lists the fence geometries that contain the coordinate position or overlap + the searchBuffer around the position. + :vartype geometries: list[~azure.maps.creator.models.GeofenceGeometry] + :ivar expired_geofence_geometry_id: Lists of the geometry ID of the geofence which is expired + relative to the user time in the request. + :vartype expired_geofence_geometry_id: list[str] + :ivar invalid_period_geofence_geometry_id: Lists of the geometry ID of the geofence which is in + invalid period relative to the user time in the request. + :vartype invalid_period_geofence_geometry_id: list[str] + :ivar is_event_published: True if at least one event is published to the Azure Maps event + subscriber, false if no event is published to the Azure Maps event subscriber. This will only + be presented in response when 'isAsync' query parameter is set to true. + :vartype is_event_published: bool + """ + + _validation = { + 'geometries': {'readonly': True}, + 'expired_geofence_geometry_id': {'readonly': True}, + 'invalid_period_geofence_geometry_id': {'readonly': True}, + 'is_event_published': {'readonly': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeofenceGeometry]'}, + 'expired_geofence_geometry_id': {'key': 'expiredGeofenceGeometryId', 'type': '[str]'}, + 'invalid_period_geofence_geometry_id': {'key': 'invalidPeriodGeofenceGeometryId', 'type': '[str]'}, + 'is_event_published': {'key': 'isEventPublished', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(GeofenceResponse, self).__init__(**kwargs) + self.geometries = None + self.expired_geofence_geometry_id = None + self.invalid_period_geofence_geometry_id = None + self.is_event_published = None + + +class GeoJsonFeatureData(msrest.serialization.Model): + """GeoJsonFeatureData. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + """ + + _validation = { + 'geometry': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + } + + def __init__( + self, + *, + geometry: "GeoJsonGeometry", + properties: Optional[Any] = None, + id: Optional[str] = None, + feature_type: Optional[str] = None, + **kwargs + ): + super(GeoJsonFeatureData, self).__init__(**kwargs) + self.geometry = geometry + self.properties = properties + self.id = id + self.feature_type = feature_type + + +class GeoJsonFeature(GeoJsonObject, GeoJsonFeatureData): + """A valid ``GeoJSON Feature`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometry: Required. A valid ``GeoJSON`` geometry object. The type must be one of the + seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, + MultiPolygon and GeometryCollection. Please refer to `RFC 7946 + `_ for details. + :type geometry: ~azure.maps.creator.models.GeoJsonGeometry + :param properties: Properties can contain any additional metadata about the ``Feature``. Value + can be any JSON object or a JSON null value. + :type properties: any + :param id: Identifier for the feature. + :type id: str + :param feature_type: The type of the feature. The value depends on the data model the current + feature is part of. Some data models may have an empty value. + :type feature_type: str + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometry': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'GeoJsonGeometry'}, + 'properties': {'key': 'properties', 'type': 'object'}, + 'id': {'key': 'id', 'type': 'str'}, + 'feature_type': {'key': 'featureType', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + geometry: "GeoJsonGeometry", + properties: Optional[Any] = None, + id: Optional[str] = None, + feature_type: Optional[str] = None, + **kwargs + ): + super(GeoJsonFeature, self).__init__(geometry=geometry, properties=properties, id=id, feature_type=feature_type, **kwargs) + self.geometry = geometry + self.properties = properties + self.id = id + self.feature_type = feature_type + self.type = 'Feature' # type: str + self.type = 'Feature' # type: str + + +class GeoJsonGeometry(GeoJsonObject): + """A valid ``GeoJSON`` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to `RFC 7946 `_ for details. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: GeoJsonGeometryCollection, GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPoint, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'GeometryCollection': 'GeoJsonGeometryCollection', 'LineString': 'GeoJsonLineString', 'MultiLineString': 'GeoJsonMultiLineString', 'MultiPoint': 'GeoJsonMultiPoint', 'MultiPolygon': 'GeoJsonMultiPolygon', 'Point': 'GeoJsonPoint', 'Polygon': 'GeoJsonPolygon'} + } + + def __init__( + self, + **kwargs + ): + super(GeoJsonGeometry, self).__init__(**kwargs) + self.type = 'GeoJsonGeometry' # type: str + + +class GeoJsonGeometryCollectionData(msrest.serialization.Model): + """GeoJsonGeometryCollectionData. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + """ + + _validation = { + 'geometries': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + } + + def __init__( + self, + *, + geometries: List["GeoJsonGeometry"], + **kwargs + ): + super(GeoJsonGeometryCollectionData, self).__init__(**kwargs) + self.geometries = geometries + + +class GeoJsonGeometryCollection(GeoJsonGeometry, GeoJsonGeometryCollectionData): + """A valid ``GeoJSON GeometryCollection`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param geometries: Required. Contains a list of valid ``GeoJSON`` geometry objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type geometries: list[~azure.maps.creator.models.GeoJsonGeometry] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'geometries': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'geometries': {'key': 'geometries', 'type': '[GeoJsonGeometry]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + geometries: List["GeoJsonGeometry"], + **kwargs + ): + super(GeoJsonGeometryCollection, self).__init__(geometries=geometries, **kwargs) + self.geometries = geometries + self.type = 'GeometryCollection' # type: str + self.type = 'GeometryCollection' # type: str + + +class GeoJsonLineStringData(msrest.serialization.Model): + """GeoJsonLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonLineStringData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonLineString(GeoJsonGeometry, GeoJsonLineStringData): + """A valid ``GeoJSON LineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson LineString`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonLineString, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'LineString' # type: str + self.type = 'LineString' # type: str + + +class GeoJsonMultiLineStringData(msrest.serialization.Model): + """GeoJsonMultiLineStringData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonMultiLineStringData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiLineString(GeoJsonGeometry, GeoJsonMultiLineStringData): + """A valid ``GeoJSON MultiLineString`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiLineString`` geometry. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonMultiLineString, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiLineString' # type: str + self.type = 'MultiLineString' # type: str + + +class GeoJsonMultiPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson MultiPoint``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonMultiPointData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiPoint(GeoJsonGeometry, GeoJsonMultiPointData): + """A valid ``GeoJSON MultiPoint`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson MultiPoint`` geometry. + :type coordinates: list[list[float]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[float]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[float]], + **kwargs + ): + super(GeoJsonMultiPoint, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiPoint' # type: str + self.type = 'MultiPoint' # type: str + + +class GeoJsonMultiPolygonData(msrest.serialization.Model): + """GeoJsonMultiPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[List[float]]]], + **kwargs + ): + super(GeoJsonMultiPolygonData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonMultiPolygon(GeoJsonGeometry, GeoJsonMultiPolygonData): + """A valid ``GeoJSON MultiPolygon`` object type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Contains a list of valid ``GeoJSON Polygon`` objects. **Note** + that coordinates in GeoJSON are in x, y order (longitude, latitude). + :type coordinates: list[list[list[list[float]]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[[float]]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[List[float]]]], + **kwargs + ): + super(GeoJsonMultiPolygon, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'MultiPolygon' # type: str + self.type = 'MultiPolygon' # type: str + + +class GeoJsonPointData(msrest.serialization.Model): + """Data contained by a ``GeoJson Point``. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + } + + def __init__( + self, + *, + coordinates: List[float], + **kwargs + ): + super(GeoJsonPointData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonPoint(GeoJsonGeometry, GeoJsonPointData): + """A valid ``GeoJSON Point`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. A ``Position`` is an array of numbers with two or more elements. + The first two elements are *longitude* and *latitude*\ , precisely in that order. + *Altitude/Elevation* is an optional third element. Please refer to `RFC 7946 + `_ for details. + :type coordinates: list[float] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[float]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[float], + **kwargs + ): + super(GeoJsonPoint, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'Point' # type: str + self.type = 'Point' # type: str + + +class GeoJsonPolygonData(msrest.serialization.Model): + """GeoJsonPolygonData. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + """ + + _validation = { + 'coordinates': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonPolygonData, self).__init__(**kwargs) + self.coordinates = coordinates + + +class GeoJsonPolygon(GeoJsonGeometry, GeoJsonPolygonData): + """A valid ``GeoJSON Polygon`` geometry type. Please refer to `RFC 7946 `_ for details. + + All required parameters must be populated in order to send to Azure. + + :param coordinates: Required. Coordinates for the ``GeoJson Polygon`` geometry type. + :type coordinates: list[list[list[float]]] + :param type: Required. Specifies the ``GeoJSON`` type. Must be one of the nine valid GeoJSON + object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, + GeometryCollection, Feature and FeatureCollection.Constant filled by server. Possible values + include: "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", + "GeometryCollection", "Feature", "FeatureCollection". + :type type: str or ~azure.maps.creator.models.GeoJsonObjectType + """ + + _validation = { + 'coordinates': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'coordinates': {'key': 'coordinates', 'type': '[[[float]]]'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + coordinates: List[List[List[float]]], + **kwargs + ): + super(GeoJsonPolygon, self).__init__(coordinates=coordinates, **kwargs) + self.coordinates = coordinates + self.type = 'Polygon' # type: str + self.type = 'Polygon' # type: str + + +class GreatCircleDistanceResponse(msrest.serialization.Model): + """This object is returned from a successful Great Circle Distance call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary object. + :vartype summary: ~azure.maps.creator.models.GreatCircleDistanceResponseSummary + :ivar result: Result Object. + :vartype result: ~azure.maps.creator.models.GreatCircleDistanceResponseResult + """ + + _validation = { + 'summary': {'readonly': True}, + 'result': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'GreatCircleDistanceResponseSummary'}, + 'result': {'key': 'result', 'type': 'GreatCircleDistanceResponseResult'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponse, self).__init__(**kwargs) + self.summary = None + self.result = None + + +class GreatCircleDistanceResponseResult(msrest.serialization.Model): + """Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar distance_in_meters: The great circle distance in meters from the source point to the + target point. + :vartype distance_in_meters: float + """ + + _validation = { + 'distance_in_meters': {'readonly': True}, + } + + _attribute_map = { + 'distance_in_meters': {'key': 'distanceInMeters', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(GreatCircleDistanceResponseResult, self).__init__(**kwargs) + self.distance_in_meters = None + + +class GreatCircleDistanceResponseSummary(msrest.serialization.Model): + """Summary object. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :param target_point: A location represented as a latitude and longitude. + :type target_point: ~azure.maps.creator.models.SpatialCoordinate + """ + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'target_point': {'key': 'targetPoint', 'type': 'SpatialCoordinate'}, + } + + def __init__( + self, + *, + source_point: Optional["SpatialCoordinate"] = None, + target_point: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(GreatCircleDistanceResponseSummary, self).__init__(**kwargs) + self.source_point = source_point + self.target_point = target_point + + +class LandingPageResponse(msrest.serialization.Model): + """LandingPageResponse. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :param links: Required. Links to other WFS endpoints. + :type links: list[~azure.maps.creator.models.WfsEndpointLink] + """ + + _validation = { + 'ontology': {'readonly': True}, + 'links': {'required': True}, + } + + _attribute_map = { + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'links': {'key': 'links', 'type': '[WfsEndpointLink]'}, + } + + def __init__( + self, + *, + links: List["WfsEndpointLink"], + **kwargs + ): + super(LandingPageResponse, self).__init__(**kwargs) + self.ontology = None + self.links = links + + +class LongRunningOperationResult(msrest.serialization.Model): + """The response model for a Long-Running Operations API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param operation_id: The Id for this long-running operation. + :type operation_id: str + :ivar status: The status state of the request. Possible values include: "NotStarted", + "Running", "Failed", "Succeeded". + :vartype status: str or ~azure.maps.creator.models.LroStatus + :ivar created: The created timestamp. + :vartype created: str + :param error: The error detail. + :type error: ~azure.maps.creator.models.ErrorDetail + :param warning: The error detail. + :type warning: ~azure.maps.creator.models.ErrorDetail + """ + + _validation = { + 'status': {'readonly': True}, + 'created': {'readonly': True}, + } + + _attribute_map = { + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'created': {'key': 'created', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'warning': {'key': 'warning', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + operation_id: Optional[str] = None, + error: Optional["ErrorDetail"] = None, + warning: Optional["ErrorDetail"] = None, + **kwargs + ): + super(LongRunningOperationResult, self).__init__(**kwargs) + self.operation_id = operation_id + self.status = None + self.created = None + self.error = error + self.warning = warning + + +class MapDataDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar udid: The unique data id for the data. + :vartype udid: str + :ivar location: The location of the data. Execute a HTTP ``GET`` on this location to download + the data. + :vartype location: str + :ivar size_in_bytes: The size of the content in bytes. + :vartype size_in_bytes: long + :ivar upload_status: The current upload status of the content. + :vartype upload_status: str + :ivar data_format: The current data format. + :vartype data_format: str + :ivar description: The current description. + :vartype description: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'location': {'readonly': True}, + 'size_in_bytes': {'readonly': True}, + 'upload_status': {'readonly': True}, + 'data_format': {'readonly': True}, + 'description': {'readonly': True}, + } + + _attribute_map = { + 'udid': {'key': 'udid', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'size_in_bytes': {'key': 'sizeInBytes', 'type': 'long'}, + 'upload_status': {'key': 'uploadStatus', 'type': 'str'}, + 'data_format': {'key': 'dataFormat', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataDetailInfo, self).__init__(**kwargs) + self.udid = None + self.location = None + self.size_in_bytes = None + self.upload_status = None + self.data_format = None + self.description = None + + +class MapDataListResponse(msrest.serialization.Model): + """The response model for the Data List API. Returns a list of all the previously uploaded data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar map_data_list: A list of all the previously uploaded data. + :vartype map_data_list: list[~azure.maps.creator.models.MapDataDetailInfo] + """ + + _validation = { + 'map_data_list': {'readonly': True}, + } + + _attribute_map = { + 'map_data_list': {'key': 'mapDataList', 'type': '[MapDataDetailInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(MapDataListResponse, self).__init__(**kwargs) + self.map_data_list = None + + +class NumberRuleObject(msrest.serialization.Model): + """The numeric rule. The color is selected from the first range it falls into. + + :param range: The numeric value range for this style rule. If the value is in the range, all + the conditions must hold true. + :type range: ~azure.maps.creator.models.RangeObject + :param color: The color when value is within the range. Color is a JSON string in a variety of + permitted formats, HTML-style hex values, RGB ("#ff0", "#ffff00", "rgb(255, 255, 0)"), RGBA + ("rgba(255, 255, 0, 1)"), HSL("hsl(100, 50%, 50%)"), and HSLA("hsla(100, 50%, 50%, 1)"). + Predefined HTML colors names, like yellow and blue, are also permitted. + :type color: str + """ + + _attribute_map = { + 'range': {'key': 'range', 'type': 'RangeObject'}, + 'color': {'key': 'color', 'type': 'str'}, + } + + def __init__( + self, + *, + range: Optional["RangeObject"] = None, + color: Optional[str] = None, + **kwargs + ): + super(NumberRuleObject, self).__init__(**kwargs) + self.range = range + self.color = color + + +class NumberTypeStyleRule(StyleObject): + """The numeric type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. Numeric style rules. + :type rules: list[~azure.maps.creator.models.NumberRuleObject] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[NumberRuleObject]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List["NumberRuleObject"], + **kwargs + ): + super(NumberTypeStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'number' # type: str + self.rules = rules + + +class PointInPolygonResponse(msrest.serialization.Model): + """Returns true if point is within the polygon, false otherwise. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Point In Polygon Summary object. + :vartype summary: ~azure.maps.creator.models.PointInPolygonSummary + :param result: Point In Polygon Result Object. + :type result: ~azure.maps.creator.models.PointInPolygonResult + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'PointInPolygonSummary'}, + 'result': {'key': 'result', 'type': 'PointInPolygonResult'}, + } + + def __init__( + self, + *, + result: Optional["PointInPolygonResult"] = None, + **kwargs + ): + super(PointInPolygonResponse, self).__init__(**kwargs) + self.summary = None + self.result = result + + +class PointInPolygonResult(msrest.serialization.Model): + """Point In Polygon Result Object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar point_in_polygons: Point In Polygons Property. + :vartype point_in_polygons: bool + :ivar intersecting_geometries: Geometries array. + :vartype intersecting_geometries: list[str] + """ + + _validation = { + 'point_in_polygons': {'readonly': True}, + 'intersecting_geometries': {'readonly': True}, + } + + _attribute_map = { + 'point_in_polygons': {'key': 'pointInPolygons', 'type': 'bool'}, + 'intersecting_geometries': {'key': 'intersectingGeometries', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointInPolygonResult, self).__init__(**kwargs) + self.point_in_polygons = None + self.intersecting_geometries = None + + +class PointInPolygonSummary(msrest.serialization.Model): + """Point In Polygon Summary object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param source_point: A location represented as a latitude and longitude. + :type source_point: ~azure.maps.creator.models.SpatialCoordinate + :ivar udid: A unique data id (udid) for the uploaded content. Udid is not applicable for POST + spatial operations(set to null). + :vartype udid: str + :ivar information: Processing information. + :vartype information: str + """ + + _validation = { + 'udid': {'readonly': True}, + 'information': {'readonly': True}, + } + + _attribute_map = { + 'source_point': {'key': 'sourcePoint', 'type': 'SpatialCoordinate'}, + 'udid': {'key': 'udid', 'type': 'str'}, + 'information': {'key': 'information', 'type': 'str'}, + } + + def __init__( + self, + *, + source_point: Optional["SpatialCoordinate"] = None, + **kwargs + ): + super(PointInPolygonSummary, self).__init__(**kwargs) + self.source_point = source_point + self.udid = None + self.information = None + + +class RangeObject(msrest.serialization.Model): + """The numeric value range for this style rule. If the value is in the range, all the conditions must hold true. + + :param minimum: All the number x that x ≥ minimum. + :type minimum: float + :param maximum: All the number x that x ≤ maximum. + :type maximum: float + :param exclusive_minimum: All the number x that x > exclusiveMinimum. + :type exclusive_minimum: float + :param exclusive_maximum: All the number x that x < exclusiveMaximum. + :type exclusive_maximum: float + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'float'}, + 'maximum': {'key': 'maximum', 'type': 'float'}, + 'exclusive_minimum': {'key': 'exclusiveMinimum', 'type': 'float'}, + 'exclusive_maximum': {'key': 'exclusiveMaximum', 'type': 'float'}, + } + + def __init__( + self, + *, + minimum: Optional[float] = None, + maximum: Optional[float] = None, + exclusive_minimum: Optional[float] = None, + exclusive_maximum: Optional[float] = None, + **kwargs + ): + super(RangeObject, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.exclusive_minimum = exclusive_minimum + self.exclusive_maximum = exclusive_maximum + + +class SpatialCoordinate(msrest.serialization.Model): + """A location represented as a latitude and longitude. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lat: Latitude property. + :vartype lat: float + :ivar lon: Longitude property. + :vartype lon: float + """ + + _validation = { + 'lat': {'readonly': True}, + 'lon': {'readonly': True}, + } + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SpatialCoordinate, self).__init__(**kwargs) + self.lat = None + self.lon = None + + +class StatesetCreatedResponse(msrest.serialization.Model): + """The response model for the successful Stateset Create API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar stateset_id: The ID for the new stateset created. + :vartype stateset_id: str + """ + + _validation = { + 'stateset_id': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StatesetCreatedResponse, self).__init__(**kwargs) + self.stateset_id = None + + +class StatesetGetResponse(msrest.serialization.Model): + """The response model for the successful Stateset Get API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + *, + dataset_ids: Optional[List[str]] = None, + stateset_style: Optional["StylesObject"] = None, + **kwargs + ): + super(StatesetGetResponse, self).__init__(**kwargs) + self.description = None + self.dataset_ids = dataset_ids + self.stateset_style = stateset_style + + +class StatesetInfoObject(msrest.serialization.Model): + """The stateset information detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param stateset_id: The stateset ID of this stateset. + :type stateset_id: str + :ivar description: Description associated with the stateset. + :vartype description: str + :param dataset_ids: Dataset ID associated with the stateset. + :type dataset_ids: list[str] + :param stateset_style: The styles model. + :type stateset_style: ~azure.maps.creator.models.StylesObject + """ + + _validation = { + 'description': {'readonly': True}, + } + + _attribute_map = { + 'stateset_id': {'key': 'statesetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'dataset_ids': {'key': 'datasetIds', 'type': '[str]'}, + 'stateset_style': {'key': 'statesetStyle', 'type': 'StylesObject'}, + } + + def __init__( + self, + *, + stateset_id: Optional[str] = None, + dataset_ids: Optional[List[str]] = None, + stateset_style: Optional["StylesObject"] = None, + **kwargs + ): + super(StatesetInfoObject, self).__init__(**kwargs) + self.stateset_id = stateset_id + self.description = None + self.dataset_ids = dataset_ids + self.stateset_style = stateset_style + + +class StatesetListResponse(msrest.serialization.Model): + """The response model for the successful Stateset List API. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param statesets: A list of statesets information. + :type statesets: list[~azure.maps.creator.models.StatesetInfoObject] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'statesets': {'key': 'statesets', 'type': '[StatesetInfoObject]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + statesets: Optional[List["StatesetInfoObject"]] = None, + **kwargs + ): + super(StatesetListResponse, self).__init__(**kwargs) + self.statesets = statesets + self.next_link = None + + +class StringTypeStyleRule(StyleObject): + """The string type style rule object. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. Stateset style key name. Key names are random strings but they + should be unique inside style array. + :type key_name: str + :param type: Required. The type of stateset style.Constant filled by server. Possible values + include: "boolean", "number", "string". + :type type: str or ~azure.maps.creator.models.StyleObjectType + :param rules: Required. String style rules. + :type rules: list[dict[str, str]] + """ + + _validation = { + 'key_name': {'required': True}, + 'type': {'required': True}, + 'rules': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'rules': {'key': 'rules', 'type': '[{str}]'}, + } + + def __init__( + self, + *, + key_name: str, + rules: List[Dict[str, str]], + **kwargs + ): + super(StringTypeStyleRule, self).__init__(key_name=key_name, **kwargs) + self.type = 'string' # type: str + self.rules = rules + + +class StylesObject(msrest.serialization.Model): + """The styles model. + + :param styles: An array of stateset styles. The style rule could be a numeric or string or a + boolean type style rule. Refer to NumberRuleObject, StringRuleObject and BooleanRuleObject + definitions `here `_. + :type styles: list[~azure.maps.creator.models.StyleObject] + """ + + _attribute_map = { + 'styles': {'key': 'styles', 'type': '[StyleObject]'}, + } + + def __init__( + self, + *, + styles: Optional[List["StyleObject"]] = None, + **kwargs + ): + super(StylesObject, self).__init__(**kwargs) + self.styles = styles + + +class TilesetDetailInfo(msrest.serialization.Model): + """Detail information for the data. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tileset_id: The unique tileset id for the tileset. + :vartype tileset_id: str + :ivar ontology: The ontology version of this dataset. + :vartype ontology: str + :ivar dataset_id: The unique dataset Id used to create the tileset. + :vartype dataset_id: str + :ivar description: The description the caller provided when creating the tileset. Maximum + length 1024 characters. + :vartype description: str + :ivar min_zoom: The lowest tile zoom level tile generated for the tileset. + :vartype min_zoom: int + :ivar max_zoom: The highest tile zoom level tile generated for the tileset. + :vartype max_zoom: int + :ivar bbox: Bounding box which all features of the tileset lay within. Projection used - + EPSG:3857. Format : 'minLon, minLat, maxLon, maxLat'. + :vartype bbox: list[float] + """ + + _validation = { + 'tileset_id': {'readonly': True}, + 'ontology': {'readonly': True}, + 'dataset_id': {'readonly': True}, + 'description': {'readonly': True}, + 'min_zoom': {'readonly': True}, + 'max_zoom': {'readonly': True}, + 'bbox': {'readonly': True}, + } + + _attribute_map = { + 'tileset_id': {'key': 'tilesetId', 'type': 'str'}, + 'ontology': {'key': 'ontology', 'type': 'str'}, + 'dataset_id': {'key': 'datasetId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'min_zoom': {'key': 'minZoom', 'type': 'int'}, + 'max_zoom': {'key': 'maxZoom', 'type': 'int'}, + 'bbox': {'key': 'bbox', 'type': '[float]'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetDetailInfo, self).__init__(**kwargs) + self.tileset_id = None + self.ontology = None + self.dataset_id = None + self.description = None + self.min_zoom = None + self.max_zoom = None + self.bbox = None + + +class TilesetListResponse(msrest.serialization.Model): + """The response model for the Tileset List API. Returns a list of all tilesets. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tilesets: A list of all tilesets. + :vartype tilesets: list[~azure.maps.creator.models.TilesetDetailInfo] + :ivar next_link: If present, the location of the next page of data. + :vartype next_link: str + """ + + _validation = { + 'tilesets': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'tilesets': {'key': 'tilesets', 'type': '[TilesetDetailInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TilesetListResponse, self).__init__(**kwargs) + self.tilesets = None + self.next_link = None + + +class WfsEndpointLink(msrest.serialization.Model): + """Links to other WFS endpoints. + + All required parameters must be populated in order to send to Azure. + + :param href: Required. The link target. + :type href: str + :param rel: The relation type. + :type rel: str + :param type: A hint indicating what the media type of the result of dereferencing the link + should be. + :type type: str + :param hreflang: A hint indicating what the language of the result of dereferencing the link + should be. + :type hreflang: str + :param title: Used to label the destination of a link such that it can be used as a + human-readable identifier (e.g., a menu entry) in the language indicated by the + Content-Language header field (if present). + :type title: str + """ + + _validation = { + 'href': {'required': True}, + } + + _attribute_map = { + 'href': {'key': 'href', 'type': 'str'}, + 'rel': {'key': 'rel', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'hreflang': {'key': 'hreflang', 'type': 'str'}, + 'title': {'key': 'title', 'type': 'str'}, + } + + def __init__( + self, + *, + href: str, + rel: Optional[str] = None, + type: Optional[str] = None, + hreflang: Optional[str] = None, + title: Optional[str] = None, + **kwargs + ): + super(WfsEndpointLink, self).__init__(**kwargs) + self.href = href + self.rel = rel + self.type = type + self.hreflang = hreflang + self.title = title diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py new file mode 100644 index 000000000000..caac2ed53e58 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/__init__.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._alias_operations import AliasOperations +from ._data_operations import DataOperations +from ._dataset_operations import DatasetOperations +from ._conversion_operations import ConversionOperations +from ._feature_state_operations import FeatureStateOperations +from ._spatial_operations import SpatialOperations +from ._tileset_operations import TilesetOperations +from ._wfs_operations import WFSOperations + +__all__ = [ + 'AliasOperations', + 'DataOperations', + 'DatasetOperations', + 'ConversionOperations', + 'FeatureStateOperations', + 'SpatialOperations', + 'TilesetOperations', + 'WFSOperations', +] diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py new file mode 100644 index 000000000000..308a2fc42056 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_alias_operations.py @@ -0,0 +1,513 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AliasOperations(object): + """AliasOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create( + self, + creator_data_item_id=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AliasesCreateResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create an alias. You can also assign the alias during the create + request. An alias can reference an ID generated by a creator service, but cannot reference + another alias ID. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your alias, you will use a ``POST`` request. If you would like to assign the alias + during the creation, you will pass the ``resourceId`` query parameter. + + Create Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Create API returns a HTTP ``201 Created`` response with the alias resource in the body. + + A sample response from creating an alias: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasesCreateResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasesCreateResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasesCreateResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if creator_data_item_id is not None: + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Access-Control-Expose-Headers']=self._deserialize('str', response.headers.get('Access-Control-Expose-Headers')) + deserialized = self._deserialize('AliasesCreateResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + create.metadata = {'url': '/aliases'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AliasListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created aliases. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your aliases, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all aliases in ``json`` format. The response contains + the following details for each alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. Format yyyy-MM-ddTHH:mm:ss.sssZ + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. Format + yyyy-MM-ddTHH:mm:ss.sssZ + + + A sample response returning 2 alias resources: + + .. code-block:: json + + { + "aliases": [ + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }, + { + "createdTimestamp": "2020-02-18T19:53:33.123Z", + "aliasId": "1856dbfc-7a66-ee5a-bf8d-51dbfe1906f6", + "creatorDataItemId": null, + "lastUpdatedTimestamp": "2020-02-18T19:53:33.123Z" + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AliasListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.AliasListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AliasListResponse', pipeline_response) + list_of_elem = deserialized.aliases + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/aliases'} # type: ignore + + def assign( + self, + alias_id, # type: str + creator_data_item_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AliasListItem" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to assign an alias to reference a resource. + + Submit Assign Request + ^^^^^^^^^^^^^^^^^^^^^ + + To assign your alias to a resource, you will use a ``PUT`` request with the ``aliasId`` in the + path and the ``creatorDataItemId`` passed as a query parameter. + + Assign Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Assign API returns a HTTP ``200 OK`` response with the updated alias resource in the body, + if the alias was assigned successfully. A sample of the assign response is + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :param creator_data_item_id: The unique id that references a creator data item to be aliased. + :type creator_data_item_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.assign.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['creatorDataItemId'] = self._serialize.query("creator_data_item_id", creator_data_item_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + assign.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + def delete( + self, + alias_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a previously created alias. You can also use this API to + delete old/unused aliases to create space for new content.This API does not delete the + references resource, only the alias referencing the resource. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your alias you will issue a ``DELETE`` request where the path will contain the + ``aliasId`` of the alias to delete. + + Delete Alias Response + ^^^^^^^^^^^^^^^^^^^^^ + + The Delete API returns a HTTP ``204 No Content`` response with an empty body, if the alias was + deleted successfully. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/aliases/{aliasId}'} # type: ignore + + def get_details( + self, + alias_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AliasListItem" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch the details of a previously created alias. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details of your alias, you will issue a ``GET`` request with the ``aliasId`` in the + path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the previously created alias in ``json`` format. The response + contains the following details for the alias resource: + + .. + + createdTimestamp - The timestamp that the alias was created. + aliasId - The id for the alias. + creatorDataItemId - The id for the creator data item that this alias references (could be + null if the alias has not been assigned). + lastUpdatedTimestamp - The last time the alias was assigned to a resource. + + + Here's a sample response: + + .. code-block:: json + + { + "createdTimestamp": "2020-02-13T21:19:11.123Z", + "aliasId": "a8a4b8bb-ecf4-fb27-a618-f41721552766", + "creatorDataItemId": "e89aebb9-70a3-8fe1-32bb-1fbd0c725f14", + "lastUpdatedTimestamp": "2020-02-13T21:19:22.123Z" + }. + + :param alias_id: The unique id that references an existing alias. + :type alias_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AliasListItem, or the result of cls(response) + :rtype: ~azure.maps.creator.models.AliasListItem + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AliasListItem"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_details.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'aliasId': self._serialize.url("alias_id", alias_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('AliasListItem', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_details.metadata = {'url': '/aliases/{aliasId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py new file mode 100644 index 000000000000..2ea6834b323d --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_conversion_operations.py @@ -0,0 +1,582 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ConversionOperations(object): + """ConversionOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _convert_initial( + self, + udid, # type: str + output_ontology, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._convert_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['outputOntology'] = self._serialize.query("output_ontology", output_ontology, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _convert_initial.metadata = {'url': '/conversions'} # type: ignore + + def begin_convert( + self, + udid, # type: str + output_ontology, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Conversion API lets the caller import a set of DWG design files as a zipped `Drawing + Package `_ into Azure Maps. The `Drawing Package + `_ should first be uploaded using the `Azure Maps Data + Service `_. Once uploaded, use the ``udid`` + returned by the `Data Upload API + `_ to call this Conversion API. + + Convert DWG package + ------------------- + + The Conversion API performs a `long-running request `_. + + Debug DWG package issues + ------------------------ + + During the Conversion process, if there are any issues with the DWG package `errors and + warnings `_ are provided in the response along with a + *diagnostic package* to visualize and diagnose these issues. In case any issues are encountered + with your DWG package, the Conversion operation status process as detailed `here + `_ returns the location of the *diagnostic package* that can + be downloaded by the caller to help them visualize and diagnose these issues. The *diagnostic + package* location can be found in the properties section of the conversion operation status + response and looks like the following: + + .. code-block:: json + + { + "properties": { + "diagnosticPackageLocation": + "https://us.atlas.microsoft.com/mapdata/{DiagnosticPackageId}?api-version=1.0" + } + } + + The *diagnostic package* can be downloaded by executing a ``HTTP GET`` request on the + ``diagnosticPackageLocation``. + For more details on how to use the tool to visualize and diagnose all the errors and warnings + see `Drawing Error Visualizer `_. :code:`
` + + A conversion operation will be marked as *success* if there are zero or more warnings but will + be marked as *failed* if any errors are encountered. + + :param udid: The unique data id for the content. The ``udid`` must have been obtained from a + successful `Data Upload API + `_ call. + :type udid: str + :param output_ontology: Output ontology version. "facility-2.0" is the only supported value at + this time. Please refer to this `article + `_ for more + information about Azure Maps Creator ontologies. + :type output_ontology: str + :param description: User provided description of the content being converted. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._convert_initial( + udid=udid, + output_ontology=output_ontology, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_convert.metadata = {'url': '/conversions'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConversionListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all successful data conversions submitted + previously using the `Conversion API + `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all successful conversions you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Conversion List API returns the complete list of all conversion details in ``json`` + format.:code:`
` + + Here is a sample response returning the details of two successful conversion requests: + + :code:`
` + + .. code-block:: json + + { + "conversions": + [ + { + "conversionId": "54398242-ea6c-1f31-4fa6-79b1ae0fc24d", + "udid": "31838736-8b84-11ea-bc55-0242ac130003", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + }, + { + "conversionId": "2acf7d32-8b84-11ea-bc55-0242ac130003", + "udid": "1214bc58-8b84-11ea-bc55-0242ac1300039", + "created": "5/19/2020 9:00:00 AM +00:00", + "description": "User provided description.", + "featureCounts": { + "DIR": 1, + "LVL": 3, + "FCL": 1, + "UNIT": 150, + "CTG": 8, + "AEL": 0, + "OPN": 10 + } + } + ] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConversionListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.ConversionListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ConversionListResponse', pipeline_response) + list_of_elem = deserialized.conversions + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/conversions'} # type: ignore + + def get( + self, + conversion_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConversionListDetailInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a successful data conversion submitted previously using the + `Conversion API `_. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConversionListDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConversionListDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConversionListDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConversionListDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + def delete( + self, + conversion_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete any data conversions created previously using the + `Conversion API `_. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your conversion data you will issue a ``DELETE`` request where the path will contain + the ``conversionId`` of the data to delete. + + Conversion Delete Response + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + The Conversion Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + converted data resources were deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if no resource associated with the + passed-in ``conversionId`` is found. + + :param conversion_id: The conversion id for the content. The ``conversionId`` must have been + obtained from a successful `Conversion API + `_ call. + :type conversion_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'conversionId': self._serialize.url("conversion_id", conversion_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/conversions/{conversionId}'} # type: ignore + + def get_operation( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This path will be obtained from a call to POST /conversions. While in progress, an http200 + will be returned with no extra headers - followed by an http200 with Resource-Location header + once successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/conversions/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py new file mode 100644 index 000000000000..2152e18b8e85 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_data_operations.py @@ -0,0 +1,846 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, IO, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DataOperations(object): + """DataOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _upload_preview_initial( + self, + upload_data_format, # type: Union[str, "_models.UploadDataFormat"] + upload_content, # type: Union[IO, Any] + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/octet-stream") + accept = "application/json" + + # Construct URL + url = self._upload_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + query_parameters['dataFormat'] = self._serialize.query("upload_data_format", upload_data_format, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if header_parameters['Content-Type'].split(";")[0] in ['application/octet-stream']: + body_content_kwargs['stream_content'] = upload_content + elif header_parameters['Content-Type'].split(";")[0] in ['application/json']: + body_content = self._serialize.body(upload_content, 'object') + body_content_kwargs['content'] = body_content + else: + raise ValueError( + "The content_type '{}' is not one of the allowed values: " + "['application/octet-stream', 'application/json']".format(header_parameters['Content-Type']) + ) + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _upload_preview_initial.metadata = {'url': '/mapData'} # type: ignore + + def begin_upload_preview( + self, + upload_data_format, # type: Union[str, "_models.UploadDataFormat"] + upload_content, # type: Union[IO, Any] + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + The Data Upload API allows the caller to upload data content to the Azure Maps service. + You can use this API in a scenario like uploading a collection of Geofences in ``GeoJSON`` + format, for use in our `Azure Maps Geofencing Service + `_. + + Submit Upload Request + --------------------- + + To upload your content you will use a ``POST`` request. The request body will contain the data + to upload. The + ``dataFormat`` query parameter will contain the format for the data, the ``dataSharingLevel`` + query parameter + can contain the sharing level for the data. The ``Content-Type`` header will be set to the + content type of the + data. + + For example, to upload a collection of geofences in ``GeoJSON`` format, set the request body + to the geofence + content. Set the ``dataFormat`` query parameter to *geojson*\ , and set the ``Content-Type`` + header to either one + of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for uploading a simple Geofence represented as a circle geometry + using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The Data Upload API performs a + `long-running request `_. + + Data Upload Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param upload_data_format: Data format of the content being uploaded. + :type upload_data_format: str or ~azure.maps.creator.models.UploadDataFormat + :param upload_content: The content to upload. + :type upload_content: IO or any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: str + :keyword str content_type: Media type of the body sent to the API. Default value is "application/octet-stream". + Allowed values are: "application/octet-stream", "application/json". + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._upload_preview_initial( + upload_data_format=upload_data_format, + upload_content=upload_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_upload_preview.metadata = {'url': '/mapData'} # type: ignore + + def list_preview( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.MapDataListResponse" + """**Applies to:** see pricing `tiers `_. + + This API allows the caller to fetch a list of all content uploaded previously using the `Data + Upload API `_. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your map data content you will issue a ``GET`` request with no additional + parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The Data List API returns the complete list of all data in ``json`` format. The response + contains the following details for each data resource: + + .. + + udid - The unique data id for the data resource. + + location - The location of the data resource. Execute a HTTP ``GET`` on this location to + download the data. + + + Here's a sample response returning the ``udid`` and ``location`` of 3 data resources: + + :code:`
` + + .. code-block:: json + + { + "mapDataList": + [ + { + "udid": "9a1288fa-1858-4a3b-b68d-13a8j5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/9a1288fa-1858-4a3b-b68d-13a8j5af7d7c?api-version=1.0", + "sizeInBytes": 29920, + "uploadStatus": "Completed" + }, + { + "udid": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/8b1288fa-1958-4a2b-b68e-13a7i5af7d7c?api-version=1.0", + "sizeInBytes": 1339, + "uploadStatus": "Completed" + }, + { + "udid": "7c1288fa-2058-4a1b-b68f-13a6h5af7d7c", + "location": + "https://us.atlas.microsoft.com/mapData/7c1288fa-2058-4a1b-b68f-13a6h5af7d7c?api-version=1.0", + "sizeInBytes": 1650, + "uploadStatus": "Pending" + }] + } + + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MapDataListResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.MapDataListResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MapDataListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.list_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('MapDataListResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_preview.metadata = {'url': '/mapData'} # type: ignore + + def _update_preview_initial( + self, + unique_data_id, # type: str + update_content, # type: Any + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response)), + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_preview_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if upload_data_description is not None: + query_parameters['description'] = self._serialize.query("upload_data_description", upload_data_description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(update_content, 'object') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _update_preview_initial.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def begin_update_preview( + self, + unique_data_id, # type: str + update_content, # type: Any + upload_data_description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + The Data Update API allows the caller to update a previously uploaded data content. + + You can use this API in a scenario like adding or removing geofences to or from an existing + collection of geofences. + Geofences are uploaded using the `Data Upload API + `_\ , for + use in the `Azure Maps Geofencing Service `_. + + Please note that the Update API will *replace* and *override* the existing data content. + + Submit Update Request + --------------------- + + To update your content you will use a ``PUT`` request. The request body will contain the new + data that will replace + the existing data. The ``Content-Type`` header will be set to the content type of the data, and + the path will contain + the ``udid`` of the data to be update. + + For example, to update a collection of geofences that were previously uploaded using the Upload + API, place the new + geofence content in the request body. Set the ``udid`` parameter in the path to the ``udid`` of + the data received + previously in the upload API response. And set the ``Content-Type`` header to one of the + following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Here's a sample request body for updating a simple Geofence. It's represented as a circle + geometry using a center + point and a radius. The sample below is in ``GeoJSON``\ : + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + } + + The previously uploaded geofence had a radius of 100m. The above request will update it to + 500m. + + The Data Update API performs a + `long-running request `_. + + Data Update Limits + ------------------ + + Please, be aware that currently every Azure Maps account has a `data storage limit + `_. + Once the storage limit is reached, all the new upload API calls will return a ``409 Conflict`` + http error response. + You can always use the `Data Delete API + `_ to + delete old/unused content and create space for new uploads. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :param update_content: The new content that will update/replace the previously uploaded + content. + :type update_content: any + :param upload_data_description: The description to be given to the upload. + :type upload_data_description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_preview_initial( + unique_data_id=unique_data_id, + update_content=update_content, + upload_data_description=upload_data_description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def download_preview( + self, + unique_data_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> IO + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to download a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like downloading an existing collection of geofences + uploaded previously using the `Data Upload API + `_ for use in our + `Azure Maps Geofencing Service `_. + + Submit Download Request + ^^^^^^^^^^^^^^^^^^^^^^^ + + To download your content you will use a ``GET`` request where the path will contain the + ``udid`` of the data to download. Optionally, you can also pass in an ``Accept`` header to + specify a preference for the ``Content-Type`` of the data response. :code:`
` + For example, to download a collection of geofences previously uploaded using the Upload API, + set the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response and set the ``Accept`` header to either one of the following media types: + + + * ``application/json`` + * ``application/vnd.geo+json`` + * ``application/octet-stream`` + + Download Data Response + ^^^^^^^^^^^^^^^^^^^^^^ + + The Download API will return a HTTP ``200 OK`` response if the data resource with the passed-in + ``udid`` is found, where the response body will contain the content of the data + resource.:code:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found.:code:`
` + + Here's a sample response body for a simple geofence represented in ``GeoJSON`` uploaded + previously using the Upload API: + :code:`
` + + .. code-block:: json + + { + "type": "FeatureCollection", + "features": [{ + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [-122.126986, 47.639754] + }, + "properties": { + "geometryId": "001", + "radius": 500 + } + }] + }. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json, application/vnd.geo+json, application/octet-stream" + + # Construct URL + url = self.download_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + download_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def delete_preview( + self, + unique_data_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + This API allows the caller to delete a previously uploaded data content.:code:`
`\ + :raw-html-m2r:`
` + You can use this API in a scenario like removing geofences previously uploaded using the `Data + Upload API `_ for use + in our `Azure Maps Geofencing Service + `_. You can also use this API to delete + old/unused uploaded content and create space for new content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``udid`` of the data to delete.:code:`
`\ :raw-html-m2r:`
` + For example, to delete a collection of geofences previously uploaded using the Upload API, set + the ``udid`` parameter in the path to the ``udid`` of the data received previously in the + upload API response. + + Delete Data Response + ^^^^^^^^^^^^^^^^^^^^ + + The Data Delete API returns a HTTP ``204 No Content`` response with an empty body, if the data + resource was deleted successfully.:code:`
`\ :raw-html-m2r:`
` + A HTTP ``400 Bad Request`` error response will be returned if the data resource with the + passed-in ``udid`` is not found. + + :param unique_data_id: The unique data id for the content. The ``udid`` must have been obtained + from a successful `Data Upload API + `_ call. + :type unique_data_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'udid': self._serialize.url("unique_data_id", unique_data_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_preview.metadata = {'url': '/mapData/{udid}'} # type: ignore + + def get_operation_preview( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This path will be obtained from a call to POST /mapData. While in progress, an http200 will be + returned with no extra headers - followed by an http200 with Resource-Location header once + completed. + + :param operation_id: The ID to query the status for the data upload request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation_preview.metadata = {'url': '/mapData/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py new file mode 100644 index 000000000000..0f094e759bc5 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_dataset_operations.py @@ -0,0 +1,637 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DatasetOperations(object): + """DatasetOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_initial( + self, + conversion_id, # type: str + dataset_id=None, # type: Optional[str] + description_dataset=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['conversionId'] = self._serialize.query("conversion_id", conversion_id, 'str') + if dataset_id is not None: + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description_dataset is not None: + query_parameters['description'] = self._serialize.query("description_dataset", description_dataset, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/datasets'} # type: ignore + + def begin_create( + self, + conversion_id, # type: str + dataset_id=None, # type: Optional[str] + description_dataset=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to create a dataset from data that was uploaded to the Azure Maps + Data Service and converted using the Azure Maps Conversion Service. + + You can use this API in a scenario like uploading a DWG zip package for a building, converting + the zip package using the Azure Maps Conversion Service, and creating a dataset from the + converted zip package. The created dataset can be used to create tilesets using the Azure Maps + Tileset Service and can be queried via the Azure Maps WFS Service. + + Submit Create Request + ^^^^^^^^^^^^^^^^^^^^^ + + To create your dataset, you will use a ``POST`` request where the ``conversionId`` query + parameter is an ID that represents the converted DWG zip package, the ``datasetId`` parameter + will be the ID of a previously created dataset to append with the current dataset and, + optionally, the ``description`` query parameter will contain a description (if description is + not provided a default description will be given). + + The Create API is a `long-running request `_. + + :param conversion_id: The unique ID used to create the dataset. The ``conversionId`` must have + been obtained from a successful call to the Conversion Service Convert API and may be provided + with multiple query parameters with same name (if more than one is provided). + :type conversion_id: str + :param dataset_id: The ID for the dataset to append with. The dataset must originate from a + previous dataset creation call that matches the datasetId. + :type dataset_id: str + :param description_dataset: The description to be given to the dataset. + :type description_dataset: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + conversion_id=conversion_id, + dataset_id=dataset_id, + description_dataset=description_dataset, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/datasets'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatasetListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created datasets. + + Submit List Request + ^^^^^^^^^^^^^^^^^^^ + + To list all your datasets, you will issue a ``GET`` request with no additional parameters. + + List Data Response + ^^^^^^^^^^^^^^^^^^ + + The List API returns the complete list of all datasets in ``json`` format. The response + contains the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of 3 dataset resources: + + .. code-block:: json + + { + "datasets": [ + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }, + { + "timestamp": "2020-01-01T22:57:53.123Z", + "datasetId": "8b1288fa-1958-4a2b-b68e-13a7i5af7d7c", + "description": "Create from upload '0c1288fa-2058-4a1b-b68d-13a5f5af7d7c'.", + "datasetSources": { + "conversionIds": [ + "0c1288fa-2058-4a1b-b68d-13a5f5af7d7c" + ], + "appendDatasetId": "46d1edb6-d29e-4786-9589-dbd4efd7a977" + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + } + ] + }. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatasetListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.DatasetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DatasetListResponse', pipeline_response) + list_of_elem = deserialized.datasets + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/datasets'} # type: ignore + + def get( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DatasetDetailInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a previously successfully created dataset. + + Submit Get Details Request + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + To get the details for a previously created dataset, you will issue a ``GET`` request with the + ``datasetId`` in the path. + + Get Details Response + ^^^^^^^^^^^^^^^^^^^^ + + The Get Details API returns the details for a dataset in ``json`` format. The response contains + the following fields (if they are not null or empty): + + .. + + created - The timestamp the dataset was created. + datasetId - The id for the dataset. + description - The description for the dataset. + datasetSources - The source data that was used when the create request was issued. + ontology - The source `ontology + `_ that was used + in the conversion service for the input data.:code:`
` + + + The ``datasetSources`` describes the source data that was used when the create request was + issued and contains the following elements (if they are not null or empty): + + .. + + conversionIds - The list of ``conversionId`` (null if none were provided). + appendDatasetId - The ``datasetId`` that was used for an append operation (null if none was + used). + featureCounts - The counts for each feature type in the dataset.:code:`
` + + + Here's a sample response returning the ``timestamp``\ , ``datasetId``\ , ``description``\ , + ``datasetSources``\ , and ``ontology`` of a dataset resource: + + .. code-block:: json + + { + "timestamp": "2020-01-01T22:50:48.123Z", + "datasetId": "f6495f62-94f8-0ec2-c252-45626f82fcb2", + "description": "Some description or comment for the dataset.", + "datasetSources": { + "conversionIds": [ + "15d21452-c9bb-27b6-5e79-743ca5c3205d" + ], + }, + "ontology": "facility-2.0", + "featureCounts": { + "directoryInfo": 2, + "category": 10, + "facility": 1, + "level": 3, + "unit": 183, + "zone": 3, + "verticalPenetration": 6, + "opening": 48, + "areaElement": 108 + } + }. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DatasetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.DatasetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatasetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DatasetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + def delete( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + You can also use this API to delete old/unused datasets to create space for new Creator + content. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``datasetId`` of the dataset to delete. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/datasets/{datasetId}'} # type: ignore + + def get_operation( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This API allows the caller to view the current progress of a dataset operation and the path is + obtained from a call to the Create API. + + Submit Operations Request + ^^^^^^^^^^^^^^^^^^^^^^^^^ + + To view the current progress of a dataset operation, you will use a ``GET`` request where the + ``operationId`` given the path is the ID that represents the operation. + + Operation Response + ^^^^^^^^^^^^^^^^^^ + + While in progress, a ``200-OK`` http status code will be returned with no extra headers. If the + operation succeeds, a ``200-OK`` http status code with Resource-Location header will be + returned. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/datasets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py new file mode 100644 index 000000000000..81e74510163d --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_feature_state_operations.py @@ -0,0 +1,632 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class FeatureStateOperations(object): + """FeatureStateOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_stateset( + self, + dataset_id, # type: str + stateset_create_request_body, # type: "_models.StylesObject" + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.StatesetCreatedResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This POST API allows the user to create a new Stateset and define stateset style using request + body. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. The Feature State API is part of Creator. + + The Feature State service allows the user to update the states of a feature and query them to + be used in other services. The dynamic properties of a feature that don't belong to the dataset + are referred to as *states* here. + + This Feature State service pivot on the Stateset. Like Tileset, Stateset encapsulates the + storage mechanism for feature states for a dataset. + + Once the stateset is created, users can use that statesetId to post feature state updates and + retrieve the current feature states. A feature can have only one state at a given point in + time. + + Feature state is defined by the key name, value and the timestamp. When a feature state update + is posted to Azure Maps, the state value gets updated only if the provided state’s timestamp is + later than the stored timestamp. + + Azure Maps MapControl provides a way to use these feature states to style the features. Please + refer to the State Tile documentation for more information. + + :param dataset_id: The datasetId must have been obtained from a successful `Dataset Create API + `_ call. + :type dataset_id: str + :param stateset_create_request_body: The stateset style JSON data. + :type stateset_create_request_body: ~azure.maps.creator.models.StylesObject + :param description: Description for the stateset. Max length allowed is 1000. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetCreatedResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetCreatedResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetCreatedResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(stateset_create_request_body, 'StylesObject') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetCreatedResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def list_stateset( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StatesetListResponse"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all previously successfully created statesets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StatesetListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.StatesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('StatesetListResponse', pipeline_response) + list_of_elem = deserialized.statesets + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_stateset.metadata = {'url': '/featureStateSets'} # type: ignore + + def put_stateset( + self, + stateset_id, # type: str + stateset_style_update_request_body, # type: "_models.StylesObject" + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the stateset style rules. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param stateset_style_update_request_body: The stateset style JSON data. Only style rules are + allowed to be updated, update on keyname and type is not allowed. + :type stateset_style_update_request_body: ~azure.maps.creator.models.StylesObject + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(stateset_style_update_request_body, 'StylesObject') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + put_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def delete_stateset( + self, + stateset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This DELETE API allows the user to delete the stateset and the associated data. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def get_stateset( + self, + stateset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.StatesetGetResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This GET API allows the user to get the stateset Information. + + The stateset Information includes the datasetId associated to the stateset, and the styles of + that stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StatesetGetResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.StatesetGetResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StatesetGetResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_stateset.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('StatesetGetResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_stateset.metadata = {'url': '/featureStateSets/{statesetId}'} # type: ignore + + def update_states( + self, + stateset_id, # type: str + feature_id, # type: str + feature_state_update_request_body, # type: "_models.FeatureStatesStructure" + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This PUT API allows the user to update the state of the given feature in the given stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given dataset. If the featureId is not present in + the dataset, Bad Request response will be returned. + :type feature_id: str + :param feature_state_update_request_body: The feature state JSON data. A feature can have only + one state at a given point in time. The specified state keyname must have been defined during + the stateset creation. + :type feature_state_update_request_body: ~azure.maps.creator.models.FeatureStatesStructure + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(feature_state_update_request_body, 'FeatureStatesStructure') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + update_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + def delete_state( + self, + stateset_id, # type: str + feature_id, # type: str + state_key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API deletes the state information identified by the StateKeyName parameter for the + feature identified by the FeatureId parameter in the the stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :param state_key_name: The Name of the state to be deleted. + :type state_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_state.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['stateKeyName'] = self._serialize.query("state_key_name", state_key_name, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_state.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore + + def get_states( + self, + stateset_id, # type: str + feature_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.FeatureStatesStructure" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API returns the current state information associated with the given feature in the given + stateset. + + :param stateset_id: The stateset id that was created. + :type stateset_id: str + :param feature_id: The id of a feature in the given stateset. If no state was set for the + featureId in the stateset earlier, Bad Request response will be returned. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureStatesStructure, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureStatesStructure + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureStatesStructure"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_states.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'statesetId': self._serialize.url("stateset_id", stateset_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureStatesStructure', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_states.metadata = {'url': '/featureStateSets/{statesetId}/featureStates/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py new file mode 100644 index 000000000000..afd332d5b304 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_spatial_operations.py @@ -0,0 +1,957 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import datetime +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SpatialOperations(object): + """SpatialOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_geofence( + self, + format, # type: Union[str, "_models.ResponseFormat"] + device_id, # type: str + udid, # type: str + latitude, # type: float + longitude, # type: float + z=None, # type: Optional[float] + user_time=None, # type: Optional[datetime.datetime] + search_buffer=None, # type: Optional[float] + is_async=None, # type: Optional[bool] + mode=None, # type: Optional[Union[str, "_models.GeofenceMode"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GeofenceResponse" + """**Search Geofence Get API** + + **Applies to:** S1 Pricing tier. + + The Geofence Get API allows you to retrieve the proximity of a coordinate to a + geofence that has been uploaded to the Data service. You can use the + `Data Upload API `_ to + upload + a geofence or set of fences. See `Geofencing GeoJSON data + `_ + for more details on the geofence data format. To query the proximity of a coordinate, you + supply the location of the object you are tracking as well + as the ID for the fence or set of fences, and the response will contain information about + the distance from the outer edge of the geofence. A negative value signifies that the + coordinate is inside of the fence while a positive value means that it is outside of the + fence.:code:`
`:code:`
`This API can be used for a variety of scenarios that include + things like asset + tracking, fleet management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + To test this API, you can upload the sample data from Post Geofence API examples(Request Body) + via Data Upload API and replace the [udid] from the sample request below with the udid returned + by Data Upload API. + + Geofencing InnerError code + ^^^^^^^^^^^^^^^^^^^^^^^^^^ + + In geofencing response error contract, ``innererror`` is an object containing service specific + information about the error. ``code`` is a property in ``innererror`` which can map to a + specific geofencing error type. The table belows shows the code mapping between all the known + client error type to the corresponding geofencing error ``message``. + + .. list-table:: + :header-rows: 1 + + * - innererror.code + - error.message + * - NullDeviceId + - Device Id should not be null. + * - NullUdid + - Udid should not be null. + * - UdidWrongFormat + - Udid should be acquired from user data ingestion API. + * - InvalidUserTime + - Usertime is invalid. + * - InvalidSearchBuffer + - Searchbuffer is invalid. + * - InvalidSearchRange + - The value range of searchbuffer should be from 0 to 500 meters. + * - InvalidLatLon + - Lat and/or lon parameters are invalid. + * - InvalidIsAsyncValue + - The IsAsync parameter is invalid. + * - InvalidModeValue + - The mode parameter invalid. + * - InvalidJson + - Geofencing data is not a valid json file. + * - NotSupportedGeoJson + - Geofencing data can't be read as a Feature or FeatureCollections. + * - InvalidGeoJson + - Geofencing data is invalid. + * - NoUserDataWithAccountOrSubscription + - Can't find user geofencing data with provided account-id and/or subscription-id. + * - NoUserDataWithUdid + - Can't find user geofencing data with provided udid. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion is used. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.Now. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + def post_geofence( + self, + format, # type: Union[str, "_models.ResponseFormat"] + device_id, # type: str + latitude, # type: float + longitude, # type: float + search_geofence_request_body, # type: "_models.GeoJsonFeatureCollection" + z=None, # type: Optional[float] + user_time=None, # type: Optional[datetime.datetime] + search_buffer=None, # type: Optional[float] + is_async=None, # type: Optional[bool] + mode=None, # type: Optional[Union[str, "_models.GeofenceMode"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GeofenceResponse" + """**Search Geofence Post API** + **Applies to:** S1 Pricing tier. + The Geofence Post API allows you to retrieve the proximity of a coordinate to a provided + geofence or set of fences. With POST call, you do not have to upload the fence data in advance, + instead you supply the location of the object you are tracking in query parameters as well as + the fence or set of fences data in post request body. See `Geofencing GeoJSON data + `_ for more details on the + geofence data format. The response will contain information about the distance from the outer + edge of the geofence. A negative value signifies that the coordinate is inside of the fence + while a positive value means that it is outside of the fence.:code:`
`:code:`
`This API + can be used for a variety of scenarios that include things like asset tracking, fleet + management, or setting up alerts for moving objects. + + The API supports `integration with Event Grid + `_. The isAsync + parameter is used to enable integration with Event Grid (disabled by default). + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param device_id: ID of the device. + :type device_id: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param search_geofence_request_body: The geofencing GeoJSON data. + :type search_geofence_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param z: The sea level in meter of the location being passed. If this parameter is presented, + 2D extrusion geofencing is applied. Example: 200. + :type z: float + :param user_time: The user request time. If not presented in the request, the default value is + DateTime.UtcNow. + :type user_time: ~datetime.datetime + :param search_buffer: The radius of the buffer around the geofence in meters that defines how + far to search inside and outside the border of the fence against the coordinate that was + provided when calculating the result. The minimum value is 0, and the maximum is 500. The + default value is 50. + :type search_buffer: float + :param is_async: If true, the request will use async event mechanism; if false, the request + will be synchronized and do not trigger any event. The default value is false. + :type is_async: bool + :param mode: Mode of the geofencing async event mechanism. + :type mode: str or ~azure.maps.creator.models.GeofenceMode + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeofenceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GeofenceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeofenceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_geofence.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['deviceId'] = self._serialize.query("device_id", device_id, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if z is not None: + query_parameters['z'] = self._serialize.query("z", z, 'float') + if user_time is not None: + query_parameters['userTime'] = self._serialize.query("user_time", user_time, 'iso-8601') + if search_buffer is not None: + query_parameters['searchBuffer'] = self._serialize.query("search_buffer", search_buffer, 'float', maximum=500, minimum=0) + if is_async is not None: + query_parameters['isAsync'] = self._serialize.query("is_async", is_async, 'bool') + if mode is not None: + query_parameters['mode'] = self._serialize.query("mode", mode, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_geofence_request_body, 'GeoJsonFeatureCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['X-Correlation-id']=self._deserialize('str', response.headers.get('X-Correlation-id')) + deserialized = self._deserialize('GeofenceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + post_geofence.metadata = {'url': '/spatial/geofence/{format}'} # type: ignore + + def post_buffer( + self, + format, # type: Union[str, "_models.ResponseFormat"] + buffer_request_body, # type: "_models.BufferRequestBody" + **kwargs # type: Any + ): + # type: (...) -> "_models.BufferResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input may contain a collection of Point, MultiPoint, Polygon, + MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if provided. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param buffer_request_body: The FeatureCollection and the list of distances (one per feature or + one for all features). + :type buffer_request_body: ~azure.maps.creator.models.BufferRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(buffer_request_body, 'BufferRequestBody') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + def get_buffer( + self, + format, # type: Union[str, "_models.ResponseFormat"] + udid, # type: str + distances, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BufferResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a FeatureCollection where each Feature is a buffer around the corresponding + indexed Feature of the input. The buffer could be either on the outside or the inside of the + provided Feature, depending on the distance provided in the input. There must be either one + distance provided per Feature in the FeatureCollection input, or if only one distance is + provided, then that distance is applied to every Feature in the collection. The positive (or + negative) buffer of a geometry is defined as the Minkowski sum (or difference) of the geometry + with a circle of radius equal to the absolute value of the buffer distance. The buffer API + always returns a polygonal result. The negative or zero-distance buffer of lines and points is + always an empty polygon. The input features are provided by a GeoJSON file which is uploaded + via `Data Upload API `_ and + referenced by a unique udid. The GeoJSON file may contain a collection of Point, MultiPoint, + Polygon, MultiPolygon, LineString and MultiLineString. GeometryCollection will be ignored if + provided. + + To test this API, you can upload the sample data from `Post Buffer API + `_ examples(Request + Body without distances array) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the udid + returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param distances: The list of distances (one per feature or one for all features), delimited by + semicolons. For example, 12.34;-56.78. Positive distance will generate a buffer outside of the + feature, whereas negative distance will generate a buffer inside of the feature. If the + negative distance larger than the geometry itself, an empty polygon will be returned. + :type distances: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BufferResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.BufferResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BufferResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_buffer.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['distances'] = self._serialize.query("distances", distances, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BufferResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_buffer.metadata = {'url': '/spatial/buffer/{format}'} # type: ignore + + def post_closest_point( + self, + format, # type: Union[str, "_models.ResponseFormat"] + latitude, # type: float + longitude, # type: float + closest_point_request_body, # type: "_models.GeoJsonFeatureCollection" + number_of_closest_points=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.ClosestPointResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of target points. The + set of target points is provided by user data in post request body. The user data may only + contain a collection of Point geometry. MultiPoint or other geometries will be ignored if + provided. The algorithm does not take into account routing or traffic. The maximum number of + points accepted is 100,000. Information returned includes closest point latitude, longitude, + and distance in meters from the closest point. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param closest_point_request_body: The FeatureCollection of Point geometries from which closest + point to source point should be determined. All the feature's properties should contain + ``geometryId``\ , which is used for identifying the geometry and is case-sensitive. + :type closest_point_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(closest_point_request_body, 'GeoJsonFeatureCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + def get_closest_point( + self, + format, # type: Union[str, "_models.ResponseFormat"] + udid, # type: str + latitude, # type: float + longitude, # type: float + number_of_closest_points=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.ClosestPointResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns the closest point between a base point and a given set of points in the user + uploaded data set identified by udid. The set of target points is provided by a GeoJSON file + which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may only contain a collection of Point geometry. MultiPoint or + other geometries will be ignored if provided. The maximum number of points accepted is 100,000. + The algorithm does not take into account routing or traffic. Information returned includes + closest point latitude, longitude, and distance in meters from the closest point. + + To test this API, you can upload the sample data from `Post Closest Point API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param number_of_closest_points: The number of closest points expected from response. Default: + 1, minimum: 1 and maximum: 50. + :type number_of_closest_points: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ClosestPointResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ClosestPointResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClosestPointResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_closest_point.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + if number_of_closest_points is not None: + query_parameters['numberOfClosestPoints'] = self._serialize.query("number_of_closest_points", number_of_closest_points, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ClosestPointResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_closest_point.metadata = {'url': '/spatial/closestPoint/{format}'} # type: ignore + + def post_point_in_polygon( + self, + format, # type: Union[str, "_models.ResponseFormat"] + latitude, # type: float + longitude, # type: float + point_in_polygon_request_body, # type: "_models.GeoJsonFeatureCollection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PointInPolygonResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + user data may contain Polygon and MultiPolygon geometries, other geometries will be ignored if + provided. If the point is inside or on the boundary of one of these polygons, the value + returned is true. In all other cases, the value returned is false. When the point is inside + multiple polygons, the result will give intersecting geometries section to show all valid + geometries (referenced by geometryId) in user data. The maximum number of vertices accepted to + form a Polygon is 10,000. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :param point_in_polygon_request_body: A FeatureCollection with a set of Polygon/MultiPolygon + geometries. The maximum number of vertices accepted to form a Polygon is 10,000. All the + feature's properties should contain ``geometryId``\ , which is used for identifying the + geometry and is case-sensitive. + :type point_in_polygon_request_body: ~azure.maps.creator.models.GeoJsonFeatureCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.post_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(point_in_polygon_request_body, 'GeoJsonFeatureCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + def get_point_in_polygon( + self, + format, # type: Union[str, "_models.ResponseFormat"] + udid, # type: str + latitude, # type: float + longitude, # type: float + **kwargs # type: Any + ): + # type: (...) -> "_models.PointInPolygonResponse" + """**Applies to**\ : S1 pricing tier. + + This API returns a boolean value indicating whether a point is inside a set of polygons. The + set of polygons is provided by a GeoJSON file which is uploaded via `Data Upload API + `_ and referenced by a + unique udid. The GeoJSON file may contain Polygon and MultiPolygon geometries, other geometries + will be ignored if provided. If the point is inside or on the boundary of one of these + polygons, the value returned is true. In all other cases, the value returned is false. When the + point is inside multiple polygons, the result will give intersecting geometries section to show + all valid geometries(referenced by geometryId) in user data. The maximum number of vertices + accepted to form a Polygon is 10,000. + + To test this API, you can upload the sample data from `Post Point In Polygon API + `_ + examples(Request Body) via `Data Upload API + `_ and replace the [udid] + from the `sample request below + `_ with the + udid returned by Data Upload API. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param udid: The unique id returned from `Data Upload API + `_ after uploading a valid + GeoJSON FeatureCollection object. Please refer to `RFC 7946 + `_ for details. All the feature's properties + should contain ``geometryId``\ , which is used for identifying the geometry and is + case-sensitive. + :type udid: str + :param latitude: The latitude of the location being passed. Example: 48.36. + :type latitude: float + :param longitude: The longitude of the location being passed. Example: -124.63. + :type longitude: float + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointInPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.PointInPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointInPolygonResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_point_in_polygon.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['udid'] = self._serialize.query("udid", udid, 'str') + query_parameters['lat'] = self._serialize.query("latitude", latitude, 'float') + query_parameters['lon'] = self._serialize.query("longitude", longitude, 'float') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointInPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_point_in_polygon.metadata = {'url': '/spatial/pointInPolygon/{format}'} # type: ignore + + def get_great_circle_distance( + self, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GreatCircleDistanceResponse" + """**Applies to**\ : S1 pricing tier. + + This API will return the great-circle or shortest distance between two points on the surface of + a sphere, measured along the surface of the sphere. This differs from calculating a straight + line through the sphere's interior. This method is helpful for estimating travel distances for + airplanes by calculating the shortest distance between airports. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.creator.models.ResponseFormat + :param query: The Coordinates through which the distance is calculated, delimited by a colon. + Two coordinates are required. The first one is the source point coordinate and the last is the + target point coordinate. For example, 47.622942,122.316456:57.673988,127.121513. + :type query: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GreatCircleDistanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.GreatCircleDistanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GreatCircleDistanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/json" + + # Construct URL + url = self.get_great_circle_distance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GreatCircleDistanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_great_circle_distance.metadata = {'url': '/spatial/greatCircleDistance/{format}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py new file mode 100644 index 000000000000..48d47c345824 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_tileset_operations.py @@ -0,0 +1,511 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class TilesetOperations(object): + """TilesetOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_initial( + self, + dataset_id, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LongRunningOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LongRunningOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self._create_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['datasetId'] = self._serialize.query("dataset_id", dataset_id, 'str') + if description is not None: + query_parameters['description'] = self._serialize.query("description", description, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + deserialized = None + if response.status_code == 200: + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if response.status_code == 202: + response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _create_initial.metadata = {'url': '/tilesets'} # type: ignore + + def begin_create( + self, + dataset_id, # type: str + description=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LongRunningOperationResult"] + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. + + The Tileset Create API allows the caller to create a tileset from a dataset. A tileset contains + a set of tiles that can be consumed + from the `Get Map Tile `_ to retrieve custom tiles. To make a + dataset, use the + `DataSet Create API `_. + + Submit Create Request + --------------------- + + To create your tileset you will make a ``POST`` request with an empty body. The ``datasetId`` + query parameter will be + used as the source of the tileset data. + + The Create Tileset API is a + `long-running request `_. + + :param dataset_id: The unique ``datasetId`` that the tileset create API uses to retrieve + features to generate tiles. The ``datasetId`` must have been obtained from a successful + `Dataset Create API `_ call. + :type dataset_id: str + :param description: User provided description of the tileset. + :type description: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be LROBasePolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either LongRunningOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.creator.models.LongRunningOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + dataset_id=dataset_id, + description=description, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + + if polling is True: polling_method = LROBasePolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/tilesets'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TilesetListResponse"] + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a list of all tilesets created.\ :raw-html-m2r:`
` + :code:`
`. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either TilesetListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.maps.creator.models.TilesetListResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TilesetListResponse', pipeline_response) + list_of_elem = deserialized.tilesets + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/tilesets'} # type: ignore + + def get( + self, + tileset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TilesetDetailInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to fetch a tileset. + + :param tileset_id: The Tileset Id. + :type tileset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TilesetDetailInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.TilesetDetailInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TilesetDetailInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TilesetDetailInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + def delete( + self, + tileset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """.. role:: raw-html-m2r(raw) + :format: html + + + **Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + This API allows the caller to delete a created tileset.:code:`
`\ :raw-html-m2r:`
` + You can use this API if a tileset is no longer needed. + + Submit Delete Request + ^^^^^^^^^^^^^^^^^^^^^ + + To delete your content you will issue a ``DELETE`` request where the path will contain the + ``tilesetId`` of the tileset to delete.:code:`
` + + Delete request "Successful" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + The Tileset Delete API returns a HTTP ``204 No Content`` response with an empty body, if the + tileset was deleted successfully.:code:`
` + + Delete request "Failed" + ~~~~~~~~~~~~~~~~~~~~~~~ + + A HTTP ``400 Bad Request`` error response will be returned if the tileset with the passed-in + ``tilesetId`` is not found. + + Here is a sample error response: + + :code:`
` + + .. code-block:: json + + { + "error": { + "code": "400 BadRequest", + "message": "Bad request - Tileset Id: d85b5b27-5fc4-4599-8b50-47160e90f8ce does not + exist." + } + }. + + :param tileset_id: The Tileset Id. + :type tileset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'tilesetId': self._serialize.url("tileset_id", tileset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/tilesets/{tilesetId}'} # type: ignore + + def get_operation( + self, + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LongRunningOperationResult" + """This path will be obtained from a call to /tilesets/create. While in progress, an http200 will + be returned with no extra headers - followed by an http200 with Resource-Location header once + successfully completed. + + :param operation_id: The ID to query the status for the dataset create/import request. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Resource-Location']=self._deserialize('str', response.headers.get('Resource-Location')) + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_operation.metadata = {'url': '/tilesets/operations/{operationId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py new file mode 100644 index 000000000000..56768e824f57 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/operations/_wfs_operations.py @@ -0,0 +1,684 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class WFSOperations(object): + """WFSOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.maps.creator.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get_landing_page( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.LandingPageResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Landing Page API provides links to the API definition, the Conformance statements and + the metadata about the feature data in this dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LandingPageResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.LandingPageResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LandingPageResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_landing_page.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LandingPageResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_landing_page.metadata = {'url': '/wfs/datasets/{datasetId}/'} # type: ignore + + def get_conformance( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConformanceResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Requirements Classes lists all requirements classes specified in the standard that the + server conforms to. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConformanceResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ConformanceResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConformanceResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_conformance.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ConformanceResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_conformance.metadata = {'url': '/wfs/datasets/{datasetId}/conformance'} # type: ignore + + def get_collections( + self, + dataset_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CollectionsResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Collections Description API provides descriptions of all the collections in a given + dataset. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionsResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collections.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collections.metadata = {'url': '/wfs/datasets/{datasetId}/collections'} # type: ignore + + def get_collection( + self, + dataset_id, # type: str + collection_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CollectionInfo" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Description API provides the description of a given collection. It includes the + links to the operations that can be performed on the collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionInfo, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}'} # type: ignore + + def get_collection_definition( + self, + dataset_id, # type: str + collection_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CollectionDefinitionResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + `This `_ article + introduces concepts and tools that apply to Azure Maps Creator. WFS API follows the `Open + Geospatial Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + + The Collection Definition API provides the detailed data model of a given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CollectionDefinitionResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.CollectionDefinitionResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CollectionDefinitionResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_collection_definition.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CollectionDefinitionResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_collection_definition.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/definition'} # type: ignore + + def get_features( + self, + dataset_id, # type: str + collection_id, # type: str + limit=None, # type: Optional[int] + bbox=None, # type: Optional[str] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.ExtendedGeoJsonFeatureCollection" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Features API returns the list of features in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param limit: The optional limit parameter limits the number of features that are presented in + the response document. + Only features that are on the first level of the collection in the response document are + counted. Nested objects contained within the explicitly requested features shall not be + counted. + + + * Minimum = 1 * Maximum = 50 * Default = 10. + :type limit: int + :param bbox: Only features that have a geometry that intersects the supplied bounding box are + selected. + + + * Lower left corner, coordinate axis 1 * Lower left corner, coordinate axis 2 * Upper right + corner, coordinate axis 1 * Upper right corner, coordinate axis 2 + The coordinate reference system of the values is WGS84 longitude/latitude + (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system + is specified in the parameter ``bbox-crs``. + For WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, + minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans + the antimeridian the first value (west-most box edge) is larger than the third value (east-most + box edge). + :type bbox: str + :param filter: Filter expression to search for features with specific property values in a + given collection. Only feature properties of scalar type and equals operator are supported. + This is a special parameter where the parameter name is a case sensitive property name. The + scheme for this parameter is {property name}={property value}. Unless "filter" is one of the + property names in the collection, "filter" should not be used as a parameter name. To search + for features with "name" property value "21N13", use "name=21N13". + Multiple filters are supported and should be represented as multiple query parameters. E.g., + :code:``=:code:``&:code:``=:code:`` String values are + case sensitive. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedGeoJsonFeatureCollection, or the result of cls(response) + :rtype: ~azure.maps.creator.models.ExtendedGeoJsonFeatureCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedGeoJsonFeatureCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_features.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=50, minimum=1) + if bbox is not None: + query_parameters['bbox'] = self._serialize.query("bbox", bbox, 'str') + if filter is not None: + query_parameters['filter'] = self._serialize.query("filter", filter, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('ExtendedGeoJsonFeatureCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_features.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items'} # type: ignore + + def get_feature( + self, + dataset_id, # type: str + collection_id, # type: str + feature_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.FeatureResponse" + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Get Feature API returns the feature identified by the provided id in the given collection. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: FeatureResponse, or the result of cls(response) + :rtype: ~azure.maps.creator.models.FeatureResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FeatureResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.get_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('FeatureResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore + + def delete_feature( + self, + dataset_id, # type: str + collection_id, # type: str + feature_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """**Applies to:** see pricing `tiers `_. + + Creator makes it possible to develop applications based on your private indoor map data using + Azure Maps API and SDK. `This + `_ article introduces concepts + and tools that apply to Azure Maps Creator. + + The Web Feature Service (WFS) API is part of Creator. WFS API follows the `Open Geospatial + Consortium API standard for Features + `_ to query `Datasets + `_. + A dataset consists of multiple feature collections. A feature collection is a collection of + features of a similar type, based on a common schema. + The Delete Feature API deletes the feature identified by the provided id in the given + collection. At this point this API supports only facility features. Deleting a facility feature + deletes all the child features of that facility recursively. + + :param dataset_id: The identifier for the dataset to query from. + :type dataset_id: str + :param collection_id: Identifier (name) of a specific collection. + :type collection_id: str + :param feature_id: Local identifier of a specific feature. + :type feature_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2.0" + accept = "application/json" + + # Construct URL + url = self.delete_feature.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'datasetId': self._serialize.url("dataset_id", dataset_id, 'str'), + 'collectionId': self._serialize.url("collection_id", collection_id, 'str'), + 'featureId': self._serialize.url("feature_id", feature_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + delete_feature.metadata = {'url': '/wfs/datasets/{datasetId}/collections/{collectionId}/items/{featureId}'} # type: ignore diff --git a/sdk/maps/azure-maps-creator/azure/maps/creator/py.typed b/sdk/maps/azure-maps-creator/azure/maps/creator/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/maps/azure-maps-creator/azure/maps/creator/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/maps/azure-maps-creator/sdk_packaging.toml b/sdk/maps/azure-maps-creator/sdk_packaging.toml new file mode 100644 index 000000000000..7bbde0642f6c --- /dev/null +++ b/sdk/maps/azure-maps-creator/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-maps-creator" +package_nspkg = "azure-maps-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/maps/azure-maps-creator/setup.cfg b/sdk/maps/azure-maps-creator/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/maps/azure-maps-creator/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/maps/azure-maps-creator/setup.py b/sdk/maps/azure-maps-creator/setup.py new file mode 100644 index 000000000000..9183eab24758 --- /dev/null +++ b/sdk/maps/azure-maps-creator/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-creator" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-elevation/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-elevation/README.md b/sdk/maps/azure-maps-elevation/README.md new file mode 100644 index 000000000000..af7125cb22cd --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..8d5b6c16200b --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..e4cad244abfe --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.elevation.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(ElevationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..ab21c0a43f20 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/_elevation_client.py @@ -0,0 +1,88 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.elevation.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = ElevationClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..02f2906e9624 --- /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": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": false, + "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\": [\"ElevationClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.elevation.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.elevation.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..7575c3a7f62a --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.elevation.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(ElevationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..c9527bbb4060 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/_elevation_client.py @@ -0,0 +1,81 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.elevation.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = ElevationClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..7091fb8419f8 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/operations/_elevation_operations.py @@ -0,0 +1,459 @@ +# 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, + format: Union[str, "_models.ResponseFormat"], + points: List[str], + **kwargs: Any + ) -> "_models.PointsResult": + """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 `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :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] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointsResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.PointsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointsResult"] + 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 = { + '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['points'] = self._serialize.query("points", points, '[str]', skip_quote=True, div='|') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointsResult', 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, + format: Union[str, "_models.ResponseFormat"], + points_request_body: List["_models.CoordinatesPairAbbreviated"], + **kwargs: Any + ) -> "_models.PointsResult": + """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 `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :param points_request_body: 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_request_body: list[~azure.maps.elevation.models.CoordinatesPairAbbreviated] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointsResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.PointsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointsResult"] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(points_request_body, '[CoordinatesPairAbbreviated]') + 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('PointsResult', 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, + format: Union[str, "_models.ResponseFormat"], + lines: List[str], + samples: Optional[int] = None, + **kwargs: Any + ) -> "_models.LinesResult": + """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 and equally spaced points along the polyline will be + returned. + + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :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 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: LinesResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.LinesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinesResult"] + 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 = { + '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['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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LinesResult', 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, + format: Union[str, "_models.ResponseFormat"], + lines_request_body: List["_models.CoordinatesPairAbbreviated"], + samples: Optional[int] = None, + **kwargs: Any + ) -> "_models.LinesResult": + """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 and equally spaced points along the polyline will + be returned. 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :param lines_request_body: 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 lines_request_body: list[~azure.maps.elevation.models.CoordinatesPairAbbreviated] + :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: LinesResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.LinesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinesResult"] + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(lines_request_body, '[CoordinatesPairAbbreviated]') + 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('LinesResult', 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, + format: Union[str, "_models.ResponseFormat"], + bounds: List[str], + rows: int, + columns: int, + **kwargs: Any + ) -> "_models.BoundingBoxResult": + """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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :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[str] + :param rows: Specifies the number of rows to use to divide the bounding box area into a grid. + The number of vertices 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 in the grid should be less than 2,000. + :type columns: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BoundingBoxResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.BoundingBoxResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BoundingBoxResult"] + 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 = { + '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['bounds'] = self._serialize.query("bounds", bounds, '[str]', 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BoundingBoxResult', 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..45fc121ffb8c --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/__init__.py @@ -0,0 +1,49 @@ +# 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 BoundingBoxResult + from ._models_py3 import CoordinatesPair + from ._models_py3 import CoordinatesPairAbbreviated + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import LinesResult + from ._models_py3 import PointElevationResult + from ._models_py3 import PointsResult +except (SyntaxError, ImportError): + from ._models import BoundingBoxResult # type: ignore + from ._models import CoordinatesPair # type: ignore + from ._models import CoordinatesPairAbbreviated # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import LinesResult # type: ignore + from ._models import PointElevationResult # type: ignore + from ._models import PointsResult # type: ignore + +from ._elevation_client_enums import ( + GeographicResourceLocation, + Geography, + ResponseFormat, +) + +__all__ = [ + 'BoundingBoxResult', + 'CoordinatesPair', + 'CoordinatesPairAbbreviated', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'LinesResult', + 'PointElevationResult', + 'PointsResult', + 'GeographicResourceLocation', + 'Geography', + 'ResponseFormat', +] 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..5ada54282f19 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_elevation_client_enums.py @@ -0,0 +1,48 @@ +# 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 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 ResponseFormat(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..aae3b2cac2a2 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models.py @@ -0,0 +1,257 @@ +# 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 BoundingBoxResult(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 data: The response from the Get Data for Bounding Box API. The results are ordered + starting with the southwest corner, and then proceed west to east and south to north. + :vartype data: list[~azure.maps.elevation.models.PointElevationResult] + """ + + _validation = { + 'data': {'readonly': True}, + } + + _attribute_map = { + 'data': {'key': 'data', 'type': '[PointElevationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(BoundingBoxResult, self).__init__(**kwargs) + self.data = None + + +class CoordinatesPair(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(CoordinatesPair, self).__init__(**kwargs) + self.latitude = kwargs.get('latitude', None) + self.longitude = kwargs.get('longitude', None) + + +class CoordinatesPairAbbreviated(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(CoordinatesPairAbbreviated, self).__init__(**kwargs) + self.lat = kwargs.get('lat', None) + self.lon = kwargs.get('lon', 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 LinesResult(msrest.serialization.Model): + """The response from a successful Elevation Polyline request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data: The response from the Get Data for Polyline API. The results will be listed in the + direction from the first endpoint towards the last endpoint. + :vartype data: list[~azure.maps.elevation.models.PointElevationResult] + """ + + _validation = { + 'data': {'readonly': True}, + } + + _attribute_map = { + 'data': {'key': 'data', 'type': '[PointElevationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(LinesResult, self).__init__(**kwargs) + self.data = None + + +class PointElevationResult(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.CoordinatesPair + :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': 'CoordinatesPair'}, + 'elevation_in_meter': {'key': 'elevationInMeter', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(PointElevationResult, self).__init__(**kwargs) + self.coordinate = kwargs.get('coordinate', None) + self.elevation_in_meter = None + + +class PointsResult(msrest.serialization.Model): + """The response from a successful Elevation Points request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data: The response for point/points elevation API. The result will be in same sequence of + points listed in request. + :vartype data: list[~azure.maps.elevation.models.PointElevationResult] + """ + + _validation = { + 'data': {'readonly': True}, + } + + _attribute_map = { + 'data': {'key': 'data', 'type': '[PointElevationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointsResult, self).__init__(**kwargs) + self.data = 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..a077948d4457 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/models/_models_py3.py @@ -0,0 +1,269 @@ +# 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 BoundingBoxResult(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 data: The response from the Get Data for Bounding Box API. The results are ordered + starting with the southwest corner, and then proceed west to east and south to north. + :vartype data: list[~azure.maps.elevation.models.PointElevationResult] + """ + + _validation = { + 'data': {'readonly': True}, + } + + _attribute_map = { + 'data': {'key': 'data', 'type': '[PointElevationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(BoundingBoxResult, self).__init__(**kwargs) + self.data = None + + +class CoordinatesPair(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(CoordinatesPair, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +class CoordinatesPairAbbreviated(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(CoordinatesPairAbbreviated, self).__init__(**kwargs) + self.lat = lat + self.lon = lon + + +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 LinesResult(msrest.serialization.Model): + """The response from a successful Elevation Polyline request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data: The response from the Get Data for Polyline API. The results will be listed in the + direction from the first endpoint towards the last endpoint. + :vartype data: list[~azure.maps.elevation.models.PointElevationResult] + """ + + _validation = { + 'data': {'readonly': True}, + } + + _attribute_map = { + 'data': {'key': 'data', 'type': '[PointElevationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(LinesResult, self).__init__(**kwargs) + self.data = None + + +class PointElevationResult(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.CoordinatesPair + :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': 'CoordinatesPair'}, + 'elevation_in_meter': {'key': 'elevationInMeter', 'type': 'float'}, + } + + def __init__( + self, + *, + coordinate: Optional["CoordinatesPair"] = None, + **kwargs + ): + super(PointElevationResult, self).__init__(**kwargs) + self.coordinate = coordinate + self.elevation_in_meter = None + + +class PointsResult(msrest.serialization.Model): + """The response from a successful Elevation Points request. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data: The response for point/points elevation API. The result will be in same sequence of + points listed in request. + :vartype data: list[~azure.maps.elevation.models.PointElevationResult] + """ + + _validation = { + 'data': {'readonly': True}, + } + + _attribute_map = { + 'data': {'key': 'data', 'type': '[PointElevationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(PointsResult, self).__init__(**kwargs) + self.data = None 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..d1e1c8ca7d82 --- /dev/null +++ b/sdk/maps/azure-maps-elevation/azure/maps/elevation/operations/_elevation_operations.py @@ -0,0 +1,468 @@ +# 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, + format, # type: Union[str, "_models.ResponseFormat"] + points, # type: List[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.PointsResult" + """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 `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :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] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointsResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.PointsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointsResult"] + 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 = { + '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['points'] = self._serialize.query("points", points, '[str]', skip_quote=True, div='|') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('PointsResult', 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, + format, # type: Union[str, "_models.ResponseFormat"] + points_request_body, # type: List["_models.CoordinatesPairAbbreviated"] + **kwargs # type: Any + ): + # type: (...) -> "_models.PointsResult" + """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 `_. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :param points_request_body: 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_request_body: list[~azure.maps.elevation.models.CoordinatesPairAbbreviated] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PointsResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.PointsResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PointsResult"] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(points_request_body, '[CoordinatesPairAbbreviated]') + 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('PointsResult', 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, + format, # type: Union[str, "_models.ResponseFormat"] + lines, # type: List[str] + samples=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.LinesResult" + """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 and equally spaced points along the polyline will be + returned. + + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :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 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: LinesResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.LinesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinesResult"] + 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 = { + '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['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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('LinesResult', 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, + format, # type: Union[str, "_models.ResponseFormat"] + lines_request_body, # type: List["_models.CoordinatesPairAbbreviated"] + samples=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.LinesResult" + """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 and equally spaced points along the polyline will + be returned. 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :param lines_request_body: 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 lines_request_body: list[~azure.maps.elevation.models.CoordinatesPairAbbreviated] + :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: LinesResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.LinesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LinesResult"] + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(lines_request_body, '[CoordinatesPairAbbreviated]') + 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('LinesResult', 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, + format, # type: Union[str, "_models.ResponseFormat"] + bounds, # type: List[str] + rows, # type: int + columns, # type: int + **kwargs # type: Any + ): + # type: (...) -> "_models.BoundingBoxResult" + """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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.elevation.models.ResponseFormat + :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[str] + :param rows: Specifies the number of rows to use to divide the bounding box area into a grid. + The number of vertices 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 in the grid should be less than 2,000. + :type columns: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BoundingBoxResult, or the result of cls(response) + :rtype: ~azure.maps.elevation.models.BoundingBoxResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BoundingBoxResult"] + 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 = { + '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['bounds'] = self._serialize.query("bounds", bounds, '[str]', 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BoundingBoxResult', 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..bb2867d9b96d --- /dev/null +++ b/sdk/maps/azure-maps-elevation/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-geolocation/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-geolocation/README.md b/sdk/maps/azure-maps-geolocation/README.md new file mode 100644 index 000000000000..10cb14a45322 --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..b7151e4678df --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..f9a2a68f9d6f --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.geolocation.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(GeolocationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..6acb6fc8fea9 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/_geolocation_client.py @@ -0,0 +1,88 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.geolocation.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = GeolocationClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..eebe0db608b8 --- /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": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": false, + "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\": [\"GeolocationClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.geolocation.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.geolocation.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..4fac589d4d61 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.geolocation.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(GeolocationClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..b075f1b9191a --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/_geolocation_client.py @@ -0,0 +1,81 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.geolocation.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = GeolocationClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..5b6286700ed1 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/aio/operations/_geolocation_operations.py @@ -0,0 +1,108 @@ +# 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_ip_to_location_preview( + self, + format: Union[str, "_models.ResponseFormat"], + ip: str, + **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. + + **Note:** This service returns results from IANA and does not necessarily reflect the views of + Microsoft Corporation. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.geolocation.models.ResponseFormat + :param ip: The IP address. Both IPv4 and IPv6 are allowed. + :type ip: str + :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_ip_to_location_preview.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['ip'] = self._serialize.query("ip", ip, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IpAddressToLocationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ip_to_location_preview.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..fe032cf25e4e --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/__init__.py @@ -0,0 +1,37 @@ +# 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 ( + GeographicResourceLocation, + Geography, + ResponseFormat, +) + +__all__ = [ + 'CountryRegion', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'IpAddressToLocationResult', + 'GeographicResourceLocation', + 'Geography', + 'ResponseFormat', +] 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..5ada54282f19 --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_geolocation_client_enums.py @@ -0,0 +1,48 @@ +# 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 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 ResponseFormat(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..1c4a05dcd51a --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models.py @@ -0,0 +1,162 @@ +# 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 as assigned by + IANA and regional internet authorities. 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..54ca2072a30a --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/models/_models_py3.py @@ -0,0 +1,166 @@ +# 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 as assigned by + IANA and regional internet authorities. 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..a0480d85d41f --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/azure/maps/geolocation/operations/_geolocation_operations.py @@ -0,0 +1,113 @@ +# 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_ip_to_location_preview( + self, + format, # type: Union[str, "_models.ResponseFormat"] + ip, # type: str + **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. + + **Note:** This service returns results from IANA and does not necessarily reflect the views of + Microsoft Corporation. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.geolocation.models.ResponseFormat + :param ip: The IP address. Both IPv4 and IPv6 are allowed. + :type ip: str + :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_ip_to_location_preview.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['ip'] = self._serialize.query("ip", ip, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IpAddressToLocationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_ip_to_location_preview.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..b5f222d9750e --- /dev/null +++ b/sdk/maps/azure-maps-geolocation/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-render/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-render/README.md b/sdk/maps/azure-maps-render/README.md new file mode 100644 index 000000000000..4aa42b51e2b0 --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..32e7b761571b --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..3c4606a85231 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.render.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(RenderClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-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..fc2d0ff76ac6 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_metadata.json @@ -0,0 +1,104 @@ +{ + "chosen_version": "", + "total_api_version_list": ["1.0", "2.0"], + "client": { + "name": "RenderClient", + "filename": "_render_client", + "description": "Azure Maps Render REST APIs.", + "base_url": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": false, + "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\": [\"RenderClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.render.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.render.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "render": "RenderOperations", + "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..ecd7ca618f71 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/_render_client.py @@ -0,0 +1,93 @@ +# 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 RenderClientConfiguration +from .operations import RenderOperations +from .operations import RenderV2Operations +from . import models + + +class RenderClient(object): + """Azure Maps Render REST APIs. + + :ivar render: RenderOperations operations + :vartype render: azure.maps.render.operations.RenderOperations + :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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.render.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = RenderClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.render = RenderOperations( + self._client, self._config, self._serialize, self._deserialize) + 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 + """ + 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: () -> 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..c92f6c4472cf --- /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.0-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..2bb133defbb1 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.render.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(RenderClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default']) + kwargs.setdefault('sdk_moniker', 'maps-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..9a4ffe8bbd48 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/_render_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 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 RenderClientConfiguration +from .operations import RenderOperations +from .operations import RenderV2Operations +from .. import models + + +class RenderClient(object): + """Azure Maps Render REST APIs. + + :ivar render: RenderOperations operations + :vartype render: azure.maps.render.aio.operations.RenderOperations + :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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.render.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = RenderClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.render = RenderOperations( + self._client, self._config, self._serialize, self._deserialize) + 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 + """ + 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) -> "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..577d8c58c72f --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/__init__.py @@ -0,0 +1,15 @@ +# 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_operations import RenderOperations +from ._render_v2_operations import RenderV2Operations + +__all__ = [ + 'RenderOperations', + 'RenderV2Operations', +] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_operations.py b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_operations.py new file mode 100644 index 000000000000..15775a86e0fa --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_operations.py @@ -0,0 +1,1258 @@ +# 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 RenderOperations: + """RenderOperations 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_static_image( + self, + format: Union[str, "_models.RasterTileFormat"], + layer: Optional[Union[str, "_models.StaticMapLayer"]] = None, + style: Optional[Union[str, "_models.MapImageStyle"]] = None, + zoom: Optional[int] = None, + center: Optional[str] = None, + bbox: Optional[str] = None, + height: Optional[int] = None, + width: Optional[int] = None, + language: Optional[str] = None, + view: Optional[str] = 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 + * Provide custom pushpin images stored in `Azure Maps Data Service + `_ + * 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: str + :param bbox: 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 bbox: str + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :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 image and location information can be obtained from Azure Maps Data Storage. After + uploading a pushpin image + or 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 a custom pushpin image from Azure Maps Data Storage, specify the UDID prefixed by + 'udid-' as the name of the + pushpin style. For example, + + ``pins=udid-fe22c504-3a81-4fcd-adc6-a3507ce866c1||-122 45`` + + 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 = "1.0" + 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 = { + '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') + 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, 'str') + if bbox is not None: + query_parameters['bbox'] = self._serialize.query("bbox", bbox, 'str') + 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 view is not None: + query_parameters['view'] = self._serialize.query("view", 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_static_image.metadata = {'url': '/map/static/{format}'} # type: ignore + + async def get_map_tile( + self, + format: Union[str, "_models.TileFormat"], + layer: Union[str, "_models.MapTileLayer"], + style: Union[str, "_models.MapTileStyle"], + zoom: int, + x_tile_index: int, + y_tile_index: int, + tile_size: Optional[Union[str, "_models.MapTileSize"]] = None, + language: Optional[str] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> IO: + """**Applies to**\ : S0 and S1 pricing tiers. + + Fetches map tiles in vector or raster format typically to be integrated into a new map control + or SDK. By default, Azure uses vector map tiles for its web map control (see `Zoom Levels and + Tile Grid + `_\ ) + + **Note**\ : Weather tiles are only available via `Get Map Tile V2 API + `_. We recommend to start to use the new `Get Map Tile V2 + API `_. + + :param format: Desired format of the response. Possible values are png & pbf. + :type format: str or ~azure.maps.render.models.TileFormat + :param layer: Map layer requested. Possible values are basic, hybrid, labels and terra. + :type layer: str or ~azure.maps.render.models.MapTileLayer + :param style: Map style to be returned. Possible values are main, dark, and shaded_relief. + :type style: str or ~azure.maps.render.models.MapTileStyle + :param zoom: Zoom level for the desired tile. For *raster* tiles, value must be in the range: + 0-18 (inclusive). Terra raster tiles, values must be in the range 0-6 (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 x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: 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 = "1.0" + 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 + 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['layer'] = self._serialize.query("layer", layer, '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_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + 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 view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_tile.metadata = {'url': '/map/tile/{format}'} # type: ignore + + async def get_map_state_tile_preview( + self, + zoom: int, + x_tile_index: int, + y_tile_index: int, + stateset_id: str, + **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 zoom: Zoom level for the desired tile. Zoom value must be in the range: 0-20 + (inclusive). + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :param stateset_id: The stateset id. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/vnd.mapbox-vector-tile, application/json" + + # Construct URL + url = self.get_map_state_tile_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + query_parameters['statesetId'] = self._serialize.query("stateset_id", stateset_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_state_tile_preview.metadata = {'url': '/map/statetile'} # type: ignore + + async def get_copyright_caption( + self, + format: Union[str, "_models.TextFormat"], + **kwargs: Any + ) -> "_models.GetCopyrightCaptionResult": + """**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.TextFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightCaptionResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightCaptionResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightCaptionResult"] + 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_copyright_caption.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('GetCopyrightCaptionResult', 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_imagery_tile( + self, + format: Union[str, "_models.RasterTileFormat"], + style: Union[str, "_models.MapImageryStyle"], + zoom: int, + x_tile_index: int, + y_tile_index: int, + **kwargs: Any + ) -> IO: + """**Applies to:** S1 pricing tier. + + This service returns a map image tile with size 256x256, given the x and y coordinates and zoom + level. Zoom level ranges from 1 to 19. The current available style value is 'satellite' which + provides satellite + imagery alone. + + **Note**\ : We recommend to start to use the new `Get Map Tile V2 API + `_. + + :param format: Desired format of the response. Possible value: png. + :type format: str or ~azure.maps.render.models.RasterTileFormat + :param style: Map style to be returned. **Possible values:** satellite. + :type style: str or ~azure.maps.render.models.MapImageryStyle + :param zoom: Zoom level for the desired tile. Zoom value must be in the range: 1-19 + (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: 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', {})) + api_version = "1.0" + accept = "application/json, image/jpeg, image/png" + + # Construct URL + url = self.get_map_imagery_tile.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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=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_imagery_tile.metadata = {'url': '/map/imagery/{format}'} # type: ignore + + async def get_copyright_from_bounding_box( + self, + format: Union[str, "_models.TextFormat"], + mincoordinates: str, + maxcoordinates: str, + text: Optional[Union[str, "_models.IncludeText"]] = None, + **kwargs: Any + ) -> "_models.GetCopyrightFromBoundingBoxResult": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.TextFormat + :param mincoordinates: Minimum coordinates of bounding box in latitude longitude coordinate + system. E.g. 52.41064,4.84228. + :type mincoordinates: str + :param maxcoordinates: Maximum coordinates of bounding box in latitude longitude coordinate + system. E.g. 52.41064,4.84228. + :type maxcoordinates: str + :param text: Yes/no value to exclude textual data from response. Only images and country names + will be in response. + :type text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightFromBoundingBoxResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightFromBoundingBoxResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightFromBoundingBoxResult"] + 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_copyright_from_bounding_box.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['mincoordinates'] = self._serialize.query("mincoordinates", mincoordinates, 'str') + query_parameters['maxcoordinates'] = self._serialize.query("maxcoordinates", maxcoordinates, 'str') + if text is not None: + query_parameters['text'] = self._serialize.query("text", text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetCopyrightFromBoundingBoxResult', 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, + format: Union[str, "_models.TextFormat"], + zoom: int, + x_tile_index: int, + y_tile_index: int, + text: Optional[Union[str, "_models.IncludeText"]] = None, + **kwargs: Any + ) -> "_models.GetCopyrightForTileResult": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.TextFormat + :param zoom: Zoom level for the desired tile. Zoom value must be in the range: 0-18 + (inclusive). + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :param text: Yes/no value to exclude textual data from response. Only images and country names + will be in response. + :type text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightForTileResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightForTileResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightForTileResult"] + 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_copyright_for_tile.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['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + if text is not None: + query_parameters['text'] = self._serialize.query("text", text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetCopyrightForTileResult', 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.TextFormat"], + text: Optional[Union[str, "_models.IncludeText"]] = None, + **kwargs: Any + ) -> "_models.GetCopyrightForWorldResult": + """**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.TextFormat + :param text: Yes/no value to exclude textual data from response. Only images and country names + will be in response. + :type text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightForWorldResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightForWorldResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightForWorldResult"] + 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_copyright_for_world.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') + if text is not None: + query_parameters['text'] = self._serialize.query("text", text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetCopyrightForWorldResult', 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/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..de04e0dd37d4 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/aio/operations/_render_v2_operations.py @@ -0,0 +1,185 @@ +# 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 ... 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_preview( + self, + tileset_id: Union[str, "_models.TilesetID"], + zoom: int, + x_tile_index: int, + y_tile_index: int, + time_stamp: Optional[str] = None, + tile_size: Optional[Union[str, "_models.TileSize"]] = None, + language: Optional[str] = None, + view: Optional[str] = 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 zoom: Zoom level for the desired tile. Please find TilesetID list below for more details + on supported zoom level for each tilesetId.:code:`
` + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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: str + :param tile_size: The size of the returned map tile in pixels. + :type tile_size: str or ~azure.maps.render.models.TileSize + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: 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, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_map_tile_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'str') + 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 view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_tile_preview.metadata = {'url': '/map/tile'} # 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..be3ee2c87015 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/__init__.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import GetCopyrightCaptionResult + from ._models_py3 import GetCopyrightForTileResult + from ._models_py3 import GetCopyrightForWorldResult + from ._models_py3 import GetCopyrightFromBoundingBoxResult + from ._models_py3 import RegionCopyrights + from ._models_py3 import RegionCopyrightsCountry +except (SyntaxError, ImportError): + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import GetCopyrightCaptionResult # type: ignore + from ._models import GetCopyrightForTileResult # type: ignore + from ._models import GetCopyrightForWorldResult # type: ignore + from ._models import GetCopyrightFromBoundingBoxResult # type: ignore + from ._models import RegionCopyrights # type: ignore + from ._models import RegionCopyrightsCountry # type: ignore + +from ._render_client_enums import ( + GeographicResourceLocation, + Geography, + IncludeText, + MapImageStyle, + MapImageryStyle, + MapTileLayer, + MapTileSize, + MapTileStyle, + RasterTileFormat, + StaticMapLayer, + TextFormat, + TileFormat, + TileSize, + TilesetID, +) + +__all__ = [ + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GetCopyrightCaptionResult', + 'GetCopyrightForTileResult', + 'GetCopyrightForWorldResult', + 'GetCopyrightFromBoundingBoxResult', + 'RegionCopyrights', + 'RegionCopyrightsCountry', + 'GeographicResourceLocation', + 'Geography', + 'IncludeText', + 'MapImageStyle', + 'MapImageryStyle', + 'MapTileLayer', + 'MapTileSize', + 'MapTileStyle', + 'RasterTileFormat', + 'StaticMapLayer', + 'TextFormat', + 'TileFormat', + 'TileSize', + '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..aa167767a34e --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/_models.py @@ -0,0 +1,299 @@ +# 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.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 GetCopyrightCaptionResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright Caption 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(GetCopyrightCaptionResult, self).__init__(**kwargs) + self.format_version = None + self.copyrights_caption = None + + +class GetCopyrightForTileResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright For Tile 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 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(GetCopyrightForTileResult, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = None + + +class GetCopyrightForWorldResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright For World 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 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(GetCopyrightForWorldResult, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = None + + +class GetCopyrightFromBoundingBoxResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright From Bounding Box 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 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(GetCopyrightFromBoundingBoxResult, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = 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 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..1dbe663ab511 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/_models_py3.py @@ -0,0 +1,303 @@ +# 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.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 GetCopyrightCaptionResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright Caption 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(GetCopyrightCaptionResult, self).__init__(**kwargs) + self.format_version = None + self.copyrights_caption = None + + +class GetCopyrightForTileResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright For Tile 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 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(GetCopyrightForTileResult, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = None + + +class GetCopyrightForWorldResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright For World 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 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(GetCopyrightForWorldResult, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = None + + +class GetCopyrightFromBoundingBoxResult(msrest.serialization.Model): + """This object is returned from a successful Get Copyright From Bounding Box 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 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(GetCopyrightFromBoundingBoxResult, self).__init__(**kwargs) + self.format_version = None + self.general_copyrights = None + self.regions = 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 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..50972c633057 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/models/_render_client_enums.py @@ -0,0 +1,211 @@ +# 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 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 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 MapImageryStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Satellite imagery. + SATELLITE = "satellite" + +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 MapTileLayer(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Returns a tile containing all map features including polygons, borders, roads and labels. + BASIC = "basic" + #: Returns a tile containing borders, roads, and labels, and can be overlaid on other tiles (such + #: as satellite imagery) to produce hybrid tiles. + HYBRID = "hybrid" + #: Returns a tile of just the map's label information. + LABELS = "labels" + #: Map canvas complete with shaded relief tiles. Zoom levels 0-6 (inclusive) are supported. Png is + #: the only supported TileFormat and only available MapTileSize is 512. + TERRA = "terra" + +class MapTileSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Return a 256 by 256 pixel tile. + TWO_HUNDRED_FIFTY_SIX = "256" + #: Return a 512 by 512 pixel tile. + FIVE_HUNDRED_TWELVE = "512" + +class MapTileStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Azure Maps main style. + MAIN = "main" + #: Dark grey version of the Azure Maps main style. PNG is the only supported TileFormat. + DARK = "dark" + #: Azure Maps main style completed with shaded relief. Supported by Layer terra. + SHADED_RELIEF = "shaded_relief" + +class RasterTileFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: An image in the png format. Supports zoom levels 0 through 18. + PNG = "png" + +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 TextFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +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 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" + #: 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" + #: 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" + +class TileSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Return a 256 by 256 pixel tile. Available for all tilesetIds except for + #: + #: + #: * microsoft.terra.main. + TWO_HUNDRED_FIFTY_SIX = "256" + #: Return a 512 by 512 pixel tile. Available for all tilesetIds except for + #: + #: + #: * microsoft.weather.radar.main + #: * microsoft.weather.infrared.main + #: * microsoft.base.hybrid + #: * microsoft.dem + #: * microsoft.imagery. + FIVE_HUNDRED_TWELVE = "512" 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..577d8c58c72f --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/operations/__init__.py @@ -0,0 +1,15 @@ +# 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_operations import RenderOperations +from ._render_v2_operations import RenderV2Operations + +__all__ = [ + 'RenderOperations', + 'RenderV2Operations', +] diff --git a/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_operations.py b/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_operations.py new file mode 100644 index 000000000000..8ee807893f35 --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_operations.py @@ -0,0 +1,1270 @@ +# 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 RenderOperations(object): + """RenderOperations 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_static_image( + self, + format, # 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[str] + bbox=None, # type: Optional[str] + height=None, # type: Optional[int] + width=None, # type: Optional[int] + language=None, # type: Optional[str] + view=None, # type: Optional[str] + 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 + * Provide custom pushpin images stored in `Azure Maps Data Service + `_ + * 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: str + :param bbox: 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 bbox: str + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :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 image and location information can be obtained from Azure Maps Data Storage. After + uploading a pushpin image + or 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 a custom pushpin image from Azure Maps Data Storage, specify the UDID prefixed by + 'udid-' as the name of the + pushpin style. For example, + + ``pins=udid-fe22c504-3a81-4fcd-adc6-a3507ce866c1||-122 45`` + + 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 = "1.0" + 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 = { + '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') + 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, 'str') + if bbox is not None: + query_parameters['bbox'] = self._serialize.query("bbox", bbox, 'str') + 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 view is not None: + query_parameters['view'] = self._serialize.query("view", 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_static_image.metadata = {'url': '/map/static/{format}'} # type: ignore + + def get_map_tile( + self, + format, # type: Union[str, "_models.TileFormat"] + layer, # type: Union[str, "_models.MapTileLayer"] + style, # type: Union[str, "_models.MapTileStyle"] + zoom, # type: int + x_tile_index, # type: int + y_tile_index, # type: int + tile_size=None, # type: Optional[Union[str, "_models.MapTileSize"]] + language=None, # type: Optional[str] + view=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> IO + """**Applies to**\ : S0 and S1 pricing tiers. + + Fetches map tiles in vector or raster format typically to be integrated into a new map control + or SDK. By default, Azure uses vector map tiles for its web map control (see `Zoom Levels and + Tile Grid + `_\ ) + + **Note**\ : Weather tiles are only available via `Get Map Tile V2 API + `_. We recommend to start to use the new `Get Map Tile V2 + API `_. + + :param format: Desired format of the response. Possible values are png & pbf. + :type format: str or ~azure.maps.render.models.TileFormat + :param layer: Map layer requested. Possible values are basic, hybrid, labels and terra. + :type layer: str or ~azure.maps.render.models.MapTileLayer + :param style: Map style to be returned. Possible values are main, dark, and shaded_relief. + :type style: str or ~azure.maps.render.models.MapTileStyle + :param zoom: Zoom level for the desired tile. For *raster* tiles, value must be in the range: + 0-18 (inclusive). Terra raster tiles, values must be in the range 0-6 (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 x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: 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 = "1.0" + 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 + 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['layer'] = self._serialize.query("layer", layer, '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_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + 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 view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_tile.metadata = {'url': '/map/tile/{format}'} # type: ignore + + def get_map_state_tile_preview( + self, + zoom, # type: int + x_tile_index, # type: int + y_tile_index, # type: int + stateset_id, # type: str + **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 zoom: Zoom level for the desired tile. Zoom value must be in the range: 0-20 + (inclusive). + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :param stateset_id: The stateset id. + :type stateset_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IO, or the result of cls(response) + :rtype: IO + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[IO] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "1.0" + accept = "application/vnd.mapbox-vector-tile, application/json" + + # Construct URL + url = self.get_map_state_tile_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + query_parameters['statesetId'] = self._serialize.query("stateset_id", stateset_id, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_state_tile_preview.metadata = {'url': '/map/statetile'} # type: ignore + + def get_copyright_caption( + self, + format, # type: Union[str, "_models.TextFormat"] + **kwargs # type: Any + ): + # type: (...) -> "_models.GetCopyrightCaptionResult" + """**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.TextFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightCaptionResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightCaptionResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightCaptionResult"] + 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_copyright_caption.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('GetCopyrightCaptionResult', 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_imagery_tile( + self, + format, # type: Union[str, "_models.RasterTileFormat"] + style, # type: Union[str, "_models.MapImageryStyle"] + zoom, # type: int + x_tile_index, # type: int + y_tile_index, # type: int + **kwargs # type: Any + ): + # type: (...) -> IO + """**Applies to:** S1 pricing tier. + + This service returns a map image tile with size 256x256, given the x and y coordinates and zoom + level. Zoom level ranges from 1 to 19. The current available style value is 'satellite' which + provides satellite + imagery alone. + + **Note**\ : We recommend to start to use the new `Get Map Tile V2 API + `_. + + :param format: Desired format of the response. Possible value: png. + :type format: str or ~azure.maps.render.models.RasterTileFormat + :param style: Map style to be returned. **Possible values:** satellite. + :type style: str or ~azure.maps.render.models.MapImageryStyle + :param zoom: Zoom level for the desired tile. Zoom value must be in the range: 1-19 + (inclusive). + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: 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', {})) + api_version = "1.0" + accept = "application/json, image/jpeg, image/png" + + # Construct URL + url = self.get_map_imagery_tile.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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=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_imagery_tile.metadata = {'url': '/map/imagery/{format}'} # type: ignore + + def get_copyright_from_bounding_box( + self, + format, # type: Union[str, "_models.TextFormat"] + mincoordinates, # type: str + maxcoordinates, # type: str + text=None, # type: Optional[Union[str, "_models.IncludeText"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GetCopyrightFromBoundingBoxResult" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.TextFormat + :param mincoordinates: Minimum coordinates of bounding box in latitude longitude coordinate + system. E.g. 52.41064,4.84228. + :type mincoordinates: str + :param maxcoordinates: Maximum coordinates of bounding box in latitude longitude coordinate + system. E.g. 52.41064,4.84228. + :type maxcoordinates: str + :param text: Yes/no value to exclude textual data from response. Only images and country names + will be in response. + :type text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightFromBoundingBoxResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightFromBoundingBoxResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightFromBoundingBoxResult"] + 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_copyright_from_bounding_box.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['mincoordinates'] = self._serialize.query("mincoordinates", mincoordinates, 'str') + query_parameters['maxcoordinates'] = self._serialize.query("maxcoordinates", maxcoordinates, 'str') + if text is not None: + query_parameters['text'] = self._serialize.query("text", text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetCopyrightFromBoundingBoxResult', 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, + format, # type: Union[str, "_models.TextFormat"] + zoom, # type: int + x_tile_index, # type: int + y_tile_index, # type: int + text=None, # type: Optional[Union[str, "_models.IncludeText"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GetCopyrightForTileResult" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.render.models.TextFormat + :param zoom: Zoom level for the desired tile. Zoom value must be in the range: 0-18 + (inclusive). + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :param text: Yes/no value to exclude textual data from response. Only images and country names + will be in response. + :type text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightForTileResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightForTileResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightForTileResult"] + 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_copyright_for_tile.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['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + if text is not None: + query_parameters['text'] = self._serialize.query("text", text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetCopyrightForTileResult', 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, # type: Union[str, "_models.TextFormat"] + text=None, # type: Optional[Union[str, "_models.IncludeText"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.GetCopyrightForWorldResult" + """**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.TextFormat + :param text: Yes/no value to exclude textual data from response. Only images and country names + will be in response. + :type text: str or ~azure.maps.render.models.IncludeText + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetCopyrightForWorldResult, or the result of cls(response) + :rtype: ~azure.maps.render.models.GetCopyrightForWorldResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetCopyrightForWorldResult"] + 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_copyright_for_world.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') + if text is not None: + query_parameters['text'] = self._serialize.query("text", text, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetCopyrightForWorldResult', 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/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..90f4c7dc652e --- /dev/null +++ b/sdk/maps/azure-maps-render/azure/maps/render/operations/_render_v2_operations.py @@ -0,0 +1,190 @@ +# 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, 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_preview( + self, + tileset_id, # type: Union[str, "_models.TilesetID"] + zoom, # type: int + x_tile_index, # type: int + y_tile_index, # type: int + time_stamp=None, # type: Optional[str] + tile_size=None, # type: Optional[Union[str, "_models.TileSize"]] + language=None, # type: Optional[str] + view=None, # type: Optional[str] + **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 zoom: Zoom level for the desired tile. Please find TilesetID list below for more details + on supported zoom level for each tilesetId.:code:`
` + + Please see `Zoom Levels and Tile Grid + `_ + for details. + :type zoom: int + :param x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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: str + :param tile_size: The size of the returned map tile in pixels. + :type tile_size: str or ~azure.maps.render.models.TileSize + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: 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, image/jpeg, image/png, image/pbf, application/vnd.mapbox-vector-tile" + + # Construct URL + url = self.get_map_tile_preview.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['tilesetId'] = self._serialize.query("tileset_id", tileset_id, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, 'int') + if time_stamp is not None: + query_parameters['timeStamp'] = self._serialize.query("time_stamp", time_stamp, 'str') + 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 view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_map_tile_preview.metadata = {'url': '/map/tile'} # 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..b421cebb09aa --- /dev/null +++ b/sdk/maps/azure-maps-render/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-route/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-route/README.md b/sdk/maps/azure-maps-route/README.md new file mode 100644 index 000000000000..ee522eb69f83 --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..dfac06958f65 --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..31001f697c8d --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.route.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(RouteClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..277db81546df --- /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": 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\": [\"RouteClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.route.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.route.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..d4fe000edb98 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/_route_client.py @@ -0,0 +1,89 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.route.models.Geography + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = RouteClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..4e1d5955da59 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.route.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(RouteClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..45b924fd2845 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/_route_client.py @@ -0,0 +1,82 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.route.models.Geography + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = RouteClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..2be36eec22a7 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/aio/operations/_route_operations.py @@ -0,0 +1,3354 @@ +# 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 _post_route_matrix_initial( + self, + format: Union[str, "_models.ResponseFormat"], + post_route_matrix_request_body: "_models.PostRouteMatrixRequestBody", + wait_for_results: Optional[bool] = None, + compute_travel_time_for: Optional[Union[str, "_models.ComputeTravelTimeFor"]] = None, + 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] = None, + vehicle_length: Optional[float] = None, + vehicle_height: Optional[float] = None, + vehicle_width: Optional[float] = None, + vehicle_max_speed: Optional[int] = None, + vehicle_weight: Optional[int] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + hilliness: Optional[Union[str, "_models.HillinessDegree"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + traffic: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + **kwargs: Any + ) -> Optional["_models.RouteMatrixResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResponse"]] + 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_route_matrix_initial.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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, 'str') + if section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_matrix_request_body, 'PostRouteMatrixRequestBody') + 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('RouteMatrixResponse', 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 + _post_route_matrix_initial.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + async def begin_post_route_matrix( + self, + format: Union[str, "_models.ResponseFormat"], + post_route_matrix_request_body: "_models.PostRouteMatrixRequestBody", + wait_for_results: Optional[bool] = None, + compute_travel_time_for: Optional[Union[str, "_models.ComputeTravelTimeFor"]] = None, + 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] = None, + vehicle_length: Optional[float] = None, + vehicle_height: Optional[float] = None, + vehicle_width: Optional[float] = None, + vehicle_max_speed: Optional[int] = None, + vehicle_weight: Optional[int] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + hilliness: Optional[Union[str, "_models.HillinessDegree"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + traffic: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteMatrixResponse"]: + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_matrix_request_body: 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 post_route_matrix_request_body: ~azure.maps.route.models.PostRouteMatrixRequestBody + :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_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :param 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 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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 RouteMatrixResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteMatrixResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResponse"] + 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._post_route_matrix_initial( + format=format, + post_route_matrix_request_body=post_route_matrix_request_body, + wait_for_results=wait_for_results, + compute_travel_time_for=compute_travel_time_for, + section_type=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, + hilliness=hilliness, + travel_mode=travel_mode, + avoid=avoid, + traffic=traffic, + 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('RouteMatrixResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_route_matrix.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + async def _get_route_matrix_initial( + self, + format: str, + **kwargs: Any + ) -> Optional["_models.RouteMatrixResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResponse"]] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('RouteMatrixResponse', 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, + format: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteMatrixResponse"]: + """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 format: Matrix id received after the Matrix Route request was accepted successfully. + :type format: 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 RouteMatrixResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteMatrixResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResponse"] + 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( + 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('RouteMatrixResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 post_route_matrix_sync( + self, + format: Union[str, "_models.ResponseFormat"], + post_route_matrix_request_body: "_models.PostRouteMatrixRequestBody", + wait_for_results: Optional[bool] = None, + compute_travel_time_for: Optional[Union[str, "_models.ComputeTravelTimeFor"]] = None, + 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] = None, + vehicle_length: Optional[float] = None, + vehicle_height: Optional[float] = None, + vehicle_width: Optional[float] = None, + vehicle_max_speed: Optional[int] = None, + vehicle_weight: Optional[int] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + hilliness: Optional[Union[str, "_models.HillinessDegree"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + traffic: Optional[bool] = None, + route_type: Optional[Union[str, "_models.RouteType"]] = None, + vehicle_load_type: Optional[Union[str, "_models.VehicleLoadType"]] = None, + **kwargs: Any + ) -> "_models.RouteMatrixResponse": + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_matrix_request_body: 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 post_route_matrix_request_body: ~azure.maps.route.models.PostRouteMatrixRequestBody + :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_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :param 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 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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: RouteMatrixResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteMatrixResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResponse"] + 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.post_route_matrix_sync.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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, 'str') + if section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_matrix_request_body, 'PostRouteMatrixRequestBody') + 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('RouteMatrixResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_route_matrix_sync.metadata = {'url': '/route/matrix/sync/{format}'} # type: ignore + + async def get_route_directions( + self, + format: Union[str, "_models.TextFormat"], + query: str, + 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_order: Optional[bool] = None, + route_representation: Optional[Union[str, "_models.RouteRepresentation"]] = None, + compute_travel_time_for: Optional[Union[str, "_models.ComputeTravelTimeFor"]] = None, + vehicle_heading: Optional[int] = None, + report: Optional[str] = None, + section_type: Optional[Union[str, "_models.SectionType"]] = None, + vehicle_axle_weight: Optional[int] = None, + vehicle_width: Optional[float] = None, + vehicle_height: Optional[float] = None, + vehicle_length: Optional[float] = None, + vehicle_max_speed: Optional[int] = None, + vehicle_weight: Optional[int] = None, + vehicle_commercial: Optional[bool] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + hilliness: Optional[Union[str, "_models.HillinessDegree"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + traffic: 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_hundredkm: Optional[float] = None, + current_fuel_in_liters: Optional[float] = None, + auxiliary_power_in_liters_per_hour: Optional[float] = None, + fuel_energy_density_in_m_joules_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_ink_wh_per_hundredkm: Optional[str] = None, + current_charge_ink_wh: Optional[str] = None, + max_charge_ink_wh: Optional[str] = None, + auxiliary_power_ink_w: Optional[str] = None, + **kwargs: Any + ) -> "_models.RouteDirectionsResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.TextFormat + :param query: 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 query: str + :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_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_order: bool + :param route_representation: 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: str or ~azure.maps.route.models.RouteRepresentation + :param compute_travel_time_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :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 + :param 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 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 vehicle_commercial: Vehicle is used for commercial purposes and thus may not be allowed + to drive on some roads. + :type vehicle_commercial: 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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_hundredkm: 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_hundredkm: float + :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_m_joules_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_m_joules_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_ink_wh_per_hundredkm: 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_ink_wh_per_hundredkm: str + :param current_charge_ink_wh: 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_ink_wh: str + :param max_charge_ink_wh: 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_ink_wh: str + :param auxiliary_power_ink_w: 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_ink_w: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsResponse"] + 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 = { + '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') + 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_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_order", compute_best_order, 'bool') + if route_representation is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation", route_representation, 'str') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, '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 section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 vehicle_commercial is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("vehicle_commercial", vehicle_commercial, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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_hundredkm is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundredkm", constant_speed_consumption_in_liters_per_hundredkm, 'float') + 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_m_joules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_m_joules_per_liter", fuel_energy_density_in_m_joules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float') + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float') + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float') + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float') + if constant_speed_consumption_ink_wh_per_hundredkm is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_ink_wh_per_hundredkm", constant_speed_consumption_ink_wh_per_hundredkm, 'str') + if current_charge_ink_wh is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_ink_wh", current_charge_ink_wh, 'str') + if max_charge_ink_wh is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_ink_wh", max_charge_ink_wh, 'str') + if auxiliary_power_ink_w is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_ink_w", auxiliary_power_ink_w, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('RouteDirectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_directions.metadata = {'url': '/route/directions/{format}'} # type: ignore + + async def post_route_directions( + self, + format: Union[str, "_models.TextFormat"], + query: str, + post_route_directions_request_body: "_models.PostRouteDirectionsRequestBody", + 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_order: Optional[bool] = None, + route_representation: Optional[Union[str, "_models.RouteRepresentation"]] = None, + compute_travel_time_for: Optional[Union[str, "_models.ComputeTravelTimeFor"]] = None, + vehicle_heading: Optional[int] = None, + report: Optional[str] = None, + 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] = None, + vehicle_length: Optional[float] = None, + vehicle_height: Optional[float] = None, + vehicle_width: Optional[float] = None, + vehicle_max_speed: Optional[int] = None, + vehicle_weight: Optional[int] = None, + vehicle_commercial: Optional[bool] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + hilliness: Optional[Union[str, "_models.HillinessDegree"]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + traffic: 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_hundredkm: Optional[float] = None, + current_fuel_in_liters: Optional[float] = None, + auxiliary_power_in_liters_per_hour: Optional[float] = None, + fuel_energy_density_in_m_joules_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_ink_wh_per_hundredkm: Optional[str] = None, + current_charge_ink_wh: Optional[str] = None, + max_charge_ink_wh: Optional[str] = None, + auxiliary_power_ink_w: Optional[str] = None, + **kwargs: Any + ) -> "_models.RouteDirectionsResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.TextFormat + :param query: The Coordinates through which the route is calculated. Needs two coordinates at + least. Delimited by colon. First one is the origin and the last is the destination of the + route. The coordinates are in a lat,long format. Optional coordinates in between act as + WayPoints in the route. + :type query: str + :param post_route_directions_request_body: 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 post_route_directions_request_body: ~azure.maps.route.models.PostRouteDirectionsRequestBody + :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_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_order: bool + :param route_representation: 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: str or ~azure.maps.route.models.RouteRepresentation + :param compute_travel_time_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :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 + :param 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 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 vehicle_commercial: Vehicle is used for commercial purposes and thus may not be allowed + to drive on some roads. + :type vehicle_commercial: 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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_hundredkm: 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_hundredkm: float + :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_m_joules_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_m_joules_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_ink_wh_per_hundredkm: 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_ink_wh_per_hundredkm: str + :param current_charge_ink_wh: 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_ink_wh: str + :param max_charge_ink_wh: 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_ink_wh: str + :param auxiliary_power_ink_w: 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_ink_w: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsResponse"] + 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_route_directions.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') + 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_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_order", compute_best_order, 'bool') + if route_representation is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation", route_representation, 'str') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, '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 section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 vehicle_commercial is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("vehicle_commercial", vehicle_commercial, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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_hundredkm is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundredkm", constant_speed_consumption_in_liters_per_hundredkm, 'float') + 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_m_joules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_m_joules_per_liter", fuel_energy_density_in_m_joules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float') + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float') + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float') + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float') + if constant_speed_consumption_ink_wh_per_hundredkm is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_ink_wh_per_hundredkm", constant_speed_consumption_ink_wh_per_hundredkm, 'str') + if current_charge_ink_wh is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_ink_wh", current_charge_ink_wh, 'str') + if max_charge_ink_wh is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_ink_wh", max_charge_ink_wh, 'str') + if auxiliary_power_ink_w is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_ink_w", auxiliary_power_ink_w, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_directions_request_body, 'PostRouteDirectionsRequestBody') + 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('RouteDirectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_route_directions.metadata = {'url': '/route/directions/{format}'} # type: ignore + + async def get_route_range( + self, + format: Union[str, "_models.TextFormat"], + query: str, + fuel_budget_in_liters: Optional[float] = None, + energy_budget_ink_wh: 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, + traffic: Optional[bool] = None, + avoid: Optional[List[Union[str, "_models.RouteAvoidType"]]] = None, + travel_mode: Optional[Union[str, "_models.TravelMode"]] = None, + hilliness: Optional[Union[str, "_models.HillinessDegree"]] = None, + windingness: Optional[Union[str, "_models.WindingnessLevel"]] = None, + vehicle_axle_weight: Optional[int] = None, + vehicle_width: Optional[float] = None, + vehicle_height: Optional[float] = None, + vehicle_length: Optional[float] = None, + vehicle_max_speed: Optional[int] = None, + vehicle_weight: Optional[int] = None, + vehicle_commercial: Optional[bool] = 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_hundredkm: Optional[float] = None, + current_fuel_in_liters: Optional[float] = None, + auxiliary_power_in_liters_per_hour: Optional[float] = None, + fuel_energy_density_in_m_joules_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_ink_wh_per_hundredkm: Optional[str] = None, + current_charge_ink_wh: Optional[str] = None, + max_charge_ink_wh: Optional[str] = None, + auxiliary_power_ink_w: Optional[str] = None, + **kwargs: Any + ) -> "_models.GetRouteRangeResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.TextFormat + :param query: The Coordinate from which the range calculation should start. + :type query: str + :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_ink_wh: 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_ink_wh: 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 traffic: 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 traffic: 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 vehicle_commercial: Vehicle is used for commercial purposes and thus may not be allowed + to drive on some roads. + :type vehicle_commercial: 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_hundredkm: 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_hundredkm: float + :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_m_joules_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_m_joules_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_ink_wh_per_hundredkm: 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_ink_wh_per_hundredkm: str + :param current_charge_ink_wh: 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_ink_wh: str + :param max_charge_ink_wh: 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_ink_wh: str + :param auxiliary_power_ink_w: 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_ink_w: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetRouteRangeResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.GetRouteRangeResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetRouteRangeResponse"] + 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 = { + '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') + 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_ink_wh is not None: + query_parameters['energyBudgetInkWh'] = self._serialize.query("energy_budget_ink_wh", energy_budget_ink_wh, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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 hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 vehicle_commercial is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("vehicle_commercial", vehicle_commercial, '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_hundredkm is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundredkm", constant_speed_consumption_in_liters_per_hundredkm, 'float') + 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_m_joules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_m_joules_per_liter", fuel_energy_density_in_m_joules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float') + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float') + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float') + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float') + if constant_speed_consumption_ink_wh_per_hundredkm is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_ink_wh_per_hundredkm", constant_speed_consumption_ink_wh_per_hundredkm, 'str') + if current_charge_ink_wh is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_ink_wh", current_charge_ink_wh, 'str') + if max_charge_ink_wh is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_ink_wh", max_charge_ink_wh, 'str') + if auxiliary_power_ink_w is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_ink_w", auxiliary_power_ink_w, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetRouteRangeResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_range.metadata = {'url': '/route/range/{format}'} # type: ignore + + async def _post_route_directions_batch_initial( + self, + format: Union[str, "_models.ResponseFormat"], + post_route_directions_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> Optional["_models.RouteDirectionsBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResponse"]] + 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_route_directions_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_directions_batch_request_body, 'BatchRequestBody') + 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('RouteDirectionsBatchResponse', 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 + _post_route_directions_batch_initial.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + async def begin_post_route_directions_batch( + self, + format: Union[str, "_models.ResponseFormat"], + post_route_directions_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteDirectionsBatchResponse"]: + """**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} + + 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/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/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: + + + * + `\ ``RouteDirectionsResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_directions_batch_request_body: 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 post_route_directions_batch_request_body: ~azure.maps.route.models.BatchRequestBody + :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 RouteDirectionsBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteDirectionsBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResponse"] + 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._post_route_directions_batch_initial( + format=format, + post_route_directions_batch_request_body=post_route_directions_batch_request_body, + 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('RouteDirectionsBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_route_directions_batch.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + async def _get_route_directions_batch_initial( + self, + format: str, + **kwargs: Any + ) -> Optional["_models.RouteDirectionsBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResponse"]] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('RouteDirectionsBatchResponse', 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, + format: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.RouteDirectionsBatchResponse"]: + """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/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: + + + * + `\ ``RouteDirectionsResponse`` + `_ + - 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 format: Batch id for querying the operation. + :type format: 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 RouteDirectionsBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.route.models.RouteDirectionsBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResponse"] + 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( + 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('RouteDirectionsBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 post_route_directions_batch_sync( + self, + format: Union[str, "_models.ResponseFormat"], + post_route_directions_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> "_models.RouteDirectionsBatchResponse": + """**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} + + 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/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/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: + + + * + `\ ``RouteDirectionsResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_directions_batch_request_body: 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 post_route_directions_batch_request_body: ~azure.maps.route.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResponse"] + 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.post_route_directions_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_directions_batch_request_body, 'BatchRequestBody') + 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('RouteDirectionsBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_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..1d4c05e7c1dd --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/__init__.py @@ -0,0 +1,222 @@ +# 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 BatchItem + from ._models_py3 import BatchRequestBody + from ._models_py3 import BatchRequestBodyBatchItemsItem + from ._models_py3 import BatchResponse + from ._models_py3 import BatchResponseSummary + from ._models_py3 import CoordinatesPair + 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 GetRouteRangeResponse + from ._models_py3 import PostRouteDirectionsRequestBody + from ._models_py3 import PostRouteMatrixRequestBody + from ._models_py3 import RouteDirectionsBatchItem + from ._models_py3 import RouteDirectionsBatchItemResponse + from ._models_py3 import RouteDirectionsBatchResponse + from ._models_py3 import RouteDirectionsResponse + from ._models_py3 import RouteDirectionsResult + from ._models_py3 import RouteDirectionsSummary + from ._models_py3 import RouteMatrixResponse + 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 RouteResponseReport + from ._models_py3 import RouteResponseReportEffectiveSetting + from ._models_py3 import RouteResultGuidance + from ._models_py3 import RouteResultInstruction + from ._models_py3 import RouteResultInstructionGroup + from ._models_py3 import RouteResultLeg + from ._models_py3 import RouteResultLegSummary + from ._models_py3 import RouteResultSection + from ._models_py3 import RouteResultSectionTec + from ._models_py3 import RouteResultSectionTecCause +except (SyntaxError, ImportError): + from ._models import BatchItem # type: ignore + from ._models import BatchRequestBody # type: ignore + from ._models import BatchRequestBodyBatchItemsItem # type: ignore + from ._models import BatchResponse # type: ignore + from ._models import BatchResponseSummary # type: ignore + from ._models import CoordinatesPair # 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 GetRouteRangeResponse # type: ignore + from ._models import PostRouteDirectionsRequestBody # type: ignore + from ._models import PostRouteMatrixRequestBody # type: ignore + from ._models import RouteDirectionsBatchItem # type: ignore + from ._models import RouteDirectionsBatchItemResponse # type: ignore + from ._models import RouteDirectionsBatchResponse # type: ignore + from ._models import RouteDirectionsResponse # type: ignore + from ._models import RouteDirectionsResult # type: ignore + from ._models import RouteDirectionsSummary # type: ignore + from ._models import RouteMatrixResponse # 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 RouteResponseReport # type: ignore + from ._models import RouteResponseReportEffectiveSetting # type: ignore + from ._models import RouteResultGuidance # type: ignore + from ._models import RouteResultInstruction # type: ignore + from ._models import RouteResultInstructionGroup # type: ignore + from ._models import RouteResultLeg # type: ignore + from ._models import RouteResultLegSummary # type: ignore + from ._models import RouteResultSection # type: ignore + from ._models import RouteResultSectionTec # type: ignore + from ._models import RouteResultSectionTecCause # type: ignore + +from ._route_client_enums import ( + AlternativeRouteType, + ComputeTravelTimeFor, + DrivingSide, + GeoJsonObjectType, + GeographicResourceLocation, + Geography, + GuidanceInstructionType, + GuidanceManeuver, + HillinessDegree, + JunctionType, + MagnitudeOfDelay, + ResponseFormat, + RouteAvoidType, + RouteInstructionsType, + RouteRepresentation, + RouteType, + SectionType, + TextFormat, + TravelMode, + VehicleEngineType, + VehicleLoadType, + WindingnessLevel, +) + +__all__ = [ + 'BatchItem', + 'BatchRequestBody', + 'BatchRequestBodyBatchItemsItem', + 'BatchResponse', + 'BatchResponseSummary', + 'CoordinatesPair', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'GetRouteRangeResponse', + 'PostRouteDirectionsRequestBody', + 'PostRouteMatrixRequestBody', + 'RouteDirectionsBatchItem', + 'RouteDirectionsBatchItemResponse', + 'RouteDirectionsBatchResponse', + 'RouteDirectionsResponse', + 'RouteDirectionsResult', + 'RouteDirectionsSummary', + 'RouteMatrixResponse', + 'RouteMatrixResult', + 'RouteMatrixResultResponse', + 'RouteMatrixSummary', + 'RouteOptimizedWaypoint', + 'RouteRange', + 'RouteResponseReport', + 'RouteResponseReportEffectiveSetting', + 'RouteResultGuidance', + 'RouteResultInstruction', + 'RouteResultInstructionGroup', + 'RouteResultLeg', + 'RouteResultLegSummary', + 'RouteResultSection', + 'RouteResultSectionTec', + 'RouteResultSectionTecCause', + 'AlternativeRouteType', + 'ComputeTravelTimeFor', + 'DrivingSide', + 'GeoJsonObjectType', + 'GeographicResourceLocation', + 'Geography', + 'GuidanceInstructionType', + 'GuidanceManeuver', + 'HillinessDegree', + 'JunctionType', + 'MagnitudeOfDelay', + 'ResponseFormat', + 'RouteAvoidType', + 'RouteInstructionsType', + 'RouteRepresentation', + 'RouteType', + 'SectionType', + 'TextFormat', + '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..a8a3a2b27bea --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_models.py @@ -0,0 +1,2003 @@ +# 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 BatchItem(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: float + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchRequestBody(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.BatchRequestBodyBatchItemsItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestBodyBatchItemsItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestBody, self).__init__(**kwargs) + self.batch_items = kwargs.get('batch_items', None) + + +class BatchRequestBodyBatchItemsItem(msrest.serialization.Model): + """Batch Query object. + + :param query: Partial query string. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestBodyBatchItemsItem, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + + +class BatchResponse(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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.route.models.BatchResponseSummary + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResponse, self).__init__(**kwargs) + self.summary = None + + +class BatchResponseSummary(msrest.serialization.Model): + """Summary 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(BatchResponseSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class CoordinatesPair(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(CoordinatesPair, self).__init__(**kwargs) + self.latitude = kwargs.get('latitude', None) + self.longitude = kwargs.get('longitude', 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 GetRouteRangeResponse(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.RouteResponseReport + """ + + _validation = { + 'format_version': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'reachable_range': {'key': 'reachableRange', 'type': 'RouteRange'}, + 'report': {'key': 'report', 'type': 'RouteResponseReport'}, + } + + def __init__( + self, + **kwargs + ): + super(GetRouteRangeResponse, self).__init__(**kwargs) + self.format_version = None + self.reachable_range = kwargs.get('reachable_range', None) + self.report = kwargs.get('report', None) + + +class PostRouteDirectionsRequestBody(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. + :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(PostRouteDirectionsRequestBody, 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 PostRouteMatrixRequestBody(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(PostRouteMatrixRequestBody, self).__init__(**kwargs) + self.origins = kwargs.get('origins', None) + self.destinations = kwargs.get('destinations', None) + + +class RouteDirectionsBatchItem(BatchItem): + """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: float + :ivar response: The result of the query. RouteDirectionsResponse 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': 'float'}, + 'response': {'key': 'response', 'type': 'RouteDirectionsBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchItem, self).__init__(**kwargs) + self.response = None + + +class RouteDirectionsResponse(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.RouteDirectionsResult] + :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.RouteResponseReport + """ + + _validation = { + 'format_version': {'readonly': True}, + 'routes': {'readonly': True}, + 'optimized_waypoints': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[RouteDirectionsResult]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteResponseReport'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsResponse, self).__init__(**kwargs) + self.format_version = None + self.routes = None + self.optimized_waypoints = None + self.report = kwargs.get('report', None) + + +class RouteDirectionsBatchItemResponse(ErrorResponse, RouteDirectionsResponse): + """The result of the query. RouteDirectionsResponse 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.RouteDirectionsResult] + :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.RouteResponseReport + :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': '[RouteDirectionsResult]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteResponseReport'}, + '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 RouteDirectionsBatchResponse(BatchResponse): + """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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.route.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.route.models.RouteDirectionsBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[RouteDirectionsBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class RouteDirectionsResult(msrest.serialization.Model): + """RouteDirectionsResult. + + 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.RouteDirectionsSummary + :ivar legs: Legs array. + :vartype legs: list[~azure.maps.route.models.RouteResultLeg] + :ivar sections: Sections array. + :vartype sections: list[~azure.maps.route.models.RouteResultSection] + :ivar guidance: Contains guidance related elements. This field is present only when guidance + was requested and is available. + :vartype guidance: ~azure.maps.route.models.RouteResultGuidance + """ + + _validation = { + 'summary': {'readonly': True}, + 'legs': {'readonly': True}, + 'sections': {'readonly': True}, + 'guidance': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteDirectionsSummary'}, + 'legs': {'key': 'legs', 'type': '[RouteResultLeg]'}, + 'sections': {'key': 'sections', 'type': '[RouteResultSection]'}, + 'guidance': {'key': 'guidance', 'type': 'RouteResultGuidance'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsResult, self).__init__(**kwargs) + self.summary = None + self.legs = None + self.sections = None + self.guidance = None + + +class RouteDirectionsSummary(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: Departure Time property. + :vartype departure_time: str + :ivar arrival_time: Arrival Time property. + :vartype arrival_time: str + """ + + _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': 'str'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsSummary, 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 + + +class RouteMatrixResponse(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.RouteMatrixResult]] + :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': '[[RouteMatrixResult]]'}, + 'summary': {'key': 'summary', 'type': 'RouteMatrixSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResponse, self).__init__(**kwargs) + self.format_version = None + self.matrix = None + self.summary = None + + +class RouteMatrixResult(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(RouteMatrixResult, self).__init__(**kwargs) + self.status_code = None + self.response = 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 route_summary: Summary object for route section. + :vartype route_summary: ~azure.maps.route.models.RouteResultLegSummary + """ + + _validation = { + 'route_summary': {'readonly': True}, + } + + _attribute_map = { + 'route_summary': {'key': 'routeSummary', 'type': 'RouteResultLegSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResultResponse, self).__init__(**kwargs) + self.route_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.CoordinatesPair + :ivar boundary: Polygon boundary of the reachable range represented as a list of points. + :vartype boundary: list[~azure.maps.route.models.CoordinatesPair] + """ + + _validation = { + 'boundary': {'readonly': True}, + } + + _attribute_map = { + 'center': {'key': 'center', 'type': 'CoordinatesPair'}, + 'boundary': {'key': 'boundary', 'type': '[CoordinatesPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteRange, self).__init__(**kwargs) + self.center = kwargs.get('center', None) + self.boundary = None + + +class RouteResponseReport(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.RouteResponseReportEffectiveSetting] + """ + + _validation = { + 'effective_settings': {'readonly': True}, + } + + _attribute_map = { + 'effective_settings': {'key': 'effectiveSettings', 'type': '[RouteResponseReportEffectiveSetting]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResponseReport, self).__init__(**kwargs) + self.effective_settings = None + + +class RouteResponseReportEffectiveSetting(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(RouteResponseReportEffectiveSetting, self).__init__(**kwargs) + self.key = None + self.value = None + + +class RouteResultGuidance(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.RouteResultInstruction] + :ivar instruction_groups: Groups a sequence of instruction elements which are related to each + other. + :vartype instruction_groups: list[~azure.maps.route.models.RouteResultInstructionGroup] + """ + + _validation = { + 'instructions': {'readonly': True}, + 'instruction_groups': {'readonly': True}, + } + + _attribute_map = { + 'instructions': {'key': 'instructions', 'type': '[RouteResultInstruction]'}, + 'instruction_groups': {'key': 'instructionGroups', 'type': '[RouteResultInstructionGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultGuidance, self).__init__(**kwargs) + self.instructions = None + self.instruction_groups = None + + +class RouteResultInstruction(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.CoordinatesPair + :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_decimal_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_decimal_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_decimal_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': 'CoordinatesPair'}, + '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_decimal_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(RouteResultInstruction, 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_decimal_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 RouteResultInstructionGroup(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. + :vartype first_instruction_index: int + :ivar last_instruction_index: Index of the last instruction. + :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(RouteResultInstructionGroup, self).__init__(**kwargs) + self.first_instruction_index = None + self.last_instruction_index = None + self.group_length_in_meters = None + self.group_message = None + + +class RouteResultLeg(msrest.serialization.Model): + """RouteResultLeg. + + 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.RouteResultLegSummary + :ivar points: Points array. + :vartype points: list[~azure.maps.route.models.CoordinatesPair] + """ + + _validation = { + 'summary': {'readonly': True}, + 'points': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteResultLegSummary'}, + 'points': {'key': 'points', 'type': '[CoordinatesPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultLeg, self).__init__(**kwargs) + self.summary = None + self.points = None + + +class RouteResultLegSummary(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: Departure Time property. + :vartype departure_time: str + :ivar arrival_time: Arrival Time property. + :vartype arrival_time: str + :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_ink_wh: 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_ink_wh: 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_ink_wh': {'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': 'str'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'str'}, + '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_ink_wh': {'key': 'batteryConsumptionInkWh', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultLegSummary, 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_ink_wh = None + + +class RouteResultSection(msrest.serialization.Model): + """RouteResultSection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_point_index: Start Point Index property. + :vartype start_point_index: int + :ivar end_point_index: End Point Index property. + :vartype end_point_index: int + :ivar section_type: Section Type property. + :vartype section_type: str + :ivar travel_mode: Travel Mode property. + :vartype travel_mode: str + :ivar simple_category: Type of the incident. Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or + OTHER. See "tec" for detailed information. + :vartype simple_category: str + :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 magnitude_of_delay: 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 magnitude_of_delay: str or ~azure.maps.route.models.MagnitudeOfDelay + :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.RouteResultSectionTec + """ + + _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}, + 'magnitude_of_delay': {'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'}, + 'magnitude_of_delay': {'key': 'magnitudeOfDelay', 'type': 'str'}, + 'tec': {'key': 'tec', 'type': 'RouteResultSectionTec'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultSection, 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.magnitude_of_delay = None + self.tec = kwargs.get('tec', None) + + +class RouteResultSectionTec(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.RouteResultSectionTecCause] + """ + + _validation = { + 'effect_code': {'readonly': True}, + } + + _attribute_map = { + 'effect_code': {'key': 'effectCode', 'type': 'int'}, + 'causes': {'key': 'causes', 'type': '[RouteResultSectionTecCause]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultSectionTec, self).__init__(**kwargs) + self.effect_code = None + self.causes = kwargs.get('causes', None) + + +class RouteResultSectionTecCause(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(RouteResultSectionTecCause, self).__init__(**kwargs) + self.main_cause_code = None + self.sub_cause_code = 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..180e9bbc23b0 --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_models_py3.py @@ -0,0 +1,2083 @@ +# 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 BatchItem(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: float + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchRequestBody(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.BatchRequestBodyBatchItemsItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestBodyBatchItemsItem]'}, + } + + def __init__( + self, + *, + batch_items: Optional[List["BatchRequestBodyBatchItemsItem"]] = None, + **kwargs + ): + super(BatchRequestBody, self).__init__(**kwargs) + self.batch_items = batch_items + + +class BatchRequestBodyBatchItemsItem(msrest.serialization.Model): + """Batch Query object. + + :param query: Partial query string. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + **kwargs + ): + super(BatchRequestBodyBatchItemsItem, self).__init__(**kwargs) + self.query = query + + +class BatchResponse(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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.route.models.BatchResponseSummary + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResponse, self).__init__(**kwargs) + self.summary = None + + +class BatchResponseSummary(msrest.serialization.Model): + """Summary 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(BatchResponseSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class CoordinatesPair(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(CoordinatesPair, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +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 GetRouteRangeResponse(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.RouteResponseReport + """ + + _validation = { + 'format_version': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'reachable_range': {'key': 'reachableRange', 'type': 'RouteRange'}, + 'report': {'key': 'report', 'type': 'RouteResponseReport'}, + } + + def __init__( + self, + *, + reachable_range: Optional["RouteRange"] = None, + report: Optional["RouteResponseReport"] = None, + **kwargs + ): + super(GetRouteRangeResponse, self).__init__(**kwargs) + self.format_version = None + self.reachable_range = reachable_range + self.report = report + + +class PostRouteDirectionsRequestBody(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. + :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(PostRouteDirectionsRequestBody, self).__init__(**kwargs) + self.supporting_points = supporting_points + self.avoid_vignette = avoid_vignette + self.allow_vignette = allow_vignette + self.avoid_areas = avoid_areas + + +class PostRouteMatrixRequestBody(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(PostRouteMatrixRequestBody, self).__init__(**kwargs) + self.origins = origins + self.destinations = destinations + + +class RouteDirectionsBatchItem(BatchItem): + """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: float + :ivar response: The result of the query. RouteDirectionsResponse 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': 'float'}, + 'response': {'key': 'response', 'type': 'RouteDirectionsBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchItem, self).__init__(**kwargs) + self.response = None + + +class RouteDirectionsResponse(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.RouteDirectionsResult] + :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.RouteResponseReport + """ + + _validation = { + 'format_version': {'readonly': True}, + 'routes': {'readonly': True}, + 'optimized_waypoints': {'readonly': True}, + } + + _attribute_map = { + 'format_version': {'key': 'formatVersion', 'type': 'str'}, + 'routes': {'key': 'routes', 'type': '[RouteDirectionsResult]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteResponseReport'}, + } + + def __init__( + self, + *, + report: Optional["RouteResponseReport"] = None, + **kwargs + ): + super(RouteDirectionsResponse, self).__init__(**kwargs) + self.format_version = None + self.routes = None + self.optimized_waypoints = None + self.report = report + + +class RouteDirectionsBatchItemResponse(ErrorResponse, RouteDirectionsResponse): + """The result of the query. RouteDirectionsResponse 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.RouteDirectionsResult] + :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.RouteResponseReport + :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': '[RouteDirectionsResult]'}, + 'optimized_waypoints': {'key': 'optimizedWaypoints', 'type': '[RouteOptimizedWaypoint]'}, + 'report': {'key': 'report', 'type': 'RouteResponseReport'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + report: Optional["RouteResponseReport"] = 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 RouteDirectionsBatchResponse(BatchResponse): + """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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.route.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.route.models.RouteDirectionsBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[RouteDirectionsBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class RouteDirectionsResult(msrest.serialization.Model): + """RouteDirectionsResult. + + 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.RouteDirectionsSummary + :ivar legs: Legs array. + :vartype legs: list[~azure.maps.route.models.RouteResultLeg] + :ivar sections: Sections array. + :vartype sections: list[~azure.maps.route.models.RouteResultSection] + :ivar guidance: Contains guidance related elements. This field is present only when guidance + was requested and is available. + :vartype guidance: ~azure.maps.route.models.RouteResultGuidance + """ + + _validation = { + 'summary': {'readonly': True}, + 'legs': {'readonly': True}, + 'sections': {'readonly': True}, + 'guidance': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteDirectionsSummary'}, + 'legs': {'key': 'legs', 'type': '[RouteResultLeg]'}, + 'sections': {'key': 'sections', 'type': '[RouteResultSection]'}, + 'guidance': {'key': 'guidance', 'type': 'RouteResultGuidance'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsResult, self).__init__(**kwargs) + self.summary = None + self.legs = None + self.sections = None + self.guidance = None + + +class RouteDirectionsSummary(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: Departure Time property. + :vartype departure_time: str + :ivar arrival_time: Arrival Time property. + :vartype arrival_time: str + """ + + _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': 'str'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteDirectionsSummary, 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 + + +class RouteMatrixResponse(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.RouteMatrixResult]] + :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': '[[RouteMatrixResult]]'}, + 'summary': {'key': 'summary', 'type': 'RouteMatrixSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResponse, self).__init__(**kwargs) + self.format_version = None + self.matrix = None + self.summary = None + + +class RouteMatrixResult(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(RouteMatrixResult, self).__init__(**kwargs) + self.status_code = None + self.response = 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 route_summary: Summary object for route section. + :vartype route_summary: ~azure.maps.route.models.RouteResultLegSummary + """ + + _validation = { + 'route_summary': {'readonly': True}, + } + + _attribute_map = { + 'route_summary': {'key': 'routeSummary', 'type': 'RouteResultLegSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteMatrixResultResponse, self).__init__(**kwargs) + self.route_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.CoordinatesPair + :ivar boundary: Polygon boundary of the reachable range represented as a list of points. + :vartype boundary: list[~azure.maps.route.models.CoordinatesPair] + """ + + _validation = { + 'boundary': {'readonly': True}, + } + + _attribute_map = { + 'center': {'key': 'center', 'type': 'CoordinatesPair'}, + 'boundary': {'key': 'boundary', 'type': '[CoordinatesPair]'}, + } + + def __init__( + self, + *, + center: Optional["CoordinatesPair"] = None, + **kwargs + ): + super(RouteRange, self).__init__(**kwargs) + self.center = center + self.boundary = None + + +class RouteResponseReport(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.RouteResponseReportEffectiveSetting] + """ + + _validation = { + 'effective_settings': {'readonly': True}, + } + + _attribute_map = { + 'effective_settings': {'key': 'effectiveSettings', 'type': '[RouteResponseReportEffectiveSetting]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResponseReport, self).__init__(**kwargs) + self.effective_settings = None + + +class RouteResponseReportEffectiveSetting(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(RouteResponseReportEffectiveSetting, self).__init__(**kwargs) + self.key = None + self.value = None + + +class RouteResultGuidance(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.RouteResultInstruction] + :ivar instruction_groups: Groups a sequence of instruction elements which are related to each + other. + :vartype instruction_groups: list[~azure.maps.route.models.RouteResultInstructionGroup] + """ + + _validation = { + 'instructions': {'readonly': True}, + 'instruction_groups': {'readonly': True}, + } + + _attribute_map = { + 'instructions': {'key': 'instructions', 'type': '[RouteResultInstruction]'}, + 'instruction_groups': {'key': 'instructionGroups', 'type': '[RouteResultInstructionGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultGuidance, self).__init__(**kwargs) + self.instructions = None + self.instruction_groups = None + + +class RouteResultInstruction(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.CoordinatesPair + :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_decimal_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_decimal_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_decimal_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': 'CoordinatesPair'}, + '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_decimal_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["CoordinatesPair"] = None, + instruction_type: Optional[Union[str, "GuidanceInstructionType"]] = None, + **kwargs + ): + super(RouteResultInstruction, 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_decimal_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 RouteResultInstructionGroup(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. + :vartype first_instruction_index: int + :ivar last_instruction_index: Index of the last instruction. + :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(RouteResultInstructionGroup, self).__init__(**kwargs) + self.first_instruction_index = None + self.last_instruction_index = None + self.group_length_in_meters = None + self.group_message = None + + +class RouteResultLeg(msrest.serialization.Model): + """RouteResultLeg. + + 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.RouteResultLegSummary + :ivar points: Points array. + :vartype points: list[~azure.maps.route.models.CoordinatesPair] + """ + + _validation = { + 'summary': {'readonly': True}, + 'points': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'RouteResultLegSummary'}, + 'points': {'key': 'points', 'type': '[CoordinatesPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultLeg, self).__init__(**kwargs) + self.summary = None + self.points = None + + +class RouteResultLegSummary(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: Departure Time property. + :vartype departure_time: str + :ivar arrival_time: Arrival Time property. + :vartype arrival_time: str + :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_ink_wh: 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_ink_wh: 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_ink_wh': {'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': 'str'}, + 'arrival_time': {'key': 'arrivalTime', 'type': 'str'}, + '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_ink_wh': {'key': 'batteryConsumptionInkWh', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(RouteResultLegSummary, 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_ink_wh = None + + +class RouteResultSection(msrest.serialization.Model): + """RouteResultSection. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar start_point_index: Start Point Index property. + :vartype start_point_index: int + :ivar end_point_index: End Point Index property. + :vartype end_point_index: int + :ivar section_type: Section Type property. + :vartype section_type: str + :ivar travel_mode: Travel Mode property. + :vartype travel_mode: str + :ivar simple_category: Type of the incident. Can currently be JAM, ROAD_WORK, ROAD_CLOSURE, or + OTHER. See "tec" for detailed information. + :vartype simple_category: str + :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 magnitude_of_delay: 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 magnitude_of_delay: str or ~azure.maps.route.models.MagnitudeOfDelay + :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.RouteResultSectionTec + """ + + _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}, + 'magnitude_of_delay': {'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'}, + 'magnitude_of_delay': {'key': 'magnitudeOfDelay', 'type': 'str'}, + 'tec': {'key': 'tec', 'type': 'RouteResultSectionTec'}, + } + + def __init__( + self, + *, + tec: Optional["RouteResultSectionTec"] = None, + **kwargs + ): + super(RouteResultSection, 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.magnitude_of_delay = None + self.tec = tec + + +class RouteResultSectionTec(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.RouteResultSectionTecCause] + """ + + _validation = { + 'effect_code': {'readonly': True}, + } + + _attribute_map = { + 'effect_code': {'key': 'effectCode', 'type': 'int'}, + 'causes': {'key': 'causes', 'type': '[RouteResultSectionTecCause]'}, + } + + def __init__( + self, + *, + causes: Optional[List["RouteResultSectionTecCause"]] = None, + **kwargs + ): + super(RouteResultSectionTec, self).__init__(**kwargs) + self.effect_code = None + self.causes = causes + + +class RouteResultSectionTecCause(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(RouteResultSectionTecCause, self).__init__(**kwargs) + self.main_cause_code = None + self.sub_cause_code = 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..1f046f89670a --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/models/_route_client_enums.py @@ -0,0 +1,383 @@ +# 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 ComputeTravelTimeFor(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 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 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 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_UTURN = "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_UTURN = "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 HillinessDegree(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: low. + LOW = "low" + #: normal. + NORMAL = "normal" + #: high. + HIGH = "high" + +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 MagnitudeOfDelay(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. + ZERO = "0" + #: Minor. + ONE = "1" + #: Moderate. + TWO = "2" + #: Major. + THREE = "3" + #: Undefined, used for road closures and other indefinite delays. + FOUR = "4" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +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 RouteRepresentation(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. + ECO = "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)): + + #: Get sections if the route includes car trains. + CAR_TRAIN = "carTrain" + #: Countries the route has parts in. + COUNTRY = "country" + #: Get sections if the route includes ferries. + FERRY = "ferry" + #: Get sections if the route includes motorways. + MOTORWAY = "motorway" + #: Get sections which are suited for pedestrians. + PEDESTRIAN = "pedestrian" + #: Get sections which require a toll to be payed. + TOLL_ROAD = "tollRoad" + #: Get sections which require a toll vignette to be present. + TOLL_VIGNETTE = "tollVignette" + #: Get sections which contain traffic information. + TRAFFIC = "traffic" + #: Get sections in relation to the request parameter ``travelMode``. + TRAVEL_MODE = "travelMode" + #: Get sections if the route includes tunnels. + TUNNEL = "tunnel" + +class TextFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +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..9dbbf6c9807b --- /dev/null +++ b/sdk/maps/azure-maps-route/azure/maps/route/operations/_route_operations.py @@ -0,0 +1,3371 @@ +# 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 _post_route_matrix_initial( + self, + format, # type: Union[str, "_models.ResponseFormat"] + post_route_matrix_request_body, # type: "_models.PostRouteMatrixRequestBody" + wait_for_results=None, # type: Optional[bool] + compute_travel_time_for=None, # type: Optional[Union[str, "_models.ComputeTravelTimeFor"]] + 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=None, # type: Optional[int] + vehicle_length=None, # type: Optional[float] + vehicle_height=None, # type: Optional[float] + vehicle_width=None, # type: Optional[float] + vehicle_max_speed=None, # type: Optional[int] + vehicle_weight=None, # type: Optional[int] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + hilliness=None, # type: Optional[Union[str, "_models.HillinessDegree"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + traffic=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.RouteMatrixResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResponse"]] + 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_route_matrix_initial.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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, 'str') + if section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_matrix_request_body, 'PostRouteMatrixRequestBody') + 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('RouteMatrixResponse', 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 + _post_route_matrix_initial.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + def begin_post_route_matrix( + self, + format, # type: Union[str, "_models.ResponseFormat"] + post_route_matrix_request_body, # type: "_models.PostRouteMatrixRequestBody" + wait_for_results=None, # type: Optional[bool] + compute_travel_time_for=None, # type: Optional[Union[str, "_models.ComputeTravelTimeFor"]] + 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=None, # type: Optional[int] + vehicle_length=None, # type: Optional[float] + vehicle_height=None, # type: Optional[float] + vehicle_width=None, # type: Optional[float] + vehicle_max_speed=None, # type: Optional[int] + vehicle_weight=None, # type: Optional[int] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + hilliness=None, # type: Optional[Union[str, "_models.HillinessDegree"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + traffic=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.RouteMatrixResponse"] + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_matrix_request_body: 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 post_route_matrix_request_body: ~azure.maps.route.models.PostRouteMatrixRequestBody + :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_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :param 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 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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 RouteMatrixResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteMatrixResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResponse"] + 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._post_route_matrix_initial( + format=format, + post_route_matrix_request_body=post_route_matrix_request_body, + wait_for_results=wait_for_results, + compute_travel_time_for=compute_travel_time_for, + section_type=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, + hilliness=hilliness, + travel_mode=travel_mode, + avoid=avoid, + traffic=traffic, + 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('RouteMatrixResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_route_matrix.metadata = {'url': '/route/matrix/{format}'} # type: ignore + + def _get_route_matrix_initial( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteMatrixResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteMatrixResponse"]] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('RouteMatrixResponse', 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, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteMatrixResponse"] + """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 format: Matrix id received after the Matrix Route request was accepted successfully. + :type format: 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 RouteMatrixResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteMatrixResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResponse"] + 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( + 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('RouteMatrixResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 post_route_matrix_sync( + self, + format, # type: Union[str, "_models.ResponseFormat"] + post_route_matrix_request_body, # type: "_models.PostRouteMatrixRequestBody" + wait_for_results=None, # type: Optional[bool] + compute_travel_time_for=None, # type: Optional[Union[str, "_models.ComputeTravelTimeFor"]] + 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=None, # type: Optional[int] + vehicle_length=None, # type: Optional[float] + vehicle_height=None, # type: Optional[float] + vehicle_width=None, # type: Optional[float] + vehicle_max_speed=None, # type: Optional[int] + vehicle_weight=None, # type: Optional[int] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + hilliness=None, # type: Optional[Union[str, "_models.HillinessDegree"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + traffic=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.RouteMatrixResponse" + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_matrix_request_body: 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 post_route_matrix_request_body: ~azure.maps.route.models.PostRouteMatrixRequestBody + :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_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :param 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 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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: RouteMatrixResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteMatrixResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteMatrixResponse"] + 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.post_route_matrix_sync.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') + if wait_for_results is not None: + query_parameters['waitForResults'] = self._serialize.query("wait_for_results", wait_for_results, 'bool') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, 'str') + if section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_matrix_request_body, 'PostRouteMatrixRequestBody') + 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('RouteMatrixResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_route_matrix_sync.metadata = {'url': '/route/matrix/sync/{format}'} # type: ignore + + def get_route_directions( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + 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_order=None, # type: Optional[bool] + route_representation=None, # type: Optional[Union[str, "_models.RouteRepresentation"]] + compute_travel_time_for=None, # type: Optional[Union[str, "_models.ComputeTravelTimeFor"]] + vehicle_heading=None, # type: Optional[int] + report=None, # type: Optional[str] + section_type=None, # type: Optional[Union[str, "_models.SectionType"]] + vehicle_axle_weight=None, # type: Optional[int] + vehicle_width=None, # type: Optional[float] + vehicle_height=None, # type: Optional[float] + vehicle_length=None, # type: Optional[float] + vehicle_max_speed=None, # type: Optional[int] + vehicle_weight=None, # type: Optional[int] + vehicle_commercial=None, # type: Optional[bool] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + hilliness=None, # type: Optional[Union[str, "_models.HillinessDegree"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + traffic=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_hundredkm=None, # type: Optional[float] + current_fuel_in_liters=None, # type: Optional[float] + auxiliary_power_in_liters_per_hour=None, # type: Optional[float] + fuel_energy_density_in_m_joules_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_ink_wh_per_hundredkm=None, # type: Optional[str] + current_charge_ink_wh=None, # type: Optional[str] + max_charge_ink_wh=None, # type: Optional[str] + auxiliary_power_ink_w=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteDirectionsResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.TextFormat + :param query: 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 query: str + :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_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_order: bool + :param route_representation: 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: str or ~azure.maps.route.models.RouteRepresentation + :param compute_travel_time_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :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 + :param 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 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 vehicle_commercial: Vehicle is used for commercial purposes and thus may not be allowed + to drive on some roads. + :type vehicle_commercial: 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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_hundredkm: 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_hundredkm: float + :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_m_joules_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_m_joules_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_ink_wh_per_hundredkm: 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_ink_wh_per_hundredkm: str + :param current_charge_ink_wh: 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_ink_wh: str + :param max_charge_ink_wh: 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_ink_wh: str + :param auxiliary_power_ink_w: 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_ink_w: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsResponse"] + 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 = { + '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') + 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_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_order", compute_best_order, 'bool') + if route_representation is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation", route_representation, 'str') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, '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 section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 vehicle_commercial is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("vehicle_commercial", vehicle_commercial, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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_hundredkm is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundredkm", constant_speed_consumption_in_liters_per_hundredkm, 'float') + 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_m_joules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_m_joules_per_liter", fuel_energy_density_in_m_joules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float') + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float') + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float') + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float') + if constant_speed_consumption_ink_wh_per_hundredkm is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_ink_wh_per_hundredkm", constant_speed_consumption_ink_wh_per_hundredkm, 'str') + if current_charge_ink_wh is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_ink_wh", current_charge_ink_wh, 'str') + if max_charge_ink_wh is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_ink_wh", max_charge_ink_wh, 'str') + if auxiliary_power_ink_w is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_ink_w", auxiliary_power_ink_w, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('RouteDirectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_directions.metadata = {'url': '/route/directions/{format}'} # type: ignore + + def post_route_directions( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + post_route_directions_request_body, # type: "_models.PostRouteDirectionsRequestBody" + 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_order=None, # type: Optional[bool] + route_representation=None, # type: Optional[Union[str, "_models.RouteRepresentation"]] + compute_travel_time_for=None, # type: Optional[Union[str, "_models.ComputeTravelTimeFor"]] + vehicle_heading=None, # type: Optional[int] + report=None, # type: Optional[str] + 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=None, # type: Optional[int] + vehicle_length=None, # type: Optional[float] + vehicle_height=None, # type: Optional[float] + vehicle_width=None, # type: Optional[float] + vehicle_max_speed=None, # type: Optional[int] + vehicle_weight=None, # type: Optional[int] + vehicle_commercial=None, # type: Optional[bool] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + hilliness=None, # type: Optional[Union[str, "_models.HillinessDegree"]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + traffic=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_hundredkm=None, # type: Optional[float] + current_fuel_in_liters=None, # type: Optional[float] + auxiliary_power_in_liters_per_hour=None, # type: Optional[float] + fuel_energy_density_in_m_joules_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_ink_wh_per_hundredkm=None, # type: Optional[str] + current_charge_ink_wh=None, # type: Optional[str] + max_charge_ink_wh=None, # type: Optional[str] + auxiliary_power_ink_w=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteDirectionsResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.TextFormat + :param query: The Coordinates through which the route is calculated. Needs two coordinates at + least. Delimited by colon. First one is the origin and the last is the destination of the + route. The coordinates are in a lat,long format. Optional coordinates in between act as + WayPoints in the route. + :type query: str + :param post_route_directions_request_body: 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 post_route_directions_request_body: ~azure.maps.route.models.PostRouteDirectionsRequestBody + :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_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_order: bool + :param route_representation: 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: str or ~azure.maps.route.models.RouteRepresentation + :param compute_travel_time_for: 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_for: str or ~azure.maps.route.models.ComputeTravelTimeFor + :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 + :param 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 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 vehicle_commercial: Vehicle is used for commercial purposes and thus may not be allowed + to drive on some roads. + :type vehicle_commercial: 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 traffic: 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 traffic: 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_hundredkm: 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_hundredkm: float + :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_m_joules_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_m_joules_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_ink_wh_per_hundredkm: 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_ink_wh_per_hundredkm: str + :param current_charge_ink_wh: 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_ink_wh: str + :param max_charge_ink_wh: 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_ink_wh: str + :param auxiliary_power_ink_w: 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_ink_w: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsResponse"] + 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_route_directions.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') + 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_order is not None: + query_parameters['computeBestOrder'] = self._serialize.query("compute_best_order", compute_best_order, 'bool') + if route_representation is not None: + query_parameters['routeRepresentation'] = self._serialize.query("route_representation", route_representation, 'str') + if compute_travel_time_for is not None: + query_parameters['computeTravelTimeFor'] = self._serialize.query("compute_travel_time_for", compute_travel_time_for, '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 section_type is not None: + query_parameters['sectionType'] = self._serialize.query("section_type", 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 vehicle_commercial is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("vehicle_commercial", vehicle_commercial, 'bool') + if windingness is not None: + query_parameters['windingness'] = self._serialize.query("windingness", windingness, 'str') + if hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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_hundredkm is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundredkm", constant_speed_consumption_in_liters_per_hundredkm, 'float') + 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_m_joules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_m_joules_per_liter", fuel_energy_density_in_m_joules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float') + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float') + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float') + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float') + if constant_speed_consumption_ink_wh_per_hundredkm is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_ink_wh_per_hundredkm", constant_speed_consumption_ink_wh_per_hundredkm, 'str') + if current_charge_ink_wh is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_ink_wh", current_charge_ink_wh, 'str') + if max_charge_ink_wh is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_ink_wh", max_charge_ink_wh, 'str') + if auxiliary_power_ink_w is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_ink_w", auxiliary_power_ink_w, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_directions_request_body, 'PostRouteDirectionsRequestBody') + 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('RouteDirectionsResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_route_directions.metadata = {'url': '/route/directions/{format}'} # type: ignore + + def get_route_range( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + fuel_budget_in_liters=None, # type: Optional[float] + energy_budget_ink_wh=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"]] + traffic=None, # type: Optional[bool] + avoid=None, # type: Optional[List[Union[str, "_models.RouteAvoidType"]]] + travel_mode=None, # type: Optional[Union[str, "_models.TravelMode"]] + hilliness=None, # type: Optional[Union[str, "_models.HillinessDegree"]] + windingness=None, # type: Optional[Union[str, "_models.WindingnessLevel"]] + vehicle_axle_weight=None, # type: Optional[int] + vehicle_width=None, # type: Optional[float] + vehicle_height=None, # type: Optional[float] + vehicle_length=None, # type: Optional[float] + vehicle_max_speed=None, # type: Optional[int] + vehicle_weight=None, # type: Optional[int] + vehicle_commercial=None, # 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_hundredkm=None, # type: Optional[float] + current_fuel_in_liters=None, # type: Optional[float] + auxiliary_power_in_liters_per_hour=None, # type: Optional[float] + fuel_energy_density_in_m_joules_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_ink_wh_per_hundredkm=None, # type: Optional[str] + current_charge_ink_wh=None, # type: Optional[str] + max_charge_ink_wh=None, # type: Optional[str] + auxiliary_power_ink_w=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.GetRouteRangeResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.route.models.TextFormat + :param query: The Coordinate from which the range calculation should start. + :type query: str + :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_ink_wh: 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_ink_wh: 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 traffic: 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 traffic: 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 hilliness: Degree of hilliness for thrilling route. This parameter can only be used in + conjunction with ``routeType``\ =thrilling. + :type hilliness: str or ~azure.maps.route.models.HillinessDegree + :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 vehicle_commercial: Vehicle is used for commercial purposes and thus may not be allowed + to drive on some roads. + :type vehicle_commercial: 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_hundredkm: 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_hundredkm: float + :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_m_joules_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_m_joules_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_ink_wh_per_hundredkm: 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_ink_wh_per_hundredkm: str + :param current_charge_ink_wh: 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_ink_wh: str + :param max_charge_ink_wh: 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_ink_wh: str + :param auxiliary_power_ink_w: 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_ink_w: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GetRouteRangeResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.GetRouteRangeResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GetRouteRangeResponse"] + 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 = { + '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') + 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_ink_wh is not None: + query_parameters['energyBudgetInkWh'] = self._serialize.query("energy_budget_ink_wh", energy_budget_ink_wh, '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 traffic is not None: + query_parameters['traffic'] = self._serialize.query("traffic", traffic, '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 hilliness is not None: + query_parameters['hilliness'] = self._serialize.query("hilliness", hilliness, '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 vehicle_commercial is not None: + query_parameters['vehicleCommercial'] = self._serialize.query("vehicle_commercial", vehicle_commercial, '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_hundredkm is not None: + query_parameters['constantSpeedConsumptionInLitersPerHundredkm'] = self._serialize.query("constant_speed_consumption_in_liters_per_hundredkm", constant_speed_consumption_in_liters_per_hundredkm, 'float') + 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_m_joules_per_liter is not None: + query_parameters['fuelEnergyDensityInMJoulesPerLiter'] = self._serialize.query("fuel_energy_density_in_m_joules_per_liter", fuel_energy_density_in_m_joules_per_liter, 'float') + if acceleration_efficiency is not None: + query_parameters['accelerationEfficiency'] = self._serialize.query("acceleration_efficiency", acceleration_efficiency, 'float') + if deceleration_efficiency is not None: + query_parameters['decelerationEfficiency'] = self._serialize.query("deceleration_efficiency", deceleration_efficiency, 'float') + if uphill_efficiency is not None: + query_parameters['uphillEfficiency'] = self._serialize.query("uphill_efficiency", uphill_efficiency, 'float') + if downhill_efficiency is not None: + query_parameters['downhillEfficiency'] = self._serialize.query("downhill_efficiency", downhill_efficiency, 'float') + if constant_speed_consumption_ink_wh_per_hundredkm is not None: + query_parameters['constantSpeedConsumptionInkWhPerHundredkm'] = self._serialize.query("constant_speed_consumption_ink_wh_per_hundredkm", constant_speed_consumption_ink_wh_per_hundredkm, 'str') + if current_charge_ink_wh is not None: + query_parameters['currentChargeInkWh'] = self._serialize.query("current_charge_ink_wh", current_charge_ink_wh, 'str') + if max_charge_ink_wh is not None: + query_parameters['maxChargeInkWh'] = self._serialize.query("max_charge_ink_wh", max_charge_ink_wh, 'str') + if auxiliary_power_ink_w is not None: + query_parameters['auxiliaryPowerInkW'] = self._serialize.query("auxiliary_power_ink_w", auxiliary_power_ink_w, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('GetRouteRangeResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_route_range.metadata = {'url': '/route/range/{format}'} # type: ignore + + def _post_route_directions_batch_initial( + self, + format, # type: Union[str, "_models.ResponseFormat"] + post_route_directions_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteDirectionsBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResponse"]] + 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_route_directions_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_directions_batch_request_body, 'BatchRequestBody') + 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('RouteDirectionsBatchResponse', 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 + _post_route_directions_batch_initial.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + def begin_post_route_directions_batch( + self, + format, # type: Union[str, "_models.ResponseFormat"] + post_route_directions_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteDirectionsBatchResponse"] + """**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} + + 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/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/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: + + + * + `\ ``RouteDirectionsResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_directions_batch_request_body: 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 post_route_directions_batch_request_body: ~azure.maps.route.models.BatchRequestBody + :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 RouteDirectionsBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteDirectionsBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResponse"] + 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._post_route_directions_batch_initial( + format=format, + post_route_directions_batch_request_body=post_route_directions_batch_request_body, + 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('RouteDirectionsBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_route_directions_batch.metadata = {'url': '/route/directions/batch/{format}'} # type: ignore + + def _get_route_directions_batch_initial( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RouteDirectionsBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RouteDirectionsBatchResponse"]] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('RouteDirectionsBatchResponse', 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, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RouteDirectionsBatchResponse"] + """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/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: + + + * + `\ ``RouteDirectionsResponse`` + `_ + - 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 format: Batch id for querying the operation. + :type format: 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 RouteDirectionsBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.route.models.RouteDirectionsBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResponse"] + 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( + 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('RouteDirectionsBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 post_route_directions_batch_sync( + self, + format, # type: Union[str, "_models.ResponseFormat"] + post_route_directions_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> "_models.RouteDirectionsBatchResponse" + """**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} + + 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/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/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: + + + * + `\ ``RouteDirectionsResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.route.models.ResponseFormat + :param post_route_directions_batch_request_body: 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 post_route_directions_batch_request_body: ~azure.maps.route.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RouteDirectionsBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.route.models.RouteDirectionsBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RouteDirectionsBatchResponse"] + 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.post_route_directions_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(post_route_directions_batch_request_body, 'BatchRequestBody') + 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('RouteDirectionsBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_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..d12673171d81 --- /dev/null +++ b/sdk/maps/azure-maps-route/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-search/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-search/README.md b/sdk/maps/azure-maps-search/README.md new file mode 100644 index 000000000000..a28df8e55b0e --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..ebc48d6c4966 --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..f10db4c63af4 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.search.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(SearchClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..0109adbc97fe --- /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": 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\": [\"SearchClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.search.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.search.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..99d1ef91bbd6 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/_search_client.py @@ -0,0 +1,89 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.search.models.Geography + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = SearchClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..1099cfdb3cc5 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.search.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(SearchClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..8a1cb84b4865 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/_search_client.py @@ -0,0 +1,82 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.search.models.Geography + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = SearchClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..f332c941aef7 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/aio/operations/_search_operations.py @@ -0,0 +1,5205 @@ +# 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 get_search_polygon( + self, + format: Union[str, "_models.ResponseFormat"], + geometries: List[str], + **kwargs: Any + ) -> "_models.SearchPolygonResponse": + """**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 dataSources 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param geometries: Comma separated list of geometry UUIDs, previously retrieved from an Online + Search request. + :type geometries: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchPolygonResponse"] + 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_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['geometries'] = self._serialize.query("geometries", geometries, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_polygon.metadata = {'url': '/search/polygon/{format}'} # type: ignore + + async def get_search_fuzzy( + self, + format: Union[str, "_models.TextFormat"], + query: str, + typeahead: Optional[bool] = None, + limit: Optional[int] = None, + ofs: Optional[int] = None, + category_set: Optional[List[int]] = None, + country_set: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius: Optional[float] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[str] = None, + min_fuzzy_level: Optional[int] = None, + max_fuzzy_level: Optional[int] = None, + idx_set: Optional[List[Union[str, "_models.SearchIndexSet"]]] = None, + brand_set: Optional[List[str]] = None, + connector_set: Optional[List[Union[str, "_models.ConnectorSet"]]] = None, + view: Optional[str] = None, + opening_hours: Optional[Union[str, "_models.OpeningHours"]] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :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 idx_set: 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 idx_set: list[str or ~azure.maps.search.models.SearchIndexSet] + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_fuzzy.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + 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 idx_set is not None: + query_parameters['idxSet'] = self._serialize.query("idx_set", idx_set, '[str]', div=',') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_fuzzy.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore + + async def get_search_poi( + self, + format: Union[str, "_models.TextFormat"], + query: str, + typeahead: Optional[bool] = None, + limit: Optional[int] = None, + ofs: Optional[int] = None, + category_set: Optional[List[int]] = None, + country_set: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius: Optional[float] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[str] = None, + brand_set: Optional[List[str]] = None, + connector_set: Optional[List[Union[str, "_models.ConnectorSet"]]] = None, + view: Optional[str] = None, + opening_hours: Optional[Union[str, "_models.OpeningHours"]] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be + properly URL encoded. + :type query: str + :param typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_poi.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_poi.metadata = {'url': '/search/poi/{format}'} # type: ignore + + async def get_search_nearby( + self, + format: Union[str, "_models.TextFormat"], + lat: float, + lon: float, + limit: Optional[int] = None, + ofs: Optional[int] = None, + category_set: Optional[List[int]] = None, + country_set: Optional[List[str]] = None, + radius: Optional[float] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[str] = None, + brand_set: Optional[List[str]] = None, + connector_set: Optional[List[Union[str, "_models.ConnectorSet"]]] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: list[str] + :param radius: 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: float + :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: str + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_nearby.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("lat", lat, 'float') + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[str]', div=',') + if radius is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_nearby.metadata = {'url': '/search/nearby/{format}'} # type: ignore + + async def get_search_poi_category( + self, + format: Union[str, "_models.TextFormat"], + query: str, + typeahead: Optional[bool] = None, + limit: Optional[int] = None, + ofs: Optional[int] = None, + category_set: Optional[List[int]] = None, + country_set: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius: Optional[float] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[str] = None, + brand_set: Optional[List[str]] = None, + connector_set: Optional[List[Union[str, "_models.ConnectorSet"]]] = None, + view: Optional[str] = None, + opening_hours: Optional[Union[str, "_models.OpeningHours"]] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_poi_category.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_poi_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore + + async def get_search_poi_category_tree_preview( + self, + format: Union[str, "_models.ResponseFormat"], + language: Optional[str] = None, + **kwargs: Any + ) -> "_models.SearchPoiCategoryTreeResponse": + """**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.ResponseFormat + :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: SearchPoiCategoryTreeResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchPoiCategoryTreeResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchPoiCategoryTreeResponse"] + 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_poi_category_tree_preview.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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchPoiCategoryTreeResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_poi_category_tree_preview.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore + + async def get_search_address( + self, + format: Union[str, "_models.TextFormat"], + query: str, + typeahead: Optional[bool] = None, + limit: Optional[int] = None, + ofs: Optional[int] = None, + country_set: Optional[List[str]] = None, + lat: Optional[float] = None, + lon: Optional[float] = None, + radius: Optional[float] = None, + top_left: Optional[str] = None, + btm_right: Optional[str] = None, + language: Optional[str] = None, + extended_postal_codes_for: Optional[str] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be + properly URL encoded. + :type query: str + :param typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address.metadata = {'url': '/search/address/{format}'} # type: ignore + + async def get_search_address_reverse( + self, + format: Union[str, "_models.TextFormat"], + query: str, + language: Optional[str] = None, + return_speed_limit: Optional[bool] = None, + heading: Optional[float] = None, + radius: Optional[float] = None, + number: Optional[str] = None, + return_road_use: Optional[bool] = None, + road_use: Optional[str] = None, + allow_freeform_newline: Optional[bool] = None, + return_match_type: Optional[bool] = None, + entity_type: Optional[Union[str, "_models.EntityType"]] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> "_models.SearchAddressReverseResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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: 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 return_speed_limit: Boolean. To enable return of the posted speed limit. + :type return_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: float + :param radius: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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 return_road_use: Boolean. To enable return of the road use array for reverse geocodes at + street level. + :type return_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: str + :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 return_match_type: Include information on the type of match the geocoder achieved in the + response. + :type return_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.EntityType + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressReverseResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressReverseResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseResponse"] + 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_reverse.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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if return_speed_limit is not None: + query_parameters['returnSpeedLimit'] = self._serialize.query("return_speed_limit", return_speed_limit, 'bool') + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'float', maximum=360, minimum=-360) + if radius is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + if number is not None: + query_parameters['number'] = self._serialize.query("number", number, 'str') + if return_road_use is not None: + query_parameters['returnRoadUse'] = self._serialize.query("return_road_use", return_road_use, 'bool') + if road_use is not None: + query_parameters['roadUse'] = self._serialize.query("road_use", road_use, 'str') + if allow_freeform_newline is not None: + query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') + if return_match_type is not None: + query_parameters['returnMatchType'] = self._serialize.query("return_match_type", return_match_type, 'bool') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressReverseResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address_reverse.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore + + async def get_search_address_reverse_cross_street( + self, + format: Union[str, "_models.TextFormat"], + query: str, + limit: Optional[int] = None, + heading: Optional[float] = None, + radius: Optional[float] = None, + language: Optional[str] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> "_models.SearchAddressReverseCrossStreetResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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: str + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: 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: float + :param radius: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressReverseCrossStreetResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressReverseCrossStreetResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseCrossStreetResponse"] + 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_reverse_cross_street.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') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'float', maximum=360, minimum=-360) + if radius is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressReverseCrossStreetResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address_reverse_cross_street.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore + + async def get_search_address_structured( + self, + format: Union[str, "_models.TextFormat"], + language: Optional[str] = None, + country_code: Optional[str] = "US", + limit: Optional[int] = None, + ofs: 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[str] = None, + view: Optional[str] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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.TextFormat + :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 limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: 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: str + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_structured.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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if country_code is not None: + query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, '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') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address_structured.metadata = {'url': '/search/address/structured/{format}'} # type: ignore + + async def post_search_inside_geometry( + self, + format: Union[str, "_models.TextFormat"], + query: str, + search_inside_geometry_request_body: "_models.SearchInsideGeometryRequestBody", + limit: Optional[int] = None, + language: Optional[str] = None, + category_set: Optional[List[int]] = None, + extended_postal_codes_for: Optional[str] = None, + idx_set: Optional[List[Union[str, "_models.SearchIndexSet"]]] = None, + view: Optional[str] = None, + opening_hours: Optional[Union[str, "_models.OpeningHours"]] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param search_inside_geometry_request_body: 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 search_inside_geometry_request_body: ~azure.maps.search.models.SearchInsideGeometryRequestBody + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: 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_set: 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_set: 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: str + :param idx_set: 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 idx_set: list[str or ~azure.maps.search.models.SearchIndexSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_search_inside_geometry.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') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[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') + if idx_set is not None: + query_parameters['idxSet'] = self._serialize.query("idx_set", idx_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_inside_geometry_request_body, 'SearchInsideGeometryRequestBody') + 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('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore + + async def post_search_along_route( + self, + format: Union[str, "_models.TextFormat"], + query: str, + max_detour_time: int, + search_along_route_request_body: "_models.SearchAlongRouteRequestBody", + category_set: Optional[List[int]] = None, + limit: Optional[int] = None, + brand_set: Optional[List[str]] = None, + connector_set: Optional[List[Union[str, "_models.ConnectorSet"]]] = None, + view: Optional[str] = None, + opening_hours: Optional[Union[str, "_models.OpeningHours"]] = None, + **kwargs: Any + ) -> "_models.SearchCommonResponse": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 search_along_route_request_body: This represents the route to search along and should be + a valid ``GeoJSON LineString`` type. Please refer to `RFC 7946 + `_ for details. + :type search_along_route_request_body: ~azure.maps.search.models.SearchAlongRouteRequestBody + :param category_set: 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_set: list[int] + :param limit: Maximum number of responses that will be returned. Default value is 10. Max value + is 20. + :type limit: int + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_search_along_route.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') + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=20) + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_along_route_request_body, 'SearchAlongRouteRequestBody') + 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('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore + + async def post_search_fuzzy_batch_sync( + self, + format: Union[str, "_models.ResponseFormat"], + search_fuzzy_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> "_models.SearchFuzzyBatchResponse": + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ - + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_fuzzy_batch_request_body: 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 search_fuzzy_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchFuzzyBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchFuzzyBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchFuzzyBatchResponse"] + 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.post_search_fuzzy_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_fuzzy_batch_request_body, 'BatchRequestBody') + 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('SearchFuzzyBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_fuzzy_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore + + async def _post_search_fuzzy_batch_initial( + self, + format: Union[str, "_models.ResponseFormat"], + search_fuzzy_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> Optional["_models.SearchFuzzyBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchFuzzyBatchResponse"]] + 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_search_fuzzy_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_fuzzy_batch_request_body, 'BatchRequestBody') + 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('SearchFuzzyBatchResponse', 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 + _post_search_fuzzy_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def begin_post_search_fuzzy_batch( + self, + format: Union[str, "_models.ResponseFormat"], + search_fuzzy_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchFuzzyBatchResponse"]: + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ - + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_fuzzy_batch_request_body: 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 search_fuzzy_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :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 SearchFuzzyBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchFuzzyBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchFuzzyBatchResponse"] + 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._post_search_fuzzy_batch_initial( + format=format, + search_fuzzy_batch_request_body=search_fuzzy_batch_request_body, + 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('SearchFuzzyBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_search_fuzzy_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def _get_search_fuzzy_batch_initial( + self, + format: str, + **kwargs: Any + ) -> Optional["_models.SearchFuzzyBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchFuzzyBatchResponse"]] + 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_fuzzy_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('SearchFuzzyBatchResponse', 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_fuzzy_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def begin_get_search_fuzzy_batch( + self, + format: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchFuzzyBatchResponse"]: + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ - + 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 format: Batch id for querying the operation. + :type format: 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 SearchFuzzyBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchFuzzyBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchFuzzyBatchResponse"] + 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_fuzzy_batch_initial( + 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('SearchFuzzyBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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_fuzzy_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + async def post_search_address_batch_sync( + self, + format: Union[str, "_models.ResponseFormat"], + search_address_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> "_models.SearchAddressBatchResponse": + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_batch_request_body: 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 search_address_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResponse"] + 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.post_search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_batch_request_body, 'BatchRequestBody') + 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('SearchAddressBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore + + async def _post_search_address_batch_initial( + self, + format: Union[str, "_models.ResponseFormat"], + search_address_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResponse"]] + 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_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_batch_request_body, 'BatchRequestBody') + 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('SearchAddressBatchResponse', 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 + _post_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def begin_post_search_address_batch( + self, + format: Union[str, "_models.ResponseFormat"], + search_address_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResponse"]: + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_batch_request_body: 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 search_address_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :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 SearchAddressBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResponse"] + 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._post_search_address_batch_initial( + format=format, + search_address_batch_request_body=search_address_batch_request_body, + 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('SearchAddressBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + async def _get_search_address_batch_initial( + self, + format: str, + **kwargs: Any + ) -> Optional["_models.SearchAddressBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResponse"]] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('SearchAddressBatchResponse', 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, + format: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressBatchResponse"]: + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ + - 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 format: Batch id for querying the operation. + :type format: 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 SearchAddressBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResponse"] + 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( + 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('SearchAddressBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 post_search_address_reverse_batch_sync( + self, + format: Union[str, "_models.ResponseFormat"], + search_address_reverse_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> "_models.SearchAddressReverseBatchResponse": + """**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/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/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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_reverse_batch_request_body: 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 search_address_reverse_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressReverseBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressReverseBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseBatchResponse"] + 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.post_search_address_reverse_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_reverse_batch_request_body, 'BatchRequestBody') + 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('SearchAddressReverseBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_address_reverse_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore + + async def _post_search_address_reverse_batch_initial( + self, + format: Union[str, "_models.ResponseFormat"], + search_address_reverse_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> Optional["_models.SearchAddressReverseBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressReverseBatchResponse"]] + 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_search_address_reverse_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_reverse_batch_request_body, 'BatchRequestBody') + 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('SearchAddressReverseBatchResponse', 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 + _post_search_address_reverse_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def begin_post_search_address_reverse_batch( + self, + format: Union[str, "_models.ResponseFormat"], + search_address_reverse_batch_request_body: "_models.BatchRequestBody", + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressReverseBatchResponse"]: + """**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/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/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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_reverse_batch_request_body: 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 search_address_reverse_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :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 SearchAddressReverseBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressReverseBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseBatchResponse"] + 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._post_search_address_reverse_batch_initial( + format=format, + search_address_reverse_batch_request_body=search_address_reverse_batch_request_body, + 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('SearchAddressReverseBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_search_address_reverse_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def _get_search_address_reverse_batch_initial( + self, + format: str, + **kwargs: Any + ) -> Optional["_models.SearchAddressReverseBatchResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressReverseBatchResponse"]] + 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_reverse_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('SearchAddressReverseBatchResponse', 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_reverse_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + async def begin_get_search_address_reverse_batch( + self, + format: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.SearchAddressReverseBatchResponse"]: + """**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/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/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 format: Batch id for querying the operation. + :type format: 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 SearchAddressReverseBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.maps.search.models.SearchAddressReverseBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseBatchResponse"] + 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_reverse_batch_initial( + 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('SearchAddressReverseBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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_reverse_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..771665216418 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/__init__.py @@ -0,0 +1,237 @@ +# 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 BatchItem + from ._models_py3 import BatchRequestBody + from ._models_py3 import BatchRequestBodyBatchItemsItem + from ._models_py3 import BatchResponse + from ._models_py3 import BatchResponseSummary + from ._models_py3 import CoordinatesPairAbbreviated + from ._models_py3 import DataSources + from ._models_py3 import DataSourcesGeometry + 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 PoiCategoryResult + from ._models_py3 import SearchAddressBatchItem + from ._models_py3 import SearchAddressBatchItemResponse + from ._models_py3 import SearchAddressBatchResponse + from ._models_py3 import SearchAddressReverseBatchItem + from ._models_py3 import SearchAddressReverseBatchItemResponse + from ._models_py3 import SearchAddressReverseBatchResponse + from ._models_py3 import SearchAddressReverseCrossStreetResponse + from ._models_py3 import SearchAddressReverseCrossStreetResult + from ._models_py3 import SearchAddressReverseResponse + from ._models_py3 import SearchAddressReverseResult + from ._models_py3 import SearchAlongRouteRequestBody + from ._models_py3 import SearchCommonResponse + from ._models_py3 import SearchCommonResult + from ._models_py3 import SearchCommonSummary + from ._models_py3 import SearchCommonSummaryGeoBias + from ._models_py3 import SearchFuzzyBatchItem + from ._models_py3 import SearchFuzzyBatchItemResponse + from ._models_py3 import SearchFuzzyBatchResponse + from ._models_py3 import SearchInsideGeometryRequestBody + from ._models_py3 import SearchPoiCategoryTreeResponse + from ._models_py3 import SearchPolygonResponse + from ._models_py3 import SearchPolygonResult + from ._models_py3 import SearchResultAddress + from ._models_py3 import SearchResultAddressRanges + from ._models_py3 import SearchResultEntryPoint + from ._models_py3 import SearchResultPoi + from ._models_py3 import SearchResultPoiBrand + from ._models_py3 import SearchResultPoiCategorySet + from ._models_py3 import SearchResultPoiClassification + from ._models_py3 import SearchResultPoiClassificationName + from ._models_py3 import SearchResultPoiOpeningHours + from ._models_py3 import SearchResultPoiOpeningHoursTimeRange + from ._models_py3 import SearchResultPoiOpeningHoursTimeRangeTime + from ._models_py3 import SearchResultViewport + from ._models_py3 import SearchSummaryGeoBias +except (SyntaxError, ImportError): + from ._models import BatchItem # type: ignore + from ._models import BatchRequestBody # type: ignore + from ._models import BatchRequestBodyBatchItemsItem # type: ignore + from ._models import BatchResponse # type: ignore + from ._models import BatchResponseSummary # type: ignore + from ._models import CoordinatesPairAbbreviated # type: ignore + from ._models import DataSources # type: ignore + from ._models import DataSourcesGeometry # 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 PoiCategoryResult # type: ignore + from ._models import SearchAddressBatchItem # type: ignore + from ._models import SearchAddressBatchItemResponse # type: ignore + from ._models import SearchAddressBatchResponse # type: ignore + from ._models import SearchAddressReverseBatchItem # type: ignore + from ._models import SearchAddressReverseBatchItemResponse # type: ignore + from ._models import SearchAddressReverseBatchResponse # type: ignore + from ._models import SearchAddressReverseCrossStreetResponse # type: ignore + from ._models import SearchAddressReverseCrossStreetResult # type: ignore + from ._models import SearchAddressReverseResponse # type: ignore + from ._models import SearchAddressReverseResult # type: ignore + from ._models import SearchAlongRouteRequestBody # type: ignore + from ._models import SearchCommonResponse # type: ignore + from ._models import SearchCommonResult # type: ignore + from ._models import SearchCommonSummary # type: ignore + from ._models import SearchCommonSummaryGeoBias # type: ignore + from ._models import SearchFuzzyBatchItem # type: ignore + from ._models import SearchFuzzyBatchItemResponse # type: ignore + from ._models import SearchFuzzyBatchResponse # type: ignore + from ._models import SearchInsideGeometryRequestBody # type: ignore + from ._models import SearchPoiCategoryTreeResponse # type: ignore + from ._models import SearchPolygonResponse # type: ignore + from ._models import SearchPolygonResult # type: ignore + from ._models import SearchResultAddress # type: ignore + from ._models import SearchResultAddressRanges # type: ignore + from ._models import SearchResultEntryPoint # type: ignore + from ._models import SearchResultPoi # type: ignore + from ._models import SearchResultPoiBrand # type: ignore + from ._models import SearchResultPoiCategorySet # type: ignore + from ._models import SearchResultPoiClassification # type: ignore + from ._models import SearchResultPoiClassificationName # type: ignore + from ._models import SearchResultPoiOpeningHours # type: ignore + from ._models import SearchResultPoiOpeningHoursTimeRange # type: ignore + from ._models import SearchResultPoiOpeningHoursTimeRangeTime # type: ignore + from ._models import SearchResultViewport # type: ignore + from ._models import SearchSummaryGeoBias # type: ignore + +from ._search_client_enums import ( + ConnectorSet, + EntityType, + EntryPointType, + GeoJsonObjectType, + GeographicResourceLocation, + Geography, + OpeningHours, + ResponseFormat, + SearchIndexSet, + TextFormat, +) + +__all__ = [ + 'BatchItem', + 'BatchRequestBody', + 'BatchRequestBodyBatchItemsItem', + 'BatchResponse', + 'BatchResponseSummary', + 'CoordinatesPairAbbreviated', + 'DataSources', + 'DataSourcesGeometry', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'GeoJsonFeature', + 'GeoJsonFeatureCollection', + 'GeoJsonFeatureCollectionData', + 'GeoJsonFeatureData', + 'GeoJsonGeometry', + 'GeoJsonGeometryCollection', + 'GeoJsonGeometryCollectionData', + 'GeoJsonLineString', + 'GeoJsonLineStringData', + 'GeoJsonMultiLineString', + 'GeoJsonMultiLineStringData', + 'GeoJsonMultiPoint', + 'GeoJsonMultiPointData', + 'GeoJsonMultiPolygon', + 'GeoJsonMultiPolygonData', + 'GeoJsonObject', + 'GeoJsonPoint', + 'GeoJsonPointData', + 'GeoJsonPolygon', + 'GeoJsonPolygonData', + 'PoiCategoryResult', + 'SearchAddressBatchItem', + 'SearchAddressBatchItemResponse', + 'SearchAddressBatchResponse', + 'SearchAddressReverseBatchItem', + 'SearchAddressReverseBatchItemResponse', + 'SearchAddressReverseBatchResponse', + 'SearchAddressReverseCrossStreetResponse', + 'SearchAddressReverseCrossStreetResult', + 'SearchAddressReverseResponse', + 'SearchAddressReverseResult', + 'SearchAlongRouteRequestBody', + 'SearchCommonResponse', + 'SearchCommonResult', + 'SearchCommonSummary', + 'SearchCommonSummaryGeoBias', + 'SearchFuzzyBatchItem', + 'SearchFuzzyBatchItemResponse', + 'SearchFuzzyBatchResponse', + 'SearchInsideGeometryRequestBody', + 'SearchPoiCategoryTreeResponse', + 'SearchPolygonResponse', + 'SearchPolygonResult', + 'SearchResultAddress', + 'SearchResultAddressRanges', + 'SearchResultEntryPoint', + 'SearchResultPoi', + 'SearchResultPoiBrand', + 'SearchResultPoiCategorySet', + 'SearchResultPoiClassification', + 'SearchResultPoiClassificationName', + 'SearchResultPoiOpeningHours', + 'SearchResultPoiOpeningHoursTimeRange', + 'SearchResultPoiOpeningHoursTimeRangeTime', + 'SearchResultViewport', + 'SearchSummaryGeoBias', + 'ConnectorSet', + 'EntityType', + 'EntryPointType', + 'GeoJsonObjectType', + 'GeographicResourceLocation', + 'Geography', + 'OpeningHours', + 'ResponseFormat', + 'SearchIndexSet', + 'TextFormat', +] 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..1fb666f454a4 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_models.py @@ -0,0 +1,2268 @@ +# 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 BatchItem(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: float + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchRequestBody(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.BatchRequestBodyBatchItemsItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestBodyBatchItemsItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestBody, self).__init__(**kwargs) + self.batch_items = kwargs.get('batch_items', None) + + +class BatchRequestBodyBatchItemsItem(msrest.serialization.Model): + """Batch Query object. + + :param query: Partial query string. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchRequestBodyBatchItemsItem, self).__init__(**kwargs) + self.query = kwargs.get('query', None) + + +class BatchResponse(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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResponse, self).__init__(**kwargs) + self.summary = None + + +class BatchResponseSummary(msrest.serialization.Model): + """Summary 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(BatchResponseSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class CoordinatesPairAbbreviated(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(CoordinatesPairAbbreviated, self).__init__(**kwargs) + self.lat = kwargs.get('lat', None) + self.lon = kwargs.get('lon', None) + + +class DataSources(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.DataSourcesGeometry + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'DataSourcesGeometry'}, + } + + def __init__( + self, + **kwargs + ): + super(DataSources, self).__init__(**kwargs) + self.geometry = kwargs.get('geometry', None) + + +class DataSourcesGeometry(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(DataSourcesGeometry, self).__init__(**kwargs) + self.id = 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 PoiCategoryResult(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_category_ids: Array of child category ids. + :vartype child_category_ids: list[int] + :ivar synonyms: Array of alternative names of the category. + :vartype synonyms: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'child_category_ids': {'readonly': True}, + 'synonyms': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'child_category_ids': {'key': 'childCategoryIds', 'type': '[int]'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PoiCategoryResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.child_category_ids = None + self.synonyms = None + + +class SearchAddressBatchItem(BatchItem): + """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: float + :ivar response: The result of the query. SearchCommonResponse 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': 'float'}, + 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchCommonResponse(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.SearchCommonSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchCommonResult] + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchCommonSummary'}, + 'results': {'key': 'results', 'type': '[SearchCommonResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchCommonResponse, self).__init__(**kwargs) + self.summary = None + self.results = None + + +class SearchAddressBatchItemResponse(ErrorResponse, SearchCommonResponse): + """The result of the query. SearchCommonResponse 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.SearchCommonSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchCommonResult] + :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': 'SearchCommonSummary'}, + 'results': {'key': 'results', 'type': '[SearchCommonResult]'}, + '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 SearchAddressBatchResponse(BatchResponse): + """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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressReverseBatchItem(BatchItem): + """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: float + :ivar response: The result of the query. SearchAddressReverseResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchAddressReverseBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + 'response': {'key': 'response', 'type': 'SearchAddressReverseBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchAddressReverseResponse(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.SearchCommonSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.SearchAddressReverseResult] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchCommonSummary'}, + 'addresses': {'key': 'addresses', 'type': '[SearchAddressReverseResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class SearchAddressReverseBatchItemResponse(ErrorResponse, SearchAddressReverseResponse): + """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.SearchCommonSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.SearchAddressReverseResult] + :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': 'SearchCommonSummary'}, + 'addresses': {'key': 'addresses', 'type': '[SearchAddressReverseResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseBatchItemResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + self.error = kwargs.get('error', None) + + +class SearchAddressReverseBatchResponse(BatchResponse): + """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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressReverseBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressReverseBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressReverseCrossStreetResponse(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.SearchCommonSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.SearchAddressReverseCrossStreetResult] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchCommonSummary'}, + 'addresses': {'key': 'addresses', 'type': '[SearchAddressReverseCrossStreetResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseCrossStreetResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class SearchAddressReverseCrossStreetResult(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.SearchResultAddress + :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': 'SearchResultAddress'}, + 'position': {'key': 'position', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseCrossStreetResult, self).__init__(**kwargs) + self.address = None + self.position = None + + +class SearchAddressReverseResult(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.SearchResultAddress + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. + :vartype match_type: str + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + 'match_type': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'SearchResultAddress'}, + 'position': {'key': 'position', 'type': 'str'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseResult, self).__init__(**kwargs) + self.address = None + self.position = None + self.match_type = None + + +class SearchAlongRouteRequestBody(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(SearchAlongRouteRequestBody, self).__init__(**kwargs) + self.route = kwargs.get('route', None) + + +class SearchCommonResult(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. + :vartype type: str + :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 dist: Straight line distance between the result and geobias location in meters. + :vartype dist: float + :ivar info: Info property. + :vartype info: str + :param entity_type: Geography entity type. Present only when entityType was requested and is + available. Possible values include: "Country", "CountrySubdivision", + "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", + "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". + :type entity_type: str or ~azure.maps.search.models.EntityType + :ivar poi: Details of the returned POI including information such as the name, phone, url + address, and classifications. + :vartype poi: ~azure.maps.search.models.SearchResultPoi + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.SearchResultAddress + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.CoordinatesPairAbbreviated + :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.SearchResultViewport + :ivar entry_points: Entry Points array. + :vartype entry_points: list[~azure.maps.search.models.SearchResultEntryPoint] + :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.SearchResultAddressRanges + :ivar data_sources: Optional section. Reference ids for use with the `Get Search Polygon + `_ API. + :vartype data_sources: ~azure.maps.search.models.DataSources + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. + :vartype match_type: str + :ivar detour_time: Detour time in seconds. + :vartype detour_time: float + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'score': {'readonly': True}, + 'dist': {'readonly': True}, + 'info': {'readonly': True}, + 'poi': {'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'}, + 'dist': {'key': 'dist', 'type': 'float'}, + 'info': {'key': 'info', 'type': 'str'}, + 'entity_type': {'key': 'entityType', 'type': 'str'}, + 'poi': {'key': 'poi', 'type': 'SearchResultPoi'}, + 'address': {'key': 'address', 'type': 'SearchResultAddress'}, + 'position': {'key': 'position', 'type': 'CoordinatesPairAbbreviated'}, + 'viewport': {'key': 'viewport', 'type': 'SearchResultViewport'}, + 'entry_points': {'key': 'entryPoints', 'type': '[SearchResultEntryPoint]'}, + 'address_ranges': {'key': 'addressRanges', 'type': 'SearchResultAddressRanges'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSources'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + 'detour_time': {'key': 'detourTime', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchCommonResult, self).__init__(**kwargs) + self.type = None + self.id = None + self.score = None + self.dist = None + self.info = None + self.entity_type = kwargs.get('entity_type', None) + self.poi = 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 SearchCommonSummary(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: Query property. + :vartype query: str + :ivar query_type: QueryType property. + :vartype query_type: str + :ivar query_time: QueryTime property. + :vartype query_time: int + :ivar num_results: NumResults property. + :vartype num_results: int + :ivar limit: Maximum number of responses that will be returned. + :vartype limit: int + :ivar offset: Offset property. + :vartype offset: int + :ivar total_results: TotalResults property. + :vartype total_results: int + :ivar fuzzy_level: FuzzyLevel property. + :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.SearchCommonSummaryGeoBias + """ + + _validation = { + 'query': {'readonly': True}, + 'query_type': {'readonly': True}, + 'query_time': {'readonly': True}, + 'num_results': {'readonly': True}, + 'limit': {'readonly': True}, + 'offset': {'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'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'total_results': {'key': 'totalResults', 'type': 'int'}, + 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, + 'geo_bias': {'key': 'geoBias', 'type': 'SearchCommonSummaryGeoBias'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchCommonSummary, self).__init__(**kwargs) + self.query = None + self.query_type = None + self.query_time = None + self.num_results = None + self.limit = None + self.offset = None + self.total_results = None + self.fuzzy_level = None + self.geo_bias = None + + +class SearchCommonSummaryGeoBias(CoordinatesPairAbbreviated): + """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. + + :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(SearchCommonSummaryGeoBias, self).__init__(**kwargs) + + +class SearchFuzzyBatchItem(BatchItem): + """An item returned from Search Fuzzy 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: float + :ivar response: The result of the query. SearchCommonResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchFuzzyBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + 'response': {'key': 'response', 'type': 'SearchFuzzyBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchFuzzyBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchFuzzyBatchItemResponse(ErrorResponse, SearchCommonResponse): + """The result of the query. SearchCommonResponse 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.SearchCommonSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchCommonResult] + :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': 'SearchCommonSummary'}, + 'results': {'key': 'results', 'type': '[SearchCommonResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchFuzzyBatchItemResponse, self).__init__(**kwargs) + self.summary = None + self.results = None + self.error = kwargs.get('error', None) + + +class SearchFuzzyBatchResponse(BatchResponse): + """This object is returned from a successful Search Fuzzy Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchFuzzyBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchFuzzyBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchFuzzyBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class SearchInsideGeometryRequestBody(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(SearchInsideGeometryRequestBody, self).__init__(**kwargs) + self.geometry = kwargs.get('geometry', None) + + +class SearchPoiCategoryTreeResponse(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 poi_categories: Categories array. + :vartype poi_categories: list[~azure.maps.search.models.PoiCategoryResult] + """ + + _validation = { + 'poi_categories': {'readonly': True}, + } + + _attribute_map = { + 'poi_categories': {'key': 'poiCategories', 'type': '[PoiCategoryResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchPoiCategoryTreeResponse, self).__init__(**kwargs) + self.poi_categories = None + + +class SearchPolygonResponse(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 additional_data: Results array. + :vartype additional_data: list[~azure.maps.search.models.SearchPolygonResult] + """ + + _validation = { + 'additional_data': {'readonly': True}, + } + + _attribute_map = { + 'additional_data': {'key': 'additionalData', 'type': '[SearchPolygonResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchPolygonResponse, self).__init__(**kwargs) + self.additional_data = None + + +class SearchPolygonResult(msrest.serialization.Model): + """SearchPolygonResult. + + 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 + :ivar error: Reason for the failure to obtain data for this provider. + :vartype error: 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}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'provider_id': {'key': 'providerID', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchPolygonResult, self).__init__(**kwargs) + self.provider_id = None + self.error = None + self.geometry_data = kwargs.get('geometry_data', None) + + +class SearchResultAddress(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: Building Number property. + :vartype building_number: str + :ivar street: Street property. + :vartype street: str + :ivar cross_street: Cross Street property. + :vartype cross_street: str + :ivar street_number: Street Number property. + :vartype street_number: str + :ivar route_numbers: number of routes. + :vartype route_numbers: list[int] + :ivar street_name: Street Name property. + :vartype street_name: str + :ivar street_name_and_number: Street Name and Number property. + :vartype street_name_and_number: str + :ivar municipality: Municipality property. + :vartype municipality: str + :ivar municipality_subdivision: Municipality Subdivision property. + :vartype municipality_subdivision: str + :ivar country_tertiary_subdivision: Country Tertiary Subdivision property. + :vartype country_tertiary_subdivision: str + :ivar country_secondary_subdivision: Country Secondary Subdivision property. + :vartype country_secondary_subdivision: str + :ivar country_subdivision: Country Subdivision property. + :vartype country_subdivision: str + :ivar postal_code: Postal Code property. + :vartype postal_code: str + :ivar extended_postal_code: Extended Postal Code property. + :vartype extended_postal_code: str + :ivar country_code: Country Code property. + :vartype country_code: str + :ivar country: Country property. + :vartype country: str + :ivar country_code_iso3: Country Code ISO3 property. + :vartype country_code_iso3: str + :ivar freeform_address: Free form Address property. + :vartype freeform_address: str + :ivar country_subdivision_name: Country Subdivision Name property. + :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(SearchResultAddress, 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 SearchResultAddressRanges(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.CoordinatesPairAbbreviated + :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. + :type to: ~azure.maps.search.models.CoordinatesPairAbbreviated + """ + + _attribute_map = { + 'range_left': {'key': 'rangeLeft', 'type': 'str'}, + 'range_right': {'key': 'rangeRight', 'type': 'str'}, + 'from_property': {'key': 'from', 'type': 'CoordinatesPairAbbreviated'}, + 'to': {'key': 'to', 'type': 'CoordinatesPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultAddressRanges, 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 SearchResultEntryPoint(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.CoordinatesPairAbbreviated + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'position': {'key': 'position', 'type': 'CoordinatesPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultEntryPoint, self).__init__(**kwargs) + self.type = None + self.position = kwargs.get('position', None) + + +class SearchResultPoi(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.SearchResultPoiCategorySet] + :ivar categories: **[Deprecated]** Use classifications instead. Categories array. + :vartype categories: list[str] + :ivar classifications: Classification array. + :vartype classifications: list[~azure.maps.search.models.SearchResultPoiClassification] + :ivar brands: Brands array. The name of the brand for the POI being returned. + :vartype brands: list[~azure.maps.search.models.SearchResultPoiBrand] + :param opening_hours: Opening hours for a POI (Points of Interest). + :type opening_hours: ~azure.maps.search.models.SearchResultPoiOpeningHours + """ + + _validation = { + 'name': {'readonly': True}, + 'phone': {'readonly': True}, + 'url': {'readonly': True}, + 'category_set': {'readonly': True}, + 'categories': {'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': '[SearchResultPoiCategorySet]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'classifications': {'key': 'classifications', 'type': '[SearchResultPoiClassification]'}, + 'brands': {'key': 'brands', 'type': '[SearchResultPoiBrand]'}, + 'opening_hours': {'key': 'openingHours', 'type': 'SearchResultPoiOpeningHours'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultPoi, self).__init__(**kwargs) + self.name = None + self.phone = None + self.url = None + self.category_set = None + self.categories = None + self.classifications = None + self.brands = None + self.opening_hours = kwargs.get('opening_hours', None) + + +class SearchResultPoiBrand(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(SearchResultPoiBrand, self).__init__(**kwargs) + self.name = None + + +class SearchResultPoiCategorySet(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(SearchResultPoiCategorySet, self).__init__(**kwargs) + self.id = None + + +class SearchResultPoiClassification(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.SearchResultPoiClassificationName] + """ + + _validation = { + 'code': {'readonly': True}, + 'names': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[SearchResultPoiClassificationName]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultPoiClassification, self).__init__(**kwargs) + self.code = None + self.names = None + + +class SearchResultPoiClassificationName(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(SearchResultPoiClassificationName, self).__init__(**kwargs) + self.name_locale = None + self.name = None + + +class SearchResultPoiOpeningHours(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. + :vartype mode: str + :ivar time_ranges: List of time ranges for the next 7 days. + :vartype time_ranges: list[~azure.maps.search.models.SearchResultPoiOpeningHoursTimeRange] + """ + + _validation = { + 'mode': {'readonly': True}, + 'time_ranges': {'readonly': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'time_ranges': {'key': 'timeRanges', 'type': '[SearchResultPoiOpeningHoursTimeRange]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultPoiOpeningHours, self).__init__(**kwargs) + self.mode = None + self.time_ranges = None + + +class SearchResultPoiOpeningHoursTimeRange(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.SearchResultPoiOpeningHoursTimeRangeTime + :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.SearchResultPoiOpeningHoursTimeRangeTime + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'SearchResultPoiOpeningHoursTimeRangeTime'}, + 'end_time': {'key': 'endTime', 'type': 'SearchResultPoiOpeningHoursTimeRangeTime'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultPoiOpeningHoursTimeRange, self).__init__(**kwargs) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + + +class SearchResultPoiOpeningHoursTimeRangeTime(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 day in calendar year in POI time zone. + :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(SearchResultPoiOpeningHoursTimeRangeTime, self).__init__(**kwargs) + self.date = None + self.hour = None + self.minute = None + + +class SearchResultViewport(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.CoordinatesPairAbbreviated + :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.CoordinatesPairAbbreviated + """ + + _attribute_map = { + 'top_left_point': {'key': 'topLeftPoint', 'type': 'CoordinatesPairAbbreviated'}, + 'btm_right_point': {'key': 'btmRightPoint', 'type': 'CoordinatesPairAbbreviated'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultViewport, self).__init__(**kwargs) + self.top_left_point = kwargs.get('top_left_point', None) + self.btm_right_point = kwargs.get('btm_right_point', None) + + +class SearchSummaryGeoBias(msrest.serialization.Model): + """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. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lat: Latitude property. + :vartype lat: float + :ivar lon: Longitude property. + :vartype lon: float + """ + + _validation = { + 'lat': {'readonly': True}, + 'lon': {'readonly': True}, + } + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchSummaryGeoBias, self).__init__(**kwargs) + self.lat = None + self.lon = 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..80ee72d1c0d7 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_models_py3.py @@ -0,0 +1,2358 @@ +# 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 BatchItem(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: float + """ + + _validation = { + 'status_code': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchItem, self).__init__(**kwargs) + self.status_code = None + + +class BatchRequestBody(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.BatchRequestBodyBatchItemsItem] + """ + + _attribute_map = { + 'batch_items': {'key': 'batchItems', 'type': '[BatchRequestBodyBatchItemsItem]'}, + } + + def __init__( + self, + *, + batch_items: Optional[List["BatchRequestBodyBatchItemsItem"]] = None, + **kwargs + ): + super(BatchRequestBody, self).__init__(**kwargs) + self.batch_items = batch_items + + +class BatchRequestBodyBatchItemsItem(msrest.serialization.Model): + """Batch Query object. + + :param query: Partial query string. + :type query: str + """ + + _attribute_map = { + 'query': {'key': 'query', 'type': 'str'}, + } + + def __init__( + self, + *, + query: Optional[str] = None, + **kwargs + ): + super(BatchRequestBodyBatchItemsItem, self).__init__(**kwargs) + self.query = query + + +class BatchResponse(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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + """ + + _validation = { + 'summary': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + } + + def __init__( + self, + **kwargs + ): + super(BatchResponse, self).__init__(**kwargs) + self.summary = None + + +class BatchResponseSummary(msrest.serialization.Model): + """Summary 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(BatchResponseSummary, self).__init__(**kwargs) + self.successful_requests = None + self.total_requests = None + + +class CoordinatesPairAbbreviated(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(CoordinatesPairAbbreviated, self).__init__(**kwargs) + self.lat = lat + self.lon = lon + + +class DataSources(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.DataSourcesGeometry + """ + + _attribute_map = { + 'geometry': {'key': 'geometry', 'type': 'DataSourcesGeometry'}, + } + + def __init__( + self, + *, + geometry: Optional["DataSourcesGeometry"] = None, + **kwargs + ): + super(DataSources, self).__init__(**kwargs) + self.geometry = geometry + + +class DataSourcesGeometry(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(DataSourcesGeometry, self).__init__(**kwargs) + self.id = 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, + *, + 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 PoiCategoryResult(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_category_ids: Array of child category ids. + :vartype child_category_ids: list[int] + :ivar synonyms: Array of alternative names of the category. + :vartype synonyms: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'child_category_ids': {'readonly': True}, + 'synonyms': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'child_category_ids': {'key': 'childCategoryIds', 'type': '[int]'}, + 'synonyms': {'key': 'synonyms', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PoiCategoryResult, self).__init__(**kwargs) + self.id = None + self.name = None + self.child_category_ids = None + self.synonyms = None + + +class SearchAddressBatchItem(BatchItem): + """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: float + :ivar response: The result of the query. SearchCommonResponse 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': 'float'}, + 'response': {'key': 'response', 'type': 'SearchAddressBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchCommonResponse(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.SearchCommonSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchCommonResult] + """ + + _validation = { + 'summary': {'readonly': True}, + 'results': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchCommonSummary'}, + 'results': {'key': 'results', 'type': '[SearchCommonResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchCommonResponse, self).__init__(**kwargs) + self.summary = None + self.results = None + + +class SearchAddressBatchItemResponse(ErrorResponse, SearchCommonResponse): + """The result of the query. SearchCommonResponse 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.SearchCommonSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchCommonResult] + :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': 'SearchCommonSummary'}, + 'results': {'key': 'results', 'type': '[SearchCommonResult]'}, + '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 SearchAddressBatchResponse(BatchResponse): + """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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressReverseBatchItem(BatchItem): + """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: float + :ivar response: The result of the query. SearchAddressReverseResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchAddressReverseBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + 'response': {'key': 'response', 'type': 'SearchAddressReverseBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchAddressReverseResponse(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.SearchCommonSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.SearchAddressReverseResult] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchCommonSummary'}, + 'addresses': {'key': 'addresses', 'type': '[SearchAddressReverseResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class SearchAddressReverseBatchItemResponse(ErrorResponse, SearchAddressReverseResponse): + """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.SearchCommonSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.SearchAddressReverseResult] + :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': 'SearchCommonSummary'}, + 'addresses': {'key': 'addresses', 'type': '[SearchAddressReverseResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(SearchAddressReverseBatchItemResponse, self).__init__(error=error, **kwargs) + self.summary = None + self.addresses = None + self.error = error + + +class SearchAddressReverseBatchResponse(BatchResponse): + """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 summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchAddressReverseBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchAddressReverseBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class SearchAddressReverseCrossStreetResponse(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.SearchCommonSummary + :ivar addresses: Addresses array. + :vartype addresses: list[~azure.maps.search.models.SearchAddressReverseCrossStreetResult] + """ + + _validation = { + 'summary': {'readonly': True}, + 'addresses': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'SearchCommonSummary'}, + 'addresses': {'key': 'addresses', 'type': '[SearchAddressReverseCrossStreetResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseCrossStreetResponse, self).__init__(**kwargs) + self.summary = None + self.addresses = None + + +class SearchAddressReverseCrossStreetResult(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.SearchResultAddress + :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': 'SearchResultAddress'}, + 'position': {'key': 'position', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseCrossStreetResult, self).__init__(**kwargs) + self.address = None + self.position = None + + +class SearchAddressReverseResult(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.SearchResultAddress + :ivar position: Position property in the form of "{latitude},{longitude}". + :vartype position: str + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. + :vartype match_type: str + """ + + _validation = { + 'address': {'readonly': True}, + 'position': {'readonly': True}, + 'match_type': {'readonly': True}, + } + + _attribute_map = { + 'address': {'key': 'address', 'type': 'SearchResultAddress'}, + 'position': {'key': 'position', 'type': 'str'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchAddressReverseResult, self).__init__(**kwargs) + self.address = None + self.position = None + self.match_type = None + + +class SearchAlongRouteRequestBody(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(SearchAlongRouteRequestBody, self).__init__(**kwargs) + self.route = route + + +class SearchCommonResult(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. + :vartype type: str + :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 dist: Straight line distance between the result and geobias location in meters. + :vartype dist: float + :ivar info: Info property. + :vartype info: str + :param entity_type: Geography entity type. Present only when entityType was requested and is + available. Possible values include: "Country", "CountrySubdivision", + "CountrySecondarySubdivision", "CountryTertiarySubdivision", "Municipality", + "MunicipalitySubdivision", "Neighbourhood", "PostalCodeArea". + :type entity_type: str or ~azure.maps.search.models.EntityType + :ivar poi: Details of the returned POI including information such as the name, phone, url + address, and classifications. + :vartype poi: ~azure.maps.search.models.SearchResultPoi + :ivar address: The address of the result. + :vartype address: ~azure.maps.search.models.SearchResultAddress + :param position: A location represented as a latitude and longitude using short names 'lat' & + 'lon'. + :type position: ~azure.maps.search.models.CoordinatesPairAbbreviated + :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.SearchResultViewport + :ivar entry_points: Entry Points array. + :vartype entry_points: list[~azure.maps.search.models.SearchResultEntryPoint] + :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.SearchResultAddressRanges + :ivar data_sources: Optional section. Reference ids for use with the `Get Search Polygon + `_ API. + :vartype data_sources: ~azure.maps.search.models.DataSources + :ivar match_type: Information on the type of match. + + One of: + + + * AddressPoint + * HouseNumberRange + * Street. + :vartype match_type: str + :ivar detour_time: Detour time in seconds. + :vartype detour_time: float + """ + + _validation = { + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'score': {'readonly': True}, + 'dist': {'readonly': True}, + 'info': {'readonly': True}, + 'poi': {'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'}, + 'dist': {'key': 'dist', 'type': 'float'}, + 'info': {'key': 'info', 'type': 'str'}, + 'entity_type': {'key': 'entityType', 'type': 'str'}, + 'poi': {'key': 'poi', 'type': 'SearchResultPoi'}, + 'address': {'key': 'address', 'type': 'SearchResultAddress'}, + 'position': {'key': 'position', 'type': 'CoordinatesPairAbbreviated'}, + 'viewport': {'key': 'viewport', 'type': 'SearchResultViewport'}, + 'entry_points': {'key': 'entryPoints', 'type': '[SearchResultEntryPoint]'}, + 'address_ranges': {'key': 'addressRanges', 'type': 'SearchResultAddressRanges'}, + 'data_sources': {'key': 'dataSources', 'type': 'DataSources'}, + 'match_type': {'key': 'matchType', 'type': 'str'}, + 'detour_time': {'key': 'detourTime', 'type': 'float'}, + } + + def __init__( + self, + *, + entity_type: Optional[Union[str, "EntityType"]] = None, + position: Optional["CoordinatesPairAbbreviated"] = None, + **kwargs + ): + super(SearchCommonResult, self).__init__(**kwargs) + self.type = None + self.id = None + self.score = None + self.dist = None + self.info = None + self.entity_type = entity_type + self.poi = 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 SearchCommonSummary(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: Query property. + :vartype query: str + :ivar query_type: QueryType property. + :vartype query_type: str + :ivar query_time: QueryTime property. + :vartype query_time: int + :ivar num_results: NumResults property. + :vartype num_results: int + :ivar limit: Maximum number of responses that will be returned. + :vartype limit: int + :ivar offset: Offset property. + :vartype offset: int + :ivar total_results: TotalResults property. + :vartype total_results: int + :ivar fuzzy_level: FuzzyLevel property. + :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.SearchCommonSummaryGeoBias + """ + + _validation = { + 'query': {'readonly': True}, + 'query_type': {'readonly': True}, + 'query_time': {'readonly': True}, + 'num_results': {'readonly': True}, + 'limit': {'readonly': True}, + 'offset': {'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'}, + 'limit': {'key': 'limit', 'type': 'int'}, + 'offset': {'key': 'offset', 'type': 'int'}, + 'total_results': {'key': 'totalResults', 'type': 'int'}, + 'fuzzy_level': {'key': 'fuzzyLevel', 'type': 'int'}, + 'geo_bias': {'key': 'geoBias', 'type': 'SearchCommonSummaryGeoBias'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchCommonSummary, self).__init__(**kwargs) + self.query = None + self.query_type = None + self.query_time = None + self.num_results = None + self.limit = None + self.offset = None + self.total_results = None + self.fuzzy_level = None + self.geo_bias = None + + +class SearchCommonSummaryGeoBias(CoordinatesPairAbbreviated): + """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. + + :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(SearchCommonSummaryGeoBias, self).__init__(lat=lat, lon=lon, **kwargs) + + +class SearchFuzzyBatchItem(BatchItem): + """An item returned from Search Fuzzy 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: float + :ivar response: The result of the query. SearchCommonResponse if the query completed + successfully, ErrorResponse otherwise. + :vartype response: ~azure.maps.search.models.SearchFuzzyBatchItemResponse + """ + + _validation = { + 'status_code': {'readonly': True}, + 'response': {'readonly': True}, + } + + _attribute_map = { + 'status_code': {'key': 'statusCode', 'type': 'float'}, + 'response': {'key': 'response', 'type': 'SearchFuzzyBatchItemResponse'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchFuzzyBatchItem, self).__init__(**kwargs) + self.response = None + + +class SearchFuzzyBatchItemResponse(ErrorResponse, SearchCommonResponse): + """The result of the query. SearchCommonResponse 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.SearchCommonSummary + :ivar results: A list of Search API results. + :vartype results: list[~azure.maps.search.models.SearchCommonResult] + :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': 'SearchCommonSummary'}, + 'results': {'key': 'results', 'type': '[SearchCommonResult]'}, + 'error': {'key': 'error', 'type': 'ErrorDetail'}, + } + + def __init__( + self, + *, + error: Optional["ErrorDetail"] = None, + **kwargs + ): + super(SearchFuzzyBatchItemResponse, self).__init__(error=error, **kwargs) + self.summary = None + self.results = None + self.error = error + + +class SearchFuzzyBatchResponse(BatchResponse): + """This object is returned from a successful Search Fuzzy Batch service call. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar summary: Summary for the batch request. + :vartype summary: ~azure.maps.search.models.BatchResponseSummary + :ivar batch_items: Array containing the batch results. + :vartype batch_items: list[~azure.maps.search.models.SearchFuzzyBatchItem] + """ + + _validation = { + 'summary': {'readonly': True}, + 'batch_items': {'readonly': True}, + } + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'BatchResponseSummary'}, + 'batch_items': {'key': 'batchItems', 'type': '[SearchFuzzyBatchItem]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchFuzzyBatchResponse, self).__init__(**kwargs) + self.batch_items = None + + +class SearchInsideGeometryRequestBody(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(SearchInsideGeometryRequestBody, self).__init__(**kwargs) + self.geometry = geometry + + +class SearchPoiCategoryTreeResponse(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 poi_categories: Categories array. + :vartype poi_categories: list[~azure.maps.search.models.PoiCategoryResult] + """ + + _validation = { + 'poi_categories': {'readonly': True}, + } + + _attribute_map = { + 'poi_categories': {'key': 'poiCategories', 'type': '[PoiCategoryResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchPoiCategoryTreeResponse, self).__init__(**kwargs) + self.poi_categories = None + + +class SearchPolygonResponse(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 additional_data: Results array. + :vartype additional_data: list[~azure.maps.search.models.SearchPolygonResult] + """ + + _validation = { + 'additional_data': {'readonly': True}, + } + + _attribute_map = { + 'additional_data': {'key': 'additionalData', 'type': '[SearchPolygonResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchPolygonResponse, self).__init__(**kwargs) + self.additional_data = None + + +class SearchPolygonResult(msrest.serialization.Model): + """SearchPolygonResult. + + 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 + :ivar error: Reason for the failure to obtain data for this provider. + :vartype error: 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}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'provider_id': {'key': 'providerID', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'geometry_data': {'key': 'geometryData', 'type': 'GeoJsonObject'}, + } + + def __init__( + self, + *, + geometry_data: Optional["GeoJsonObject"] = None, + **kwargs + ): + super(SearchPolygonResult, self).__init__(**kwargs) + self.provider_id = None + self.error = None + self.geometry_data = geometry_data + + +class SearchResultAddress(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: Building Number property. + :vartype building_number: str + :ivar street: Street property. + :vartype street: str + :ivar cross_street: Cross Street property. + :vartype cross_street: str + :ivar street_number: Street Number property. + :vartype street_number: str + :ivar route_numbers: number of routes. + :vartype route_numbers: list[int] + :ivar street_name: Street Name property. + :vartype street_name: str + :ivar street_name_and_number: Street Name and Number property. + :vartype street_name_and_number: str + :ivar municipality: Municipality property. + :vartype municipality: str + :ivar municipality_subdivision: Municipality Subdivision property. + :vartype municipality_subdivision: str + :ivar country_tertiary_subdivision: Country Tertiary Subdivision property. + :vartype country_tertiary_subdivision: str + :ivar country_secondary_subdivision: Country Secondary Subdivision property. + :vartype country_secondary_subdivision: str + :ivar country_subdivision: Country Subdivision property. + :vartype country_subdivision: str + :ivar postal_code: Postal Code property. + :vartype postal_code: str + :ivar extended_postal_code: Extended Postal Code property. + :vartype extended_postal_code: str + :ivar country_code: Country Code property. + :vartype country_code: str + :ivar country: Country property. + :vartype country: str + :ivar country_code_iso3: Country Code ISO3 property. + :vartype country_code_iso3: str + :ivar freeform_address: Free form Address property. + :vartype freeform_address: str + :ivar country_subdivision_name: Country Subdivision Name property. + :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(SearchResultAddress, 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 SearchResultAddressRanges(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.CoordinatesPairAbbreviated + :param to: A location represented as a latitude and longitude using short names 'lat' & 'lon'. + :type to: ~azure.maps.search.models.CoordinatesPairAbbreviated + """ + + _attribute_map = { + 'range_left': {'key': 'rangeLeft', 'type': 'str'}, + 'range_right': {'key': 'rangeRight', 'type': 'str'}, + 'from_property': {'key': 'from', 'type': 'CoordinatesPairAbbreviated'}, + 'to': {'key': 'to', 'type': 'CoordinatesPairAbbreviated'}, + } + + def __init__( + self, + *, + range_left: Optional[str] = None, + range_right: Optional[str] = None, + from_property: Optional["CoordinatesPairAbbreviated"] = None, + to: Optional["CoordinatesPairAbbreviated"] = None, + **kwargs + ): + super(SearchResultAddressRanges, self).__init__(**kwargs) + self.range_left = range_left + self.range_right = range_right + self.from_property = from_property + self.to = to + + +class SearchResultEntryPoint(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.CoordinatesPairAbbreviated + """ + + _validation = { + 'type': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'position': {'key': 'position', 'type': 'CoordinatesPairAbbreviated'}, + } + + def __init__( + self, + *, + position: Optional["CoordinatesPairAbbreviated"] = None, + **kwargs + ): + super(SearchResultEntryPoint, self).__init__(**kwargs) + self.type = None + self.position = position + + +class SearchResultPoi(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.SearchResultPoiCategorySet] + :ivar categories: **[Deprecated]** Use classifications instead. Categories array. + :vartype categories: list[str] + :ivar classifications: Classification array. + :vartype classifications: list[~azure.maps.search.models.SearchResultPoiClassification] + :ivar brands: Brands array. The name of the brand for the POI being returned. + :vartype brands: list[~azure.maps.search.models.SearchResultPoiBrand] + :param opening_hours: Opening hours for a POI (Points of Interest). + :type opening_hours: ~azure.maps.search.models.SearchResultPoiOpeningHours + """ + + _validation = { + 'name': {'readonly': True}, + 'phone': {'readonly': True}, + 'url': {'readonly': True}, + 'category_set': {'readonly': True}, + 'categories': {'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': '[SearchResultPoiCategorySet]'}, + 'categories': {'key': 'categories', 'type': '[str]'}, + 'classifications': {'key': 'classifications', 'type': '[SearchResultPoiClassification]'}, + 'brands': {'key': 'brands', 'type': '[SearchResultPoiBrand]'}, + 'opening_hours': {'key': 'openingHours', 'type': 'SearchResultPoiOpeningHours'}, + } + + def __init__( + self, + *, + opening_hours: Optional["SearchResultPoiOpeningHours"] = None, + **kwargs + ): + super(SearchResultPoi, self).__init__(**kwargs) + self.name = None + self.phone = None + self.url = None + self.category_set = None + self.categories = None + self.classifications = None + self.brands = None + self.opening_hours = opening_hours + + +class SearchResultPoiBrand(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(SearchResultPoiBrand, self).__init__(**kwargs) + self.name = None + + +class SearchResultPoiCategorySet(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(SearchResultPoiCategorySet, self).__init__(**kwargs) + self.id = None + + +class SearchResultPoiClassification(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.SearchResultPoiClassificationName] + """ + + _validation = { + 'code': {'readonly': True}, + 'names': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[SearchResultPoiClassificationName]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultPoiClassification, self).__init__(**kwargs) + self.code = None + self.names = None + + +class SearchResultPoiClassificationName(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(SearchResultPoiClassificationName, self).__init__(**kwargs) + self.name_locale = None + self.name = None + + +class SearchResultPoiOpeningHours(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. + :vartype mode: str + :ivar time_ranges: List of time ranges for the next 7 days. + :vartype time_ranges: list[~azure.maps.search.models.SearchResultPoiOpeningHoursTimeRange] + """ + + _validation = { + 'mode': {'readonly': True}, + 'time_ranges': {'readonly': True}, + } + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'time_ranges': {'key': 'timeRanges', 'type': '[SearchResultPoiOpeningHoursTimeRange]'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchResultPoiOpeningHours, self).__init__(**kwargs) + self.mode = None + self.time_ranges = None + + +class SearchResultPoiOpeningHoursTimeRange(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.SearchResultPoiOpeningHoursTimeRangeTime + :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.SearchResultPoiOpeningHoursTimeRangeTime + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'SearchResultPoiOpeningHoursTimeRangeTime'}, + 'end_time': {'key': 'endTime', 'type': 'SearchResultPoiOpeningHoursTimeRangeTime'}, + } + + def __init__( + self, + *, + start_time: Optional["SearchResultPoiOpeningHoursTimeRangeTime"] = None, + end_time: Optional["SearchResultPoiOpeningHoursTimeRangeTime"] = None, + **kwargs + ): + super(SearchResultPoiOpeningHoursTimeRange, self).__init__(**kwargs) + self.start_time = start_time + self.end_time = end_time + + +class SearchResultPoiOpeningHoursTimeRangeTime(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 day in calendar year in POI time zone. + :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(SearchResultPoiOpeningHoursTimeRangeTime, self).__init__(**kwargs) + self.date = None + self.hour = None + self.minute = None + + +class SearchResultViewport(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.CoordinatesPairAbbreviated + :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.CoordinatesPairAbbreviated + """ + + _attribute_map = { + 'top_left_point': {'key': 'topLeftPoint', 'type': 'CoordinatesPairAbbreviated'}, + 'btm_right_point': {'key': 'btmRightPoint', 'type': 'CoordinatesPairAbbreviated'}, + } + + def __init__( + self, + *, + top_left_point: Optional["CoordinatesPairAbbreviated"] = None, + btm_right_point: Optional["CoordinatesPairAbbreviated"] = None, + **kwargs + ): + super(SearchResultViewport, self).__init__(**kwargs) + self.top_left_point = top_left_point + self.btm_right_point = btm_right_point + + +class SearchSummaryGeoBias(msrest.serialization.Model): + """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. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lat: Latitude property. + :vartype lat: float + :ivar lon: Longitude property. + :vartype lon: float + """ + + _validation = { + 'lat': {'readonly': True}, + 'lon': {'readonly': True}, + } + + _attribute_map = { + 'lat': {'key': 'lat', 'type': 'float'}, + 'lon': {'key': 'lon', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(SearchSummaryGeoBias, self).__init__(**kwargs) + self.lat = None + self.lon = None 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..7be212670650 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/models/_search_client_enums.py @@ -0,0 +1,175 @@ +# 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 ConnectorSet(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 EntityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Geography entity type. Present only when entityType was requested and is available. + """ + + #: Country name. + COUNTRY = "Country" + #: State or Province. + COUNTRY_SUBDIVISION = "CountrySubdivision" + #: County. + COUNTRY_SECONDARY_SUBDIVISION = "CountrySecondarySubdivision" + #: Named Area. + COUNTRY_TERTIARY_SUBDIVISION = "CountryTertiarySubdivision" + #: City / Town. + MUNICIPALITY = "Municipality" + #: Sub / Super City. + MUNICIPALITY_SUBDIVISION = "MunicipalitySubdivision" + #: Neighbourhood. + NEIGHBOURHOOD = "Neighbourhood" + #: Postal Code / Zip Code. + POSTAL_CODE_AREA = "PostalCodeArea" + +class EntryPointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of entry point. Value can be either *main* or *minor*. + """ + + MAIN = "main" + MINOR = "minor" + +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 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 OpeningHours(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 ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +class SearchIndexSet(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Address range interpolation. + ADDR = "Addr" + #: Geographies. + GEO = "Geo" + #: Point Addresses. + PAD = "PAD" + #: Points of interest. + POI = "POI" + #: Streets. + STR = "Str" + #: Cross Streets (Intersections). + XSTR = "Xstr" + +class TextFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" 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..6baab4ab5883 --- /dev/null +++ b/sdk/maps/azure-maps-search/azure/maps/search/operations/_search_operations.py @@ -0,0 +1,5236 @@ +# 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 get_search_polygon( + self, + format, # type: Union[str, "_models.ResponseFormat"] + geometries, # type: List[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchPolygonResponse" + """**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 dataSources 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param geometries: Comma separated list of geometry UUIDs, previously retrieved from an Online + Search request. + :type geometries: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchPolygonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchPolygonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchPolygonResponse"] + 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_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['geometries'] = self._serialize.query("geometries", geometries, '[str]', div=',') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchPolygonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_polygon.metadata = {'url': '/search/polygon/{format}'} # type: ignore + + def get_search_fuzzy( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + typeahead=None, # type: Optional[bool] + limit=None, # type: Optional[int] + ofs=None, # type: Optional[int] + category_set=None, # type: Optional[List[int]] + country_set=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius=None, # type: Optional[float] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[str] + min_fuzzy_level=None, # type: Optional[int] + max_fuzzy_level=None, # type: Optional[int] + idx_set=None, # type: Optional[List[Union[str, "_models.SearchIndexSet"]]] + brand_set=None, # type: Optional[List[str]] + connector_set=None, # type: Optional[List[Union[str, "_models.ConnectorSet"]]] + view=None, # type: Optional[str] + opening_hours=None, # type: Optional[Union[str, "_models.OpeningHours"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :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 idx_set: 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 idx_set: list[str or ~azure.maps.search.models.SearchIndexSet] + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_fuzzy.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + 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 idx_set is not None: + query_parameters['idxSet'] = self._serialize.query("idx_set", idx_set, '[str]', div=',') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_fuzzy.metadata = {'url': '/search/fuzzy/{format}'} # type: ignore + + def get_search_poi( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + typeahead=None, # type: Optional[bool] + limit=None, # type: Optional[int] + ofs=None, # type: Optional[int] + category_set=None, # type: Optional[List[int]] + country_set=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius=None, # type: Optional[float] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[str] + brand_set=None, # type: Optional[List[str]] + connector_set=None, # type: Optional[List[Union[str, "_models.ConnectorSet"]]] + view=None, # type: Optional[str] + opening_hours=None, # type: Optional[Union[str, "_models.OpeningHours"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks"), must be + properly URL encoded. + :type query: str + :param typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_poi.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_poi.metadata = {'url': '/search/poi/{format}'} # type: ignore + + def get_search_nearby( + self, + format, # type: Union[str, "_models.TextFormat"] + lat, # type: float + lon, # type: float + limit=None, # type: Optional[int] + ofs=None, # type: Optional[int] + category_set=None, # type: Optional[List[int]] + country_set=None, # type: Optional[List[str]] + radius=None, # type: Optional[float] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[str] + brand_set=None, # type: Optional[List[str]] + connector_set=None, # type: Optional[List[Union[str, "_models.ConnectorSet"]]] + view=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: list[str] + :param radius: 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: float + :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: str + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_nearby.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("lat", lat, 'float') + query_parameters['lon'] = self._serialize.query("lon", lon, 'float') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[str]', div=',') + if radius is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_nearby.metadata = {'url': '/search/nearby/{format}'} # type: ignore + + def get_search_poi_category( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + typeahead=None, # type: Optional[bool] + limit=None, # type: Optional[int] + ofs=None, # type: Optional[int] + category_set=None, # type: Optional[List[int]] + country_set=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius=None, # type: Optional[float] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[str] + brand_set=None, # type: Optional[List[str]] + connector_set=None, # type: Optional[List[Union[str, "_models.ConnectorSet"]]] + view=None, # type: Optional[str] + opening_hours=None, # type: Optional[Union[str, "_models.OpeningHours"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param category_set: 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_set: list[int] + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_poi_category.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_poi_category.metadata = {'url': '/search/poi/category/{format}'} # type: ignore + + def get_search_poi_category_tree_preview( + self, + format, # type: Union[str, "_models.ResponseFormat"] + language=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchPoiCategoryTreeResponse" + """**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.ResponseFormat + :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: SearchPoiCategoryTreeResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchPoiCategoryTreeResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchPoiCategoryTreeResponse"] + 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_poi_category_tree_preview.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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchPoiCategoryTreeResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_poi_category_tree_preview.metadata = {'url': '/search/poi/category/tree/{format}'} # type: ignore + + def get_search_address( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + typeahead=None, # type: Optional[bool] + limit=None, # type: Optional[int] + ofs=None, # type: Optional[int] + country_set=None, # type: Optional[List[str]] + lat=None, # type: Optional[float] + lon=None, # type: Optional[float] + radius=None, # type: Optional[float] + top_left=None, # type: Optional[str] + btm_right=None, # type: Optional[str] + language=None, # type: Optional[str] + extended_postal_codes_for=None, # type: Optional[str] + view=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :param query: The address to search for (e.g., "1 Microsoft way, Redmond, WA"), must be + properly URL encoded. + :type query: str + :param typeahead: Boolean. If the typeahead flag is set, the query will be interpreted as a + partial input and the search will enter predictive mode. + :type typeahead: bool + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: int + :param country_set: Comma separated string of country codes, e.g. FR,ES. This will limit the + search to the specified countries. + :type country_set: 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: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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: str + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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.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') + if typeahead is not None: + query_parameters['typeahead'] = self._serialize.query("typeahead", typeahead, 'bool') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, 'int', maximum=1900, minimum=0) + if country_set is not None: + query_parameters['countrySet'] = self._serialize.query("country_set", country_set, '[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 is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + 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') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address.metadata = {'url': '/search/address/{format}'} # type: ignore + + def get_search_address_reverse( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + language=None, # type: Optional[str] + return_speed_limit=None, # type: Optional[bool] + heading=None, # type: Optional[float] + radius=None, # type: Optional[float] + number=None, # type: Optional[str] + return_road_use=None, # type: Optional[bool] + road_use=None, # type: Optional[str] + allow_freeform_newline=None, # type: Optional[bool] + return_match_type=None, # type: Optional[bool] + entity_type=None, # type: Optional[Union[str, "_models.EntityType"]] + view=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressReverseResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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: 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 return_speed_limit: Boolean. To enable return of the posted speed limit. + :type return_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: float + :param radius: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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 return_road_use: Boolean. To enable return of the road use array for reverse geocodes at + street level. + :type return_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: str + :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 return_match_type: Include information on the type of match the geocoder achieved in the + response. + :type return_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.EntityType + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressReverseResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressReverseResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseResponse"] + 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_reverse.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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if return_speed_limit is not None: + query_parameters['returnSpeedLimit'] = self._serialize.query("return_speed_limit", return_speed_limit, 'bool') + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'float', maximum=360, minimum=-360) + if radius is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + if number is not None: + query_parameters['number'] = self._serialize.query("number", number, 'str') + if return_road_use is not None: + query_parameters['returnRoadUse'] = self._serialize.query("return_road_use", return_road_use, 'bool') + if road_use is not None: + query_parameters['roadUse'] = self._serialize.query("road_use", road_use, 'str') + if allow_freeform_newline is not None: + query_parameters['allowFreeformNewline'] = self._serialize.query("allow_freeform_newline", allow_freeform_newline, 'bool') + if return_match_type is not None: + query_parameters['returnMatchType'] = self._serialize.query("return_match_type", return_match_type, 'bool') + if entity_type is not None: + query_parameters['entityType'] = self._serialize.query("entity_type", entity_type, 'str') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressReverseResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address_reverse.metadata = {'url': '/search/address/reverse/{format}'} # type: ignore + + def get_search_address_reverse_cross_street( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + limit=None, # type: Optional[int] + heading=None, # type: Optional[float] + radius=None, # type: Optional[float] + language=None, # type: Optional[str] + view=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressReverseCrossStreetResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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: str + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: 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: float + :param radius: The radius in meters to for the results to be constrained to the defined area. + :type radius: float + :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 view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressReverseCrossStreetResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressReverseCrossStreetResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseCrossStreetResponse"] + 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_reverse_cross_street.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') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if heading is not None: + query_parameters['heading'] = self._serialize.query("heading", heading, 'float', maximum=360, minimum=-360) + if radius is not None: + query_parameters['radius'] = self._serialize.query("radius", radius, 'float') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchAddressReverseCrossStreetResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address_reverse_cross_street.metadata = {'url': '/search/address/reverse/crossStreet/{format}'} # type: ignore + + def get_search_address_structured( + self, + format, # type: Union[str, "_models.TextFormat"] + language=None, # type: Optional[str] + country_code="US", # type: Optional[str] + limit=None, # type: Optional[int] + ofs=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[str] + view=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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.TextFormat + :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 limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: int + :param ofs: Starting offset of the returned results within the full result set. Default: 0, + minimum: 0 and maximum: 1900. + :type ofs: 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: str + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_structured.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') + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if country_code is not None: + query_parameters['countryCode'] = self._serialize.query("country_code", country_code, 'str') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if ofs is not None: + query_parameters['ofs'] = self._serialize.query("ofs", ofs, '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') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_search_address_structured.metadata = {'url': '/search/address/structured/{format}'} # type: ignore + + def post_search_inside_geometry( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + search_inside_geometry_request_body, # type: "_models.SearchInsideGeometryRequestBody" + limit=None, # type: Optional[int] + language=None, # type: Optional[str] + category_set=None, # type: Optional[List[int]] + extended_postal_codes_for=None, # type: Optional[str] + idx_set=None, # type: Optional[List[Union[str, "_models.SearchIndexSet"]]] + view=None, # type: Optional[str] + opening_hours=None, # type: Optional[Union[str, "_models.OpeningHours"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :param query: The POI name to search for (e.g., "statue of liberty", "starbucks", "pizza"). + Must be properly URL encoded. + :type query: str + :param search_inside_geometry_request_body: 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 search_inside_geometry_request_body: ~azure.maps.search.models.SearchInsideGeometryRequestBody + :param limit: Maximum number of responses that will be returned. Default: 10, minimum: 1 and + maximum: 100. + :type limit: 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_set: 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_set: 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: str + :param idx_set: 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 idx_set: list[str or ~azure.maps.search.models.SearchIndexSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_search_inside_geometry.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') + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=100, minimum=1) + if language is not None: + query_parameters['language'] = self._serialize.query("language", language, 'str') + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[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') + if idx_set is not None: + query_parameters['idxSet'] = self._serialize.query("idx_set", idx_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_inside_geometry_request_body, 'SearchInsideGeometryRequestBody') + 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('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_inside_geometry.metadata = {'url': '/search/geometry/{format}'} # type: ignore + + def post_search_along_route( + self, + format, # type: Union[str, "_models.TextFormat"] + query, # type: str + max_detour_time, # type: int + search_along_route_request_body, # type: "_models.SearchAlongRouteRequestBody" + category_set=None, # type: Optional[List[int]] + limit=None, # type: Optional[int] + brand_set=None, # type: Optional[List[str]] + connector_set=None, # type: Optional[List[Union[str, "_models.ConnectorSet"]]] + view=None, # type: Optional[str] + opening_hours=None, # type: Optional[Union[str, "_models.OpeningHours"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchCommonResponse" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.search.models.TextFormat + :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 search_along_route_request_body: This represents the route to search along and should be + a valid ``GeoJSON LineString`` type. Please refer to `RFC 7946 + `_ for details. + :type search_along_route_request_body: ~azure.maps.search.models.SearchAlongRouteRequestBody + :param category_set: 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_set: list[int] + :param limit: Maximum number of responses that will be returned. Default value is 10. Max value + is 20. + :type limit: int + :param brand_set: 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_set: list[str] + :param connector_set: 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 connector_set: list[str or ~azure.maps.search.models.ConnectorSet] + :param view: The View parameter specifies which set of geopolitically disputed content is + returned via Azure Maps services, including borders and labels displayed on the map. The View + parameter (also referred to as “user region parameter”) will show the correct maps for that + country/region. 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 view: str + :param opening_hours: Hours of operation for a POI (Points of Interest). The availability of + hours of operation will vary based on the data available. + Supported value: nextSevenDays. + :type opening_hours: str or ~azure.maps.search.models.OpeningHours + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchCommonResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchCommonResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchCommonResponse"] + 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_search_along_route.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') + if category_set is not None: + query_parameters['categorySet'] = self._serialize.query("category_set", category_set, '[int]', div=',') + query_parameters['maxDetourTime'] = self._serialize.query("max_detour_time", max_detour_time, 'int', maximum=3600) + if limit is not None: + query_parameters['limit'] = self._serialize.query("limit", limit, 'int', maximum=20) + if brand_set is not None: + query_parameters['brandSet'] = self._serialize.query("brand_set", brand_set, '[str]', div=',') + if connector_set is not None: + query_parameters['connectorSet'] = self._serialize.query("connector_set", connector_set, '[str]', div=',') + if view is not None: + query_parameters['view'] = self._serialize.query("view", view, 'str') + if opening_hours is not None: + query_parameters['openingHours'] = self._serialize.query("opening_hours", opening_hours, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_along_route_request_body, 'SearchAlongRouteRequestBody') + 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('SearchCommonResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_along_route.metadata = {'url': '/search/alongRoute/{format}'} # type: ignore + + def post_search_fuzzy_batch_sync( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_fuzzy_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchFuzzyBatchResponse" + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ - + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_fuzzy_batch_request_body: 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 search_fuzzy_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchFuzzyBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchFuzzyBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchFuzzyBatchResponse"] + 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.post_search_fuzzy_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_fuzzy_batch_request_body, 'BatchRequestBody') + 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('SearchFuzzyBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_fuzzy_batch_sync.metadata = {'url': '/search/fuzzy/batch/sync/{format}'} # type: ignore + + def _post_search_fuzzy_batch_initial( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_fuzzy_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchFuzzyBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchFuzzyBatchResponse"]] + 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_search_fuzzy_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_fuzzy_batch_request_body, 'BatchRequestBody') + 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('SearchFuzzyBatchResponse', 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 + _post_search_fuzzy_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def begin_post_search_fuzzy_batch( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_fuzzy_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchFuzzyBatchResponse"] + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ - + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_fuzzy_batch_request_body: 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 search_fuzzy_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :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 SearchFuzzyBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchFuzzyBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchFuzzyBatchResponse"] + 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._post_search_fuzzy_batch_initial( + format=format, + search_fuzzy_batch_request_body=search_fuzzy_batch_request_body, + 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('SearchFuzzyBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_search_fuzzy_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def _get_search_fuzzy_batch_initial( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchFuzzyBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchFuzzyBatchResponse"]] + 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_fuzzy_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('SearchFuzzyBatchResponse', 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_fuzzy_batch_initial.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def begin_get_search_fuzzy_batch( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchFuzzyBatchResponse"] + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ - + 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 format: Batch id for querying the operation. + :type format: 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 SearchFuzzyBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchFuzzyBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchFuzzyBatchResponse"] + 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_fuzzy_batch_initial( + 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('SearchFuzzyBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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_fuzzy_batch.metadata = {'url': '/search/fuzzy/batch/{format}'} # type: ignore + + def post_search_address_batch_sync( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_address_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressBatchResponse" + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_batch_request_body: 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 search_address_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResponse"] + 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.post_search_address_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_batch_request_body, 'BatchRequestBody') + 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('SearchAddressBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_address_batch_sync.metadata = {'url': '/search/address/batch/sync/{format}'} # type: ignore + + def _post_search_address_batch_initial( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_address_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResponse"]] + 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_search_address_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_batch_request_body, 'BatchRequestBody') + 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('SearchAddressBatchResponse', 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 + _post_search_address_batch_initial.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def begin_post_search_address_batch( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_address_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResponse"] + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ + - 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_batch_request_body: 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 search_address_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :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 SearchAddressBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResponse"] + 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._post_search_address_batch_initial( + format=format, + search_address_batch_request_body=search_address_batch_request_body, + 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('SearchAddressBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_search_address_batch.metadata = {'url': '/search/address/batch/{format}'} # type: ignore + + def _get_search_address_batch_initial( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressBatchResponse"]] + 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 = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('SearchAddressBatchResponse', 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, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressBatchResponse"] + """**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/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/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: + + + * + `\ ``SearchCommonResponse`` + `_ + - 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 format: Batch id for querying the operation. + :type format: 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 SearchAddressBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressBatchResponse"] + 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( + 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('SearchAddressBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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 post_search_address_reverse_batch_sync( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_address_reverse_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> "_models.SearchAddressReverseBatchResponse" + """**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/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/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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_reverse_batch_request_body: 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 search_address_reverse_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SearchAddressReverseBatchResponse, or the result of cls(response) + :rtype: ~azure.maps.search.models.SearchAddressReverseBatchResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseBatchResponse"] + 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.post_search_address_reverse_batch_sync.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_reverse_batch_request_body, 'BatchRequestBody') + 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('SearchAddressReverseBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + post_search_address_reverse_batch_sync.metadata = {'url': '/search/address/reverse/batch/sync/{format}'} # type: ignore + + def _post_search_address_reverse_batch_initial( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_address_reverse_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressReverseBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressReverseBatchResponse"]] + 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_search_address_reverse_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(search_address_reverse_batch_request_body, 'BatchRequestBody') + 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('SearchAddressReverseBatchResponse', 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 + _post_search_address_reverse_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def begin_post_search_address_reverse_batch( + self, + format, # type: Union[str, "_models.ResponseFormat"] + search_address_reverse_batch_request_body, # type: "_models.BatchRequestBody" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressReverseBatchResponse"] + """**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/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/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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.search.models.ResponseFormat + :param search_address_reverse_batch_request_body: 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 search_address_reverse_batch_request_body: ~azure.maps.search.models.BatchRequestBody + :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 SearchAddressReverseBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressReverseBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseBatchResponse"] + 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._post_search_address_reverse_batch_initial( + format=format, + search_address_reverse_batch_request_body=search_address_reverse_batch_request_body, + 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('SearchAddressReverseBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + '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_post_search_address_reverse_batch.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def _get_search_address_reverse_batch_initial( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.SearchAddressReverseBatchResponse"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SearchAddressReverseBatchResponse"]] + 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_reverse_batch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('SearchAddressReverseBatchResponse', 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_reverse_batch_initial.metadata = {'url': '/search/address/reverse/batch/{format}'} # type: ignore + + def begin_get_search_address_reverse_batch( + self, + format, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.SearchAddressReverseBatchResponse"] + """**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/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/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 format: Batch id for querying the operation. + :type format: 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 SearchAddressReverseBatchResponse or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.maps.search.models.SearchAddressReverseBatchResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SearchAddressReverseBatchResponse"] + 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_reverse_batch_initial( + 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('SearchAddressReverseBatchResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, '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_reverse_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..42ea44c55c44 --- /dev/null +++ b/sdk/maps/azure-maps-search/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-timezone/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-timezone/README.md b/sdk/maps/azure-maps-timezone/README.md new file mode 100644 index 000000000000..de17f1ad3d8f --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..bab0472632d0 --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..5eee5738ddd8 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.timezone.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(TimezoneClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..cc6a1562f06b --- /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": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": false, + "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\": [\"TimezoneClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.timezone.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.timezone.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..d246b3705521 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/_timezone_client.py @@ -0,0 +1,88 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.timezone.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = TimezoneClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..73977ac10824 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.timezone.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(TimezoneClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..2c774c17060c --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/_timezone_client.py @@ -0,0 +1,81 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.timezone.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = TimezoneClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..bfd778cf64d4 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/aio/operations/_timezone_operations.py @@ -0,0 +1,500 @@ +# 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, + format: Union[str, "_models.ResponseFormat"], + query: str, + accept_language: Optional[str] = None, + options: Optional[Union[str, "_models.TimezoneOptions"]] = None, + time_stamp: Optional[datetime.datetime] = None, + transitions_from: Optional[datetime.datetime] = None, + transitions_years: Optional[int] = None, + **kwargs: Any + ) -> "_models.TimezoneByIdResult": + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :param query: The IANA time zone ID. + :type query: 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 transitions_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 transitions_from: ~datetime.datetime + :param transitions_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 transitions_years: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneByIdResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneByIdResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneByIdResult"] + 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 = { + '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') + 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 transitions_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("transitions_from", transitions_from, 'iso-8601') + if transitions_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("transitions_years", transitions_years, 'int') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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('TimezoneByIdResult', 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, + format: Union[str, "_models.ResponseFormat"], + query: str, + accept_language: Optional[str] = None, + options: Optional[Union[str, "_models.TimezoneOptions"]] = None, + time_stamp: Optional[datetime.datetime] = None, + transitions_from: Optional[datetime.datetime] = None, + transitions_years: Optional[int] = None, + **kwargs: Any + ) -> "_models.TimezoneByCoordinatesResult": + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :param query: Coordinates of the point for which time zone information is requested. The + applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: 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 transitions_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 transitions_from: ~datetime.datetime + :param transitions_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 transitions_years: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneByCoordinatesResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneByCoordinatesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneByCoordinatesResult"] + 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 = { + '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') + 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 transitions_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("transitions_from", transitions_from, 'iso-8601') + if transitions_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("transitions_years", transitions_years, 'int') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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('TimezoneByCoordinatesResult', 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_timezone_enum_windows( + self, + format: Union[str, "_models.ResponseFormat"], + **kwargs: Any + ) -> List["_models.TimezoneEnumWindow"]: + """**Enumerate 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.ResponseFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TimezoneEnumWindow, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.TimezoneEnumWindow] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TimezoneEnumWindow"]] + 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_enum_windows.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('[TimezoneEnumWindow]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_enum_windows.metadata = {'url': '/timezone/enumWindows/{format}'} # type: ignore + + async def get_timezone_enum_iana( + self, + format: Union[str, "_models.ResponseFormat"], + **kwargs: Any + ) -> List["_models.IanaId"]: + """**Enumerate 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.ResponseFormat + :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_timezone_enum_iana.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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_timezone_enum_iana.metadata = {'url': '/timezone/enumIana/{format}'} # type: ignore + + async def get_timezone_iana_version( + self, + format: Union[str, "_models.ResponseFormat"], + **kwargs: Any + ) -> "_models.TimezoneIanaVersionResult": + """**Time Zone IANA Version** + + **Applies to**\ : S0 and S1 pricing tiers. + + This API returns the current IANA version number. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :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_timezone_iana_version.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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_timezone_iana_version.metadata = {'url': '/timezone/ianaVersion/{format}'} # type: ignore + + async def get_timezone_windows_to_iana( + self, + format: Union[str, "_models.ResponseFormat"], + query: str, + territory: 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :param query: The Windows time zone ID. + :type query: str + :param territory: Windows Time Zone territory code. + :type territory: 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.get_timezone_windows_to_iana.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') + if territory is not None: + query_parameters['territory'] = self._serialize.query("territory", territory, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('[IanaId]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_windows_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..d0b06e0b04a8 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/__init__.py @@ -0,0 +1,72 @@ +# 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 ReferenceTimeByCoordinates + from ._models_py3 import ReferenceTimeById + from ._models_py3 import RepresentativePoint + from ._models_py3 import TimeTransition + from ._models_py3 import TimeZoneByCoordinates + from ._models_py3 import TimezoneByCoordinatesResult + from ._models_py3 import TimezoneById + from ._models_py3 import TimezoneByIdResult + from ._models_py3 import TimezoneEnumWindow + from ._models_py3 import TimezoneIanaVersionResult + from ._models_py3 import TimezoneNames +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 ReferenceTimeByCoordinates # type: ignore + from ._models import ReferenceTimeById # type: ignore + from ._models import RepresentativePoint # type: ignore + from ._models import TimeTransition # type: ignore + from ._models import TimeZoneByCoordinates # type: ignore + from ._models import TimezoneByCoordinatesResult # type: ignore + from ._models import TimezoneById # type: ignore + from ._models import TimezoneByIdResult # type: ignore + from ._models import TimezoneEnumWindow # type: ignore + from ._models import TimezoneIanaVersionResult # type: ignore + from ._models import TimezoneNames # type: ignore + +from ._timezone_client_enums import ( + GeographicResourceLocation, + Geography, + ResponseFormat, + TimezoneOptions, +) + +__all__ = [ + 'CountryRecord', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'IanaId', + 'ReferenceTimeByCoordinates', + 'ReferenceTimeById', + 'RepresentativePoint', + 'TimeTransition', + 'TimeZoneByCoordinates', + 'TimezoneByCoordinatesResult', + 'TimezoneById', + 'TimezoneByIdResult', + 'TimezoneEnumWindow', + 'TimezoneIanaVersionResult', + 'TimezoneNames', + 'GeographicResourceLocation', + 'Geography', + 'ResponseFormat', + '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..e871f924c52a --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models.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 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: HasZone1970Location property. + :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 ReferenceTimeByCoordinates(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. + :vartype sunrise: str + :ivar sunset: Sunset at the given time zone as shown in the ``Tag`` property. + :vartype sunset: str + """ + + _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': 'str'}, + 'sunset': {'key': 'Sunset', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReferenceTimeByCoordinates, 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 ReferenceTimeById(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 + """ + + _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}, + } + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(ReferenceTimeById, 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 + + +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 TimeZoneByCoordinates(msrest.serialization.Model): + """TimeZoneByCoordinates. + + 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.ReferenceTimeByCoordinates + :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': 'ReferenceTimeByCoordinates'}, + 'representative_point': {'key': 'RepresentativePoint', 'type': 'RepresentativePoint'}, + 'time_transitions': {'key': 'TimeTransitions', 'type': '[TimeTransition]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimeZoneByCoordinates, 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 TimezoneByCoordinatesResult(msrest.serialization.Model): + """This object is returned from a successful Timezone 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: TimeZoneByCoordinates array. + :vartype time_zones: list[~azure.maps.timezone.models.TimeZoneByCoordinates] + """ + + _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': '[TimeZoneByCoordinates]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneByCoordinatesResult, self).__init__(**kwargs) + self.version = None + self.reference_utc_timestamp = None + self.time_zones = None + + +class TimezoneById(msrest.serialization.Model): + """TimezoneById. + + 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.ReferenceTimeById + :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': 'ReferenceTimeById'}, + 'representative_point': {'key': 'RepresentativePoint', 'type': 'RepresentativePoint'}, + 'time_transitions': {'key': 'TimeTransitions', 'type': '[TimeTransition]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneById, 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 TimezoneByIdResult(msrest.serialization.Model): + """This object is returned from a successful Timezone By ID 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: TimeZoneById array. + :vartype time_zones: list[~azure.maps.timezone.models.TimezoneById] + """ + + _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': '[TimezoneById]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneByIdResult, self).__init__(**kwargs) + self.version = None + self.reference_utc_timestamp = None + self.time_zones = None + + +class TimezoneEnumWindow(msrest.serialization.Model): + """TimezoneEnumWindow. + + 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(TimezoneEnumWindow, self).__init__(**kwargs) + self.windows_id = None + self.territory = None + self.iana_ids = kwargs.get('iana_ids', 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 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 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..42ab6d410e66 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_models_py3.py @@ -0,0 +1,660 @@ +# 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: HasZone1970Location property. + :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 ReferenceTimeByCoordinates(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. + :vartype sunrise: str + :ivar sunset: Sunset at the given time zone as shown in the ``Tag`` property. + :vartype sunset: str + """ + + _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': 'str'}, + 'sunset': {'key': 'Sunset', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReferenceTimeByCoordinates, 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 ReferenceTimeById(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 + """ + + _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}, + } + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(ReferenceTimeById, 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 + + +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 TimeZoneByCoordinates(msrest.serialization.Model): + """TimeZoneByCoordinates. + + 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.ReferenceTimeByCoordinates + :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': 'ReferenceTimeByCoordinates'}, + 'representative_point': {'key': 'RepresentativePoint', 'type': 'RepresentativePoint'}, + 'time_transitions': {'key': 'TimeTransitions', 'type': '[TimeTransition]'}, + } + + def __init__( + self, + *, + names: Optional["TimezoneNames"] = None, + **kwargs + ): + super(TimeZoneByCoordinates, 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 TimezoneByCoordinatesResult(msrest.serialization.Model): + """This object is returned from a successful Timezone 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: TimeZoneByCoordinates array. + :vartype time_zones: list[~azure.maps.timezone.models.TimeZoneByCoordinates] + """ + + _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': '[TimeZoneByCoordinates]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneByCoordinatesResult, self).__init__(**kwargs) + self.version = None + self.reference_utc_timestamp = None + self.time_zones = None + + +class TimezoneById(msrest.serialization.Model): + """TimezoneById. + + 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.ReferenceTimeById + :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': 'ReferenceTimeById'}, + 'representative_point': {'key': 'RepresentativePoint', 'type': 'RepresentativePoint'}, + 'time_transitions': {'key': 'TimeTransitions', 'type': '[TimeTransition]'}, + } + + def __init__( + self, + *, + names: Optional["TimezoneNames"] = None, + **kwargs + ): + super(TimezoneById, 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 TimezoneByIdResult(msrest.serialization.Model): + """This object is returned from a successful Timezone By ID 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: TimeZoneById array. + :vartype time_zones: list[~azure.maps.timezone.models.TimezoneById] + """ + + _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': '[TimezoneById]'}, + } + + def __init__( + self, + **kwargs + ): + super(TimezoneByIdResult, self).__init__(**kwargs) + self.version = None + self.reference_utc_timestamp = None + self.time_zones = None + + +class TimezoneEnumWindow(msrest.serialization.Model): + """TimezoneEnumWindow. + + 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(TimezoneEnumWindow, self).__init__(**kwargs) + self.windows_id = None + self.territory = None + self.iana_ids = iana_ids + + +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 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 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..951c8a53268f --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/models/_timezone_client_enums.py @@ -0,0 +1,60 @@ +# 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 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 ResponseFormat(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..968349825adf --- /dev/null +++ b/sdk/maps/azure-maps-timezone/azure/maps/timezone/operations/_timezone_operations.py @@ -0,0 +1,510 @@ +# 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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + accept_language=None, # type: Optional[str] + options=None, # type: Optional[Union[str, "_models.TimezoneOptions"]] + time_stamp=None, # type: Optional[datetime.datetime] + transitions_from=None, # type: Optional[datetime.datetime] + transitions_years=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.TimezoneByIdResult" + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :param query: The IANA time zone ID. + :type query: 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 transitions_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 transitions_from: ~datetime.datetime + :param transitions_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 transitions_years: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneByIdResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneByIdResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneByIdResult"] + 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 = { + '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') + 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 transitions_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("transitions_from", transitions_from, 'iso-8601') + if transitions_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("transitions_years", transitions_years, 'int') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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('TimezoneByIdResult', 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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + accept_language=None, # type: Optional[str] + options=None, # type: Optional[Union[str, "_models.TimezoneOptions"]] + time_stamp=None, # type: Optional[datetime.datetime] + transitions_from=None, # type: Optional[datetime.datetime] + transitions_years=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.TimezoneByCoordinatesResult" + """**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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :param query: Coordinates of the point for which time zone information is requested. The + applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: 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 transitions_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 transitions_from: ~datetime.datetime + :param transitions_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 transitions_years: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TimezoneByCoordinatesResult, or the result of cls(response) + :rtype: ~azure.maps.timezone.models.TimezoneByCoordinatesResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TimezoneByCoordinatesResult"] + 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 = { + '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') + 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 transitions_from is not None: + query_parameters['transitionsFrom'] = self._serialize.query("transitions_from", transitions_from, 'iso-8601') + if transitions_years is not None: + query_parameters['transitionsYears'] = self._serialize.query("transitions_years", transitions_years, 'int') + query_parameters['query'] = self._serialize.query("query", query, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + 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('TimezoneByCoordinatesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_by_coordinates.metadata = {'url': '/timezone/byCoordinates/{format}'} # type: ignore + + def get_timezone_enum_windows( + self, + format, # type: Union[str, "_models.ResponseFormat"] + **kwargs # type: Any + ): + # type: (...) -> List["_models.TimezoneEnumWindow"] + """**Enumerate 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.ResponseFormat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of TimezoneEnumWindow, or the result of cls(response) + :rtype: list[~azure.maps.timezone.models.TimezoneEnumWindow] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.TimezoneEnumWindow"]] + 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_enum_windows.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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('[TimezoneEnumWindow]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_enum_windows.metadata = {'url': '/timezone/enumWindows/{format}'} # type: ignore + + def get_timezone_enum_iana( + self, + format, # type: Union[str, "_models.ResponseFormat"] + **kwargs # type: Any + ): + # type: (...) -> List["_models.IanaId"] + """**Enumerate 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.ResponseFormat + :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_timezone_enum_iana.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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_timezone_enum_iana.metadata = {'url': '/timezone/enumIana/{format}'} # type: ignore + + def get_timezone_iana_version( + self, + format, # type: Union[str, "_models.ResponseFormat"] + **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. + + :param format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :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_timezone_iana_version.metadata['url'] # type: ignore + path_format_arguments = { + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), + 'format': self._serialize.url("format", format, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['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_timezone_iana_version.metadata = {'url': '/timezone/ianaVersion/{format}'} # type: ignore + + def get_timezone_windows_to_iana( + self, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + territory=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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.timezone.models.ResponseFormat + :param query: The Windows time zone ID. + :type query: str + :param territory: Windows Time Zone territory code. + :type territory: 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.get_timezone_windows_to_iana.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') + if territory is not None: + query_parameters['territory'] = self._serialize.query("territory", territory, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if self._config.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('[IanaId]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_timezone_windows_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..5b38febc7981 --- /dev/null +++ b/sdk/maps/azure-maps-timezone/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-traffic/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-traffic/README.md b/sdk/maps/azure-maps-traffic/README.md new file mode 100644 index 000000000000..dc24cc9ef080 --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..6a6e582b052c --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..ab287383a870 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.traffic.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(TrafficClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..03d8767d7fb0 --- /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": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": false, + "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\": [\"TrafficClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.traffic.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.traffic.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..25eb1a3c38c1 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/_traffic_client.py @@ -0,0 +1,88 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.traffic.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = TrafficClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..8ac66db37fd1 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.traffic.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(TrafficClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..dd7b648c47b5 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/_traffic_client.py @@ -0,0 +1,81 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.traffic.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = TrafficClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..643c4ee85b0b --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/aio/operations/_traffic_operations.py @@ -0,0 +1,589 @@ +# 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 ... 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, + x_tile_index: int, + y_tile_index: int, + 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 x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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', {})) + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_traffic_flow_tile.metadata = {'url': '/traffic/flow/tile/{format}'} # type: ignore + + async def get_traffic_flow_segment( + self, + format: Union[str, "_models.TextFormat"], + style: Union[str, "_models.TrafficFlowSegmentStyle"], + zoom: int, + query: str, + unit: Optional[Union[str, "_models.SpeedUnit"]] = None, + thickness: Optional[int] = None, + open_lr: Optional[bool] = None, + **kwargs: Any + ) -> "_models.TrafficFlowSegmentResult": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.TextFormat + :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 query: Coordinates of the point close to the road segment. They have to be + comma-separated and calculated using EPSG4326 projection. + :type query: str + :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: TrafficFlowSegmentResult, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficFlowSegmentResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficFlowSegmentResult"] + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['query'] = self._serialize.query("query", query, 'str') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TrafficFlowSegmentResult', 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, + x_tile_index: int, + y_tile_index: int, + 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 x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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', {})) + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_traffic_incident_tile.metadata = {'url': '/traffic/incident/tile/{format}'} # type: ignore + + async def get_traffic_incident_detail( + self, + format: Union[str, "_models.TextFormat"], + style: Union[str, "_models.TrafficIncidentDetailStyle"], + boundingbox: str, + bounding_zoom: int, + trafficmodelid: str, + 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.TrafficIncidentDetailResult": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.TextFormat + :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.TrafficIncidentDetailStyle + :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: str + :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 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: TrafficIncidentDetailResult, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentDetailResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentDetailResult"] + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['boundingbox'] = self._serialize.query("boundingbox", boundingbox, 'str') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TrafficIncidentDetailResult', 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, + format: Union[str, "_models.TextFormat"], + boundingbox: str, + boundingzoom: int, + overviewbox: str, + overviewzoom: int, + copyright: Optional[bool] = True, + **kwargs: Any + ) -> "_models.TrafficIncidentViewportResult": + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.TextFormat + :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). 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: str + :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. + :type overviewbox: str + :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 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: TrafficIncidentViewportResult, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentViewportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentViewportResult"] + 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 = { + '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['boundingbox'] = self._serialize.query("boundingbox", boundingbox, 'str') + query_parameters['boundingzoom'] = self._serialize.query("boundingzoom", boundingzoom, 'int', maximum=22, minimum=0) + query_parameters['overviewbox'] = self._serialize.query("overviewbox", overviewbox, 'str') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TrafficIncidentViewportResult', 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..d4dfafc4cbd4 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/__init__.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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CoordinatesPair + from ._models_py3 import ErrorAdditionalInfo + from ._models_py3 import ErrorDetail + from ._models_py3 import ErrorResponse + from ._models_py3 import TrafficFlowSegmentResult + from ._models_py3 import TrafficFlowSegmentResultFlowSegmentData + from ._models_py3 import TrafficFlowSegmentResultFlowSegmentDataCoordinates + from ._models_py3 import TrafficIncidentDetailResult + from ._models_py3 import TrafficIncidentDetailResultTm + from ._models_py3 import TrafficIncidentPoi + from ._models_py3 import TrafficIncidentPoiCbl + from ._models_py3 import TrafficIncidentPoiCtr + from ._models_py3 import TrafficIncidentPoiP + from ._models_py3 import TrafficIncidentViewportResult + from ._models_py3 import TrafficIncidentViewportResultViewpResp + from ._models_py3 import TrafficIncidentViewportResultViewpRespTrafficState +except (SyntaxError, ImportError): + from ._models import CoordinatesPair # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # type: ignore + from ._models import TrafficFlowSegmentResult # type: ignore + from ._models import TrafficFlowSegmentResultFlowSegmentData # type: ignore + from ._models import TrafficFlowSegmentResultFlowSegmentDataCoordinates # type: ignore + from ._models import TrafficIncidentDetailResult # type: ignore + from ._models import TrafficIncidentDetailResultTm # type: ignore + from ._models import TrafficIncidentPoi # type: ignore + from ._models import TrafficIncidentPoiCbl # type: ignore + from ._models import TrafficIncidentPoiCtr # type: ignore + from ._models import TrafficIncidentPoiP # type: ignore + from ._models import TrafficIncidentViewportResult # type: ignore + from ._models import TrafficIncidentViewportResultViewpResp # type: ignore + from ._models import TrafficIncidentViewportResultViewpRespTrafficState # type: ignore + +from ._traffic_client_enums import ( + GeographicResourceLocation, + Geography, + IncidentGeometryType, + ProjectionStandard, + SpeedUnit, + TextFormat, + TileFormat, + TrafficFlowSegmentStyle, + TrafficFlowTileStyle, + TrafficIncidentDetailStyle, + TrafficIncidentTileStyle, +) + +__all__ = [ + 'CoordinatesPair', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'TrafficFlowSegmentResult', + 'TrafficFlowSegmentResultFlowSegmentData', + 'TrafficFlowSegmentResultFlowSegmentDataCoordinates', + 'TrafficIncidentDetailResult', + 'TrafficIncidentDetailResultTm', + 'TrafficIncidentPoi', + 'TrafficIncidentPoiCbl', + 'TrafficIncidentPoiCtr', + 'TrafficIncidentPoiP', + 'TrafficIncidentViewportResult', + 'TrafficIncidentViewportResultViewpResp', + 'TrafficIncidentViewportResultViewpRespTrafficState', + 'GeographicResourceLocation', + 'Geography', + 'IncidentGeometryType', + 'ProjectionStandard', + 'SpeedUnit', + 'TextFormat', + 'TileFormat', + 'TrafficFlowSegmentStyle', + 'TrafficFlowTileStyle', + 'TrafficIncidentDetailStyle', + '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..0e5a743553bb --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models.py @@ -0,0 +1,599 @@ +# 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 CoordinatesPair(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(CoordinatesPair, self).__init__(**kwargs) + self.latitude = kwargs.get('latitude', None) + self.longitude = kwargs.get('longitude', 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.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 TrafficFlowSegmentResult(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.TrafficFlowSegmentResultFlowSegmentData + """ + + _validation = { + 'flow_segment_data': {'readonly': True}, + } + + _attribute_map = { + 'flow_segment_data': {'key': 'flowSegmentData', 'type': 'TrafficFlowSegmentResultFlowSegmentData'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentResult, self).__init__(**kwargs) + self.flow_segment_data = None + + +class TrafficFlowSegmentResultFlowSegmentData(msrest.serialization.Model): + """Flow Segment Data property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar frc: 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 frc: 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 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 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.TrafficFlowSegmentResultFlowSegmentDataCoordinates + :ivar version: This indicates the software version that generated the response. + :vartype version: str + :ivar openlr: OpenLR code for segment. + :vartype openlr: float + """ + + _validation = { + 'frc': {'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}, + 'openlr': {'readonly': True}, + } + + _attribute_map = { + 'frc': {'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': 'TrafficFlowSegmentResultFlowSegmentDataCoordinates'}, + 'version': {'key': '@version', 'type': 'str'}, + 'openlr': {'key': 'openlr', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentResultFlowSegmentData, self).__init__(**kwargs) + self.frc = 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.openlr = None + + +class TrafficFlowSegmentResultFlowSegmentDataCoordinates(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 coordinate: Coordinate array. + :vartype coordinate: list[~azure.maps.traffic.models.CoordinatesPair] + """ + + _validation = { + 'coordinate': {'readonly': True}, + } + + _attribute_map = { + 'coordinate': {'key': 'coordinate', 'type': '[CoordinatesPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentResultFlowSegmentDataCoordinates, self).__init__(**kwargs) + self.coordinate = None + + +class TrafficIncidentDetailResult(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.TrafficIncidentDetailResultTm + """ + + _validation = { + 'tm': {'readonly': True}, + } + + _attribute_map = { + 'tm': {'key': 'tm', 'type': 'TrafficIncidentDetailResultTm'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetailResult, self).__init__(**kwargs) + self.tm = None + + +class TrafficIncidentDetailResultTm(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 incident. + :vartype id: str + :ivar poi: A single traffic incident, or a cluster of traffic incidents. + :vartype poi: list[~azure.maps.traffic.models.TrafficIncidentPoi] + """ + + _validation = { + 'id': {'readonly': True}, + 'poi': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': '@id', 'type': 'str'}, + 'poi': {'key': 'poi', 'type': '[TrafficIncidentPoi]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetailResultTm, self).__init__(**kwargs) + self.id = None + self.poi = None + + +class TrafficIncidentPoi(msrest.serialization.Model): + """TrafficIncidentPoi. + + 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 p: 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 p: ~azure.maps.traffic.models.TrafficIncidentPoiP + :ivar ic: 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. + :vartype ic: int + :ivar ty: The magnitude of delay associated with incident. These values correspond to incident + colors in the traffic tiles. + :vartype ty: int + :ivar cbl: Bottom left coordinate of the cluster in the projection of the request. + :vartype cbl: ~azure.maps.traffic.models.TrafficIncidentPoiCbl + :ivar ctr: Top right coordinate of the cluster in the projection of the request. + :vartype ctr: ~azure.maps.traffic.models.TrafficIncidentPoiCtr + :ivar cs: Cluster size: the number of incidents in the cluster. + :vartype cs: int + :ivar l: Length of the incident in meters. + :vartype l: int + :ivar r: The road number(s) affected by the incident. Multiple road numbers will delimited by + slashes. + :vartype r: str + :ivar dl: Delay caused by the incident in seconds (except in road closures). + :vartype dl: int + :ivar t: To: the name of the intersection or location where the traffic due to the incident + ends. + :vartype t: str + :ivar f: From: the name of the intersection or location where the traffic due to the incident + starts. + :vartype f: str + :ivar d: Description of the incident in the language requested. + :vartype d: str + :ivar c: Cause of the incident, where available, in the language requested. + :vartype c: str + """ + + _validation = { + 'id': {'readonly': True}, + 'p': {'readonly': True}, + 'ic': {'readonly': True}, + 'ty': {'readonly': True}, + 'cbl': {'readonly': True}, + 'ctr': {'readonly': True}, + 'cs': {'readonly': True}, + 'l': {'readonly': True}, + 'r': {'readonly': True}, + 'dl': {'readonly': True}, + 't': {'readonly': True}, + 'f': {'readonly': True}, + 'd': {'readonly': True}, + 'c': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'p': {'key': 'p', 'type': 'TrafficIncidentPoiP'}, + 'ic': {'key': 'ic', 'type': 'int'}, + 'ty': {'key': 'ty', 'type': 'int'}, + 'cbl': {'key': 'cbl', 'type': 'TrafficIncidentPoiCbl'}, + 'ctr': {'key': 'ctr', 'type': 'TrafficIncidentPoiCtr'}, + 'cs': {'key': 'cs', 'type': 'int'}, + 'l': {'key': 'l', 'type': 'int'}, + 'r': {'key': 'r', 'type': 'str'}, + 'dl': {'key': 'dl', 'type': 'int'}, + 't': {'key': 't', 'type': 'str'}, + 'f': {'key': 'f', 'type': 'str'}, + 'd': {'key': 'd', 'type': 'str'}, + 'c': {'key': 'c', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentPoi, self).__init__(**kwargs) + self.id = None + self.p = None + self.ic = None + self.ty = None + self.cbl = None + self.ctr = None + self.cs = None + self.l = None + self.r = None + self.dl = None + self.t = None + self.f = None + self.d = None + self.c = None + + +class TrafficIncidentPoiCbl(msrest.serialization.Model): + """Bottom left coordinate of the cluster in the projection of the request. + + 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(TrafficIncidentPoiCbl, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TrafficIncidentPoiCtr(msrest.serialization.Model): + """Top right coordinate of the cluster in the projection of the request. + + 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(TrafficIncidentPoiCtr, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TrafficIncidentPoiP(msrest.serialization.Model): + """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. + + 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(TrafficIncidentPoiP, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TrafficIncidentViewportResult(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.TrafficIncidentViewportResultViewpResp + """ + + _validation = { + 'viewp_resp': {'readonly': True}, + } + + _attribute_map = { + 'viewp_resp': {'key': 'viewpResp', 'type': 'TrafficIncidentViewportResultViewpResp'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewportResult, self).__init__(**kwargs) + self.viewp_resp = None + + +class TrafficIncidentViewportResultViewpResp(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 array. + :vartype traffic_state: + ~azure.maps.traffic.models.TrafficIncidentViewportResultViewpRespTrafficState + :ivar copyright_ids: Copyright Ids property. + :vartype copyright_ids: str + :ivar version: @Version property. + :vartype version: str + :ivar maps: @maps property. + :vartype maps: str + """ + + _validation = { + 'traffic_state': {'readonly': True}, + 'copyright_ids': {'readonly': True}, + 'version': {'readonly': True}, + 'maps': {'readonly': True}, + } + + _attribute_map = { + 'traffic_state': {'key': 'trafficState', 'type': 'TrafficIncidentViewportResultViewpRespTrafficState'}, + 'copyright_ids': {'key': 'copyrightIds', 'type': 'str'}, + 'version': {'key': '@version', 'type': 'str'}, + 'maps': {'key': '@maps', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewportResultViewpResp, self).__init__(**kwargs) + self.traffic_state = None + self.copyright_ids = None + self.version = None + self.maps = None + + +class TrafficIncidentViewportResultViewpRespTrafficState(msrest.serialization.Model): + """Traffic State array. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar traffic_age: @Traffic Age property. + :vartype traffic_age: int + :ivar traffic_model_id: @Traffic Model Id property. + :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(TrafficIncidentViewportResultViewpRespTrafficState, 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..0a4b78e0ba1c --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_models_py3.py @@ -0,0 +1,608 @@ +# 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 CoordinatesPair(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(CoordinatesPair, self).__init__(**kwargs) + self.latitude = latitude + self.longitude = longitude + + +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 TrafficFlowSegmentResult(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.TrafficFlowSegmentResultFlowSegmentData + """ + + _validation = { + 'flow_segment_data': {'readonly': True}, + } + + _attribute_map = { + 'flow_segment_data': {'key': 'flowSegmentData', 'type': 'TrafficFlowSegmentResultFlowSegmentData'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentResult, self).__init__(**kwargs) + self.flow_segment_data = None + + +class TrafficFlowSegmentResultFlowSegmentData(msrest.serialization.Model): + """Flow Segment Data property. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar frc: 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 frc: 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 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 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.TrafficFlowSegmentResultFlowSegmentDataCoordinates + :ivar version: This indicates the software version that generated the response. + :vartype version: str + :ivar openlr: OpenLR code for segment. + :vartype openlr: float + """ + + _validation = { + 'frc': {'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}, + 'openlr': {'readonly': True}, + } + + _attribute_map = { + 'frc': {'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': 'TrafficFlowSegmentResultFlowSegmentDataCoordinates'}, + 'version': {'key': '@version', 'type': 'str'}, + 'openlr': {'key': 'openlr', 'type': 'float'}, + } + + def __init__( + self, + *, + coordinates: Optional["TrafficFlowSegmentResultFlowSegmentDataCoordinates"] = None, + **kwargs + ): + super(TrafficFlowSegmentResultFlowSegmentData, self).__init__(**kwargs) + self.frc = 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.openlr = None + + +class TrafficFlowSegmentResultFlowSegmentDataCoordinates(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 coordinate: Coordinate array. + :vartype coordinate: list[~azure.maps.traffic.models.CoordinatesPair] + """ + + _validation = { + 'coordinate': {'readonly': True}, + } + + _attribute_map = { + 'coordinate': {'key': 'coordinate', 'type': '[CoordinatesPair]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficFlowSegmentResultFlowSegmentDataCoordinates, self).__init__(**kwargs) + self.coordinate = None + + +class TrafficIncidentDetailResult(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.TrafficIncidentDetailResultTm + """ + + _validation = { + 'tm': {'readonly': True}, + } + + _attribute_map = { + 'tm': {'key': 'tm', 'type': 'TrafficIncidentDetailResultTm'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetailResult, self).__init__(**kwargs) + self.tm = None + + +class TrafficIncidentDetailResultTm(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 incident. + :vartype id: str + :ivar poi: A single traffic incident, or a cluster of traffic incidents. + :vartype poi: list[~azure.maps.traffic.models.TrafficIncidentPoi] + """ + + _validation = { + 'id': {'readonly': True}, + 'poi': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': '@id', 'type': 'str'}, + 'poi': {'key': 'poi', 'type': '[TrafficIncidentPoi]'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentDetailResultTm, self).__init__(**kwargs) + self.id = None + self.poi = None + + +class TrafficIncidentPoi(msrest.serialization.Model): + """TrafficIncidentPoi. + + 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 p: 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 p: ~azure.maps.traffic.models.TrafficIncidentPoiP + :ivar ic: 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. + :vartype ic: int + :ivar ty: The magnitude of delay associated with incident. These values correspond to incident + colors in the traffic tiles. + :vartype ty: int + :ivar cbl: Bottom left coordinate of the cluster in the projection of the request. + :vartype cbl: ~azure.maps.traffic.models.TrafficIncidentPoiCbl + :ivar ctr: Top right coordinate of the cluster in the projection of the request. + :vartype ctr: ~azure.maps.traffic.models.TrafficIncidentPoiCtr + :ivar cs: Cluster size: the number of incidents in the cluster. + :vartype cs: int + :ivar l: Length of the incident in meters. + :vartype l: int + :ivar r: The road number(s) affected by the incident. Multiple road numbers will delimited by + slashes. + :vartype r: str + :ivar dl: Delay caused by the incident in seconds (except in road closures). + :vartype dl: int + :ivar t: To: the name of the intersection or location where the traffic due to the incident + ends. + :vartype t: str + :ivar f: From: the name of the intersection or location where the traffic due to the incident + starts. + :vartype f: str + :ivar d: Description of the incident in the language requested. + :vartype d: str + :ivar c: Cause of the incident, where available, in the language requested. + :vartype c: str + """ + + _validation = { + 'id': {'readonly': True}, + 'p': {'readonly': True}, + 'ic': {'readonly': True}, + 'ty': {'readonly': True}, + 'cbl': {'readonly': True}, + 'ctr': {'readonly': True}, + 'cs': {'readonly': True}, + 'l': {'readonly': True}, + 'r': {'readonly': True}, + 'dl': {'readonly': True}, + 't': {'readonly': True}, + 'f': {'readonly': True}, + 'd': {'readonly': True}, + 'c': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'p': {'key': 'p', 'type': 'TrafficIncidentPoiP'}, + 'ic': {'key': 'ic', 'type': 'int'}, + 'ty': {'key': 'ty', 'type': 'int'}, + 'cbl': {'key': 'cbl', 'type': 'TrafficIncidentPoiCbl'}, + 'ctr': {'key': 'ctr', 'type': 'TrafficIncidentPoiCtr'}, + 'cs': {'key': 'cs', 'type': 'int'}, + 'l': {'key': 'l', 'type': 'int'}, + 'r': {'key': 'r', 'type': 'str'}, + 'dl': {'key': 'dl', 'type': 'int'}, + 't': {'key': 't', 'type': 'str'}, + 'f': {'key': 'f', 'type': 'str'}, + 'd': {'key': 'd', 'type': 'str'}, + 'c': {'key': 'c', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentPoi, self).__init__(**kwargs) + self.id = None + self.p = None + self.ic = None + self.ty = None + self.cbl = None + self.ctr = None + self.cs = None + self.l = None + self.r = None + self.dl = None + self.t = None + self.f = None + self.d = None + self.c = None + + +class TrafficIncidentPoiCbl(msrest.serialization.Model): + """Bottom left coordinate of the cluster in the projection of the request. + + 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(TrafficIncidentPoiCbl, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TrafficIncidentPoiCtr(msrest.serialization.Model): + """Top right coordinate of the cluster in the projection of the request. + + 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(TrafficIncidentPoiCtr, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TrafficIncidentPoiP(msrest.serialization.Model): + """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. + + 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(TrafficIncidentPoiP, self).__init__(**kwargs) + self.x = None + self.y = None + + +class TrafficIncidentViewportResult(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.TrafficIncidentViewportResultViewpResp + """ + + _validation = { + 'viewp_resp': {'readonly': True}, + } + + _attribute_map = { + 'viewp_resp': {'key': 'viewpResp', 'type': 'TrafficIncidentViewportResultViewpResp'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewportResult, self).__init__(**kwargs) + self.viewp_resp = None + + +class TrafficIncidentViewportResultViewpResp(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 array. + :vartype traffic_state: + ~azure.maps.traffic.models.TrafficIncidentViewportResultViewpRespTrafficState + :ivar copyright_ids: Copyright Ids property. + :vartype copyright_ids: str + :ivar version: @Version property. + :vartype version: str + :ivar maps: @maps property. + :vartype maps: str + """ + + _validation = { + 'traffic_state': {'readonly': True}, + 'copyright_ids': {'readonly': True}, + 'version': {'readonly': True}, + 'maps': {'readonly': True}, + } + + _attribute_map = { + 'traffic_state': {'key': 'trafficState', 'type': 'TrafficIncidentViewportResultViewpRespTrafficState'}, + 'copyright_ids': {'key': 'copyrightIds', 'type': 'str'}, + 'version': {'key': '@version', 'type': 'str'}, + 'maps': {'key': '@maps', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrafficIncidentViewportResultViewpResp, self).__init__(**kwargs) + self.traffic_state = None + self.copyright_ids = None + self.version = None + self.maps = None + + +class TrafficIncidentViewportResultViewpRespTrafficState(msrest.serialization.Model): + """Traffic State array. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar traffic_age: @Traffic Age property. + :vartype traffic_age: int + :ivar traffic_model_id: @Traffic Model Id property. + :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(TrafficIncidentViewportResultViewpRespTrafficState, 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..482defac5e81 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/models/_traffic_client_enums.py @@ -0,0 +1,122 @@ +# 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 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 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 SpeedUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: Kilometers Per Hour. + KMPH = "KMPH" + #: Miles Per Hour. + MPH = "MPH" + +class TextFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + #: `The Extensible Markup Language `_. + XML = "xml" + +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 TrafficIncidentDetailStyle(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. + S3 = "s3" + #: Night style. + NIGHT = "night" + +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. + 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..4504784d4d4b --- /dev/null +++ b/sdk/maps/azure-maps-traffic/azure/maps/traffic/operations/_traffic_operations.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 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, 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 + x_tile_index, # type: int + y_tile_index, # type: int + 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 x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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', {})) + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_traffic_flow_tile.metadata = {'url': '/traffic/flow/tile/{format}'} # type: ignore + + def get_traffic_flow_segment( + self, + format, # type: Union[str, "_models.TextFormat"] + style, # type: Union[str, "_models.TrafficFlowSegmentStyle"] + zoom, # type: int + query, # type: str + unit=None, # type: Optional[Union[str, "_models.SpeedUnit"]] + thickness=None, # type: Optional[int] + open_lr=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.TrafficFlowSegmentResult" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.TextFormat + :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 query: Coordinates of the point close to the road segment. They have to be + comma-separated and calculated using EPSG4326 projection. + :type query: str + :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: TrafficFlowSegmentResult, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficFlowSegmentResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficFlowSegmentResult"] + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['query'] = self._serialize.query("query", query, 'str') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TrafficFlowSegmentResult', 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 + x_tile_index, # type: int + y_tile_index, # type: int + 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 x_tile_index: 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_tile_index: int + :param y_tile_index: 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_tile_index: int + :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', {})) + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['zoom'] = self._serialize.query("zoom", zoom, 'int') + query_parameters['x'] = self._serialize.query("x_tile_index", x_tile_index, 'int') + query_parameters['y'] = self._serialize.query("y_tile_index", y_tile_index, '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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=True, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + response_headers = {} + response_headers['Content-Type']=self._deserialize('str', response.headers.get('Content-Type')) + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + get_traffic_incident_tile.metadata = {'url': '/traffic/incident/tile/{format}'} # type: ignore + + def get_traffic_incident_detail( + self, + format, # type: Union[str, "_models.TextFormat"] + style, # type: Union[str, "_models.TrafficIncidentDetailStyle"] + boundingbox, # type: str + bounding_zoom, # type: int + trafficmodelid, # type: str + 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.TrafficIncidentDetailResult" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.TextFormat + :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.TrafficIncidentDetailStyle + :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: str + :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 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: TrafficIncidentDetailResult, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentDetailResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentDetailResult"] + 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 = { + '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['style'] = self._serialize.query("style", style, 'str') + query_parameters['boundingbox'] = self._serialize.query("boundingbox", boundingbox, 'str') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TrafficIncidentDetailResult', 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, + format, # type: Union[str, "_models.TextFormat"] + boundingbox, # type: str + boundingzoom, # type: int + overviewbox, # type: str + overviewzoom, # type: int + copyright=True, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> "_models.TrafficIncidentViewportResult" + """**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 format: Desired format of the response. Value can be either *json* or *xml*. + :type format: str or ~azure.maps.traffic.models.TextFormat + :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). 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: str + :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. + :type overviewbox: str + :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 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: TrafficIncidentViewportResult, or the result of cls(response) + :rtype: ~azure.maps.traffic.models.TrafficIncidentViewportResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TrafficIncidentViewportResult"] + 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 = { + '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['boundingbox'] = self._serialize.query("boundingbox", boundingbox, 'str') + query_parameters['boundingzoom'] = self._serialize.query("boundingzoom", boundingzoom, 'int', maximum=22, minimum=0) + query_parameters['overviewbox'] = self._serialize.query("overviewbox", overviewbox, 'str') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('TrafficIncidentViewportResult', 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..24710a6c69f8 --- /dev/null +++ b/sdk/maps/azure-maps-traffic/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +) 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/MANIFEST.in b/sdk/maps/azure-maps-weather/MANIFEST.in new file mode 100644 index 000000000000..cb7d3109cc06 --- /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 + diff --git a/sdk/maps/azure-maps-weather/README.md b/sdk/maps/azure-maps-weather/README.md new file mode 100644 index 000000000000..7895a0eb737a --- /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.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-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..5d3aab0c52d7 --- /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": "2a89fd49dfef5f02b83fe5018e87bd9ebe195c8e", + "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..609dce5d38a9 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/_configuration.py @@ -0,0 +1,74 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.weather.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(WeatherClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..dbc2812d2991 --- /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": null, + "custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027", + "azure_arm": false, + "has_lro_operations": false, + "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\": [\"WeatherClientConfiguration\"]}}}", + "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\": [\"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 + }, + "x_ms_client_id": { + "signature": "x_ms_client_id=None, # type: Optional[str]", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.weather.models.Geography", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "x_ms_client_id": { + "signature": "x_ms_client_id: Optional[str] = None,", + "description": "Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles \u003chttps://aka.ms/amauthdetails\u003e`_ for guidance.", + "docstring_type": "str", + "required": false + }, + "geography": { + "signature": "geography: Union[str, \"_models.Geography\"] = \"us\",", + "description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.", + "docstring_type": "str or ~azure.maps.weather.models.Geography", + "required": true + } + }, + "constant": { + }, + "call": "credential, x_ms_client_id, geography", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://atlas.microsoft.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\", \"Union\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "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..239844d3ad3a --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/_weather_client.py @@ -0,0 +1,88 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.weather.models.Geography + """ + + def __init__( + self, + credential, # type: "TokenCredential" + x_ms_client_id=None, # type: Optional[str] + geography="us", # type: Union[str, "_models.Geography"] + **kwargs # type: Any + ): + # type: (...) -> None + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = WeatherClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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: () -> 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..0c2df5074071 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_configuration.py @@ -0,0 +1,70 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.weather.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if geography is None: + raise ValueError("Parameter 'geography' must not be None.") + super(WeatherClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.x_ms_client_id = x_ms_client_id + self.geography = geography + 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..58843679dfa8 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/_weather_client.py @@ -0,0 +1,81 @@ +# 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 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 x_ms_client_id: Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following `articles `_ for guidance. + :type x_ms_client_id: str + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. + :type geography: str or ~azure.maps.weather.models.Geography + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + x_ms_client_id: Optional[str] = None, + geography: Union[str, "_models.Geography"] = "us", + **kwargs: Any + ) -> None: + base_url = 'https://{geography}.atlas.microsoft.com' + self._config = WeatherClientConfiguration(credential, x_ms_client_id, geography, **kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.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 + """ + 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) -> "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..4aa3e2cbd7ae --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/aio/operations/_weather_operations.py @@ -0,0 +1,869 @@ +# 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 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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which hourly forecast information is requested. + The applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which minute forecast information is requested. + The applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which quarter-day forecast information is + requested. The applicable query is specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which current conditions information is + requested. The applicable query is specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which current conditions information is + requested. The applicable query is specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :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 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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which severe weather alerts are requested. The + applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: 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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format: Union[str, "_models.ResponseFormat"], + query: str, + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which daily indices are requested. The applicable + query is specified as a comma separated string composed by latitude followed by longitude e.g. + "47.641268,-122.125679". + :type query: 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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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..1ae806bcc8e3 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/__init__.py @@ -0,0 +1,169 @@ +# 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 AlertArea + from ._models_py3 import ColorValue + from ._models_py3 import CurrentConditions + from ._models_py3 import CurrentConditionsResponse + from ._models_py3 import DailyForecast + from ._models_py3 import DailyForecastResponse + from ._models_py3 import DailyForecastSummary + from ._models_py3 import DailyIndex + from ._models_py3 import DailyIndicesResponse + from ._models_py3 import DayOrNight + 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 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 TemperatureSummaryPast12Hours + from ._models_py3 import TemperatureSummaryPast24Hours + from ._models_py3 import TemperatureSummaryPast6Hours + 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 WeatherUnit + from ._models_py3 import WeatherUnitRange + from ._models_py3 import WeatherWaypoint + 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 AlertArea # 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 DailyForecastResponse # type: ignore + from ._models import DailyForecastSummary # type: ignore + from ._models import DailyIndex # type: ignore + from ._models import DailyIndicesResponse # type: ignore + from ._models import DayOrNight # 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 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 TemperatureSummaryPast12Hours # type: ignore + from ._models import TemperatureSummaryPast24Hours # type: ignore + from ._models import TemperatureSummaryPast6Hours # 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 WeatherUnit # type: ignore + from ._models import WeatherUnitRange # type: ignore + from ._models import WeatherWaypoint # 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, + GeographicResourceLocation, + Geography, + LatestStatusKeyword, + ResponseFormat, + WeatherDataUnit, +) + +__all__ = [ + 'AirAndPollen', + 'AlertArea', + 'ColorValue', + 'CurrentConditions', + 'CurrentConditionsResponse', + 'DailyForecast', + 'DailyForecastResponse', + 'DailyForecastSummary', + 'DailyIndex', + 'DailyIndicesResponse', + 'DayOrNight', + 'DegreeDaySummary', + 'ErrorAdditionalInfo', + 'ErrorDetail', + 'ErrorResponse', + 'ForecastInterval', + 'HazardDetail', + 'HourlyForecast', + 'HourlyForecastResponse', + 'IntervalSummary', + 'LatestStatus', + 'LocalSource', + 'MinuteForecastResponse', + 'MinuteForecastSummary', + 'PrecipitationSummary', + 'PressureTendency', + 'QuarterDayForecast', + 'QuarterDayForecastResponse', + 'SevereWeatherAlert', + 'SevereWeatherAlertDescription', + 'SevereWeatherAlertsResponse', + 'SunGlare', + 'TemperatureSummary', + 'TemperatureSummaryPast12Hours', + 'TemperatureSummaryPast24Hours', + 'TemperatureSummaryPast6Hours', + 'WeatherAlongRoutePrecipitation', + 'WeatherAlongRouteResponse', + 'WeatherAlongRouteSummary', + 'WeatherHazards', + 'WeatherNotification', + 'WeatherUnit', + 'WeatherUnitRange', + 'WeatherWaypoint', + 'WindDetails', + 'WindDirection', + 'WindSpeed', + 'DayQuarter', + 'GeographicResourceLocation', + 'Geography', + 'LatestStatusKeyword', + 'ResponseFormat', + '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..82070c4c2810 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models.py @@ -0,0 +1,1941 @@ +# 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 name: Name of the pollen or pollutant. For example, grass, mold, weed, air quality, tree + and UV index. + :type name: 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 type: Only exists for air quality. Examples include ozone and particle pollution. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + 'category': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AirAndPollen, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + self.category = kwargs.get('category', None) + self.category_value = kwargs.get('category_value', None) + self.type = kwargs.get('type', None) + + +class AlertArea(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 summary: Text summarizing the alert in the returned area. + :type summary: 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: str + :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: str + :param latest_status: The latest status of the alert in the current area. + :type latest_status: ~azure.maps.weather.models.LatestStatus + :param alert_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 alert_details: str + :param alert_details_language_code: 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 alert_details_language_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'latest_status': {'key': 'latestStatus', 'type': 'LatestStatus'}, + 'alert_details': {'key': 'alertDetails', 'type': 'str'}, + 'alert_details_language_code': {'key': 'alertDetailsLanguageCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AlertArea, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.summary = kwargs.get('summary', 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.alert_details = kwargs.get('alert_details', None) + self.alert_details_language_code = kwargs.get('alert_details_language_code', 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: str + :param phrase: Phrase description of the current weather condition. Displayed in specified + language. + :type phrase: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: 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 is_day_time: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_day_time: bool + :param temperature: Temperature being returned. + :type temperature: ~azure.maps.weather.models.WeatherUnit + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :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_phrase: Phrase associated with the ``uvIndex``. + :type uv_index_phrase: 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.WeatherUnit + :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 ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the height of + the base of the lowest clouds. + :type ceiling: ~azure.maps.weather.models.WeatherUnit + :param pressure: Atmospheric pressure in specified unit. + :type pressure: ~azure.maps.weather.models.WeatherUnit + :param pressure_tendency: Atmospheric pressure change. + :type pressure_tendency: ~azure.maps.weather.models.PressureTendency + :param past24_hour_temperature_departure: Departure from the temperature observed 24 hours ago + in specified unit. + :type past24_hour_temperature_departure: ~azure.maps.weather.models.WeatherUnit + :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.WeatherUnit + :param wind_chill_temperature: Perceived air temperature on exposed skin due to wind. + :type wind_chill_temperature: ~azure.maps.weather.models.WeatherUnit + :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.WeatherUnit + :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': 'str'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'is_day_time': {'key': 'isDayTime', 'type': 'bool'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherUnit'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnit'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherUnit'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherUnit'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_phrase': {'key': 'uvIndexPhrase', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherUnit'}, + 'obstructions_to_visibility': {'key': 'obstructionsToVisibility', 'type': 'str'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'ceiling': {'key': 'ceiling', 'type': 'WeatherUnit'}, + 'pressure': {'key': 'pressure', 'type': 'WeatherUnit'}, + 'pressure_tendency': {'key': 'pressureTendency', 'type': 'PressureTendency'}, + 'past24_hour_temperature_departure': {'key': 'past24HourTemperatureDeparture', 'type': 'WeatherUnit'}, + 'apparent_temperature': {'key': 'apparentTemperature', 'type': 'WeatherUnit'}, + 'wind_chill_temperature': {'key': 'windChillTemperature', 'type': 'WeatherUnit'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherUnit'}, + '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.phrase = kwargs.get('phrase', None) + self.icon_code = kwargs.get('icon_code', None) + self.has_precipitation = kwargs.get('has_precipitation', None) + self.is_day_time = kwargs.get('is_day_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.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_phrase = kwargs.get('uv_index_phrase', 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.ceiling = kwargs.get('ceiling', None) + self.pressure = kwargs.get('pressure', None) + self.pressure_tendency = kwargs.get('pressure_tendency', None) + self.past24_hour_temperature_departure = kwargs.get('past24_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. + + :param results: Detailed current weather conditions. + :type results: list[~azure.maps.weather.models.CurrentConditions] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[CurrentConditions]'}, + } + + def __init__( + self, + **kwargs + ): + super(CurrentConditionsResponse, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class DailyForecast(msrest.serialization.Model): + """DailyForecast. + + :param date: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date: str + :param temperature: Temperature values for the day. + :type temperature: ~azure.maps.weather.models.WeatherUnitRange + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherUnitRange + :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.WeatherUnitRange + :param hours_of_sun: Hours of sun. + :type hours_of_sun: float + :param degree_day_summary: Summary of Heating Degree Day or Cooling Degree Day information. + :type degree_day_summary: ~azure.maps.weather.models.DegreeDaySummary + :param air_and_pollen: airAndPollen. + :type air_and_pollen: list[~azure.maps.weather.models.AirAndPollen] + :param day: Day. + :type day: ~azure.maps.weather.models.DayOrNight + :param night: Night. + :type night: ~azure.maps.weather.models.DayOrNight + :param sources: Source(s) of the forecast data. + :type sources: list[str] + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherUnitRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnitRange'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherUnitRange'}, + 'hours_of_sun': {'key': 'hoursOfSun', 'type': 'float'}, + 'degree_day_summary': {'key': 'degreeDaySummary', 'type': 'DegreeDaySummary'}, + 'air_and_pollen': {'key': 'airAndPollen', 'type': '[AirAndPollen]'}, + 'day': {'key': 'day', 'type': 'DayOrNight'}, + 'night': {'key': 'night', 'type': 'DayOrNight'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecast, self).__init__(**kwargs) + self.date = kwargs.get('date', 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.degree_day_summary = kwargs.get('degree_day_summary', None) + self.air_and_pollen = kwargs.get('air_and_pollen', None) + self.day = kwargs.get('day', None) + self.night = kwargs.get('night', None) + self.sources = kwargs.get('sources', None) + + +class DailyForecastResponse(msrest.serialization.Model): + """DailyForecastResponse. + + :param summary: Summary for the main conditions for the requested time period. Notice that + summary can cover only part of the time period. + :type summary: ~azure.maps.weather.models.DailyForecastSummary + :param forecasts: Forecast data for each requested day. + :type forecasts: list[~azure.maps.weather.models.DailyForecast] + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'DailyForecastSummary'}, + 'forecasts': {'key': 'forecasts', 'type': '[DailyForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyForecastResponse, self).__init__(**kwargs) + self.summary = kwargs.get('summary', None) + self.forecasts = kwargs.get('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: str + :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: str + :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': 'str'}, + 'end_date': {'key': 'endDate', 'type': 'str'}, + '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: str + :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: Textual description for ``categoryValue`` corresponding to the level that the + index value falls under, for example "Very Good". + :type category: 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 ascending: Describes the direction of the ``value`` and ``categoryValue``. For example, + when ``ascending``\ =True, the poorest index value is 0 and the best index value is 10. When + ``ascending``\ =True, the poorest index value is 10 and the best index value is 0. + :type 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': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, + 'category': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + '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 = kwargs.get('category', None) + self.category_value = kwargs.get('category_value', None) + self.ascending = kwargs.get('ascending', None) + self.description = kwargs.get('description', None) + + +class DailyIndicesResponse(msrest.serialization.Model): + """This object is returned from a successful Get Daily Indices call. + + :param results: A list of all daily indices for the queried location. + :type results: list[~azure.maps.weather.models.DailyIndex] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[DailyIndex]'}, + } + + def __init__( + self, + **kwargs + ): + super(DailyIndicesResponse, self).__init__(**kwargs) + self.results = kwargs.get('results', None) + + +class DayOrNight(msrest.serialization.Model): + """DayOrNight. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :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 = zero, precipitationType is not present in the response. + :type precipitation_type: str + :param precipitation_intensity: Description of the intensity. + :type precipitation_intensity: str + :param short_phrase: 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_phrase: 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.WeatherUnit + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherUnit + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherUnit + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherUnit + :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_phrase': {'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': 'WeatherUnit'}, + 'rain': {'key': 'rain', 'type': 'WeatherUnit'}, + 'snow': {'key': 'snow', 'type': 'WeatherUnit'}, + 'ice': {'key': 'ice', 'type': 'WeatherUnit'}, + '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(DayOrNight, 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_phrase = kwargs.get('short_phrase', 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 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.WeatherUnit + :param cooling: Number of degrees that the mean temperature is above 65 degrees F/ 18 degree C. + :type cooling: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'heating': {'key': 'heating', 'type': 'WeatherUnit'}, + 'cooling': {'key': 'cooling', 'type': 'WeatherUnit'}, + } + + 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: str + :param minute: The first minute for the interval. + :type minute: int + :param dbz: A unit that represents forecasted precipitation intensity. + :type dbz: float + :param short_phrase: A short phrase describing precipitation condition for the interval. + :type short_phrase: 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. + :type precipitation_type: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'minute': {'key': 'minute', 'type': 'int'}, + 'dbz': {'key': 'dbz', 'type': 'float'}, + 'short_phrase': {'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.dbz = kwargs.get('dbz', None) + self.short_phrase = kwargs.get('short_phrase', 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. + :type hazard_index: int + :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_phrase: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_phrase: str + """ + + _attribute_map = { + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_phrase': {'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_phrase = kwargs.get('short_phrase', None) + + +class HourlyForecast(msrest.serialization.Model): + """HourlyForecast. + + :param date: Date and time of the forecast in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. + :type date: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :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.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :param ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the height of + the base of the lowest clouds. + :type ceiling: ~azure.maps.weather.models.WeatherUnit + :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_phrase: Phrase associated with the ``uvIndex``. + :type uv_index_phrase: 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.WeatherUnit + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherUnit + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherUnit + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherUnit + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + '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': 'WeatherUnit'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnit'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherUnit'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherUnit'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherUnit'}, + 'ceiling': {'key': 'ceiling', 'type': 'WeatherUnit'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_phrase': {'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': 'WeatherUnit'}, + 'rain': {'key': 'rain', 'type': 'WeatherUnit'}, + 'snow': {'key': 'snow', 'type': 'WeatherUnit'}, + 'ice': {'key': 'ice', 'type': 'WeatherUnit'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(HourlyForecast, self).__init__(**kwargs) + self.date = kwargs.get('date', 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.ceiling = kwargs.get('ceiling', None) + self.uv_index = kwargs.get('uv_index', None) + self.uv_index_phrase = kwargs.get('uv_index_phrase', 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. + + :param forecasts: Forecast data for each returned hour. + :type forecasts: list[~azure.maps.weather.models.HourlyForecast] + """ + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[HourlyForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(HourlyForecastResponse, self).__init__(**kwargs) + self.forecasts = kwargs.get('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_phrase: Short summary phrase. Phrase length is approximately 25 characters. + :type short_phrase: str + :param brief_phrase: Brief summary phrase. Phrase length is approximately 60 characters. + :type brief_phrase: 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. + :type icon_code: int + """ + + _attribute_map = { + 'start_minute': {'key': 'startMinute', 'type': 'int'}, + 'end_minute': {'key': 'endMinute', 'type': 'int'}, + 'total_minutes': {'key': 'totalMinutes', 'type': 'int'}, + 'short_phrase': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_phrase': {'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_phrase = kwargs.get('short_phrase', None) + self.brief_phrase = kwargs.get('brief_phrase', 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. + + :param summary: Phrase summaries for the entire forecast period. + :type summary: ~azure.maps.weather.models.MinuteForecastSummary + :param interval_summaries: Summary information for each interval in the forecast. The Summaries + breaks down each potential interval where precipitation starts and stops. + :type interval_summaries: list[~azure.maps.weather.models.IntervalSummary] + :param intervals: Forecast data for each interval in the forecast. + :type intervals: list[~azure.maps.weather.models.ForecastInterval] + """ + + _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 = kwargs.get('summary', None) + self.interval_summaries = kwargs.get('interval_summaries', None) + self.intervals = kwargs.get('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_phrase: Short summary phrase for the next 120 minutes. Phrase length is + approximately 25 characters. + :type short_phrase: str + :param brief_phrase: Summary phrase for the next 120 minutes. Phrase length is approximately 60 + characters. + :type brief_phrase: 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. + :type icon_code: int + """ + + _attribute_map = { + 'brief_phrase60': {'key': 'briefPhrase60', 'type': 'str'}, + 'short_phrase': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_phrase': {'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_phrase = kwargs.get('short_phrase', None) + self.brief_phrase = kwargs.get('brief_phrase', None) + self.long_phrase = kwargs.get('long_phrase', None) + self.icon_code = kwargs.get('icon_code', 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.WeatherUnit + :param past3_hours: The amount of precipitation (liquid equivalent) that has fallen in the past + three hours. + :type past3_hours: ~azure.maps.weather.models.WeatherUnit + :param past6_hours: The amount of precipitation (liquid equivalent) that has fallen in the past + six hours. Contains Metric and Imperial Values. + :type past6_hours: ~azure.maps.weather.models.WeatherUnit + :param past9_hours: The amount of precipitation (liquid equivalent) that has fallen in the past + nine hours. + :type past9_hours: ~azure.maps.weather.models.WeatherUnit + :param past12_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past 12 hours. + :type past12_hours: ~azure.maps.weather.models.WeatherUnit + :param past18_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past 18 hours. + :type past18_hours: ~azure.maps.weather.models.WeatherUnit + :param past24_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past 24 hours. + :type past24_hours: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'past_hour': {'key': 'pastHour', 'type': 'WeatherUnit'}, + 'past3_hours': {'key': 'past3Hours', 'type': 'WeatherUnit'}, + 'past6_hours': {'key': 'past6Hours', 'type': 'WeatherUnit'}, + 'past9_hours': {'key': 'past9Hours', 'type': 'WeatherUnit'}, + 'past12_hours': {'key': 'past12Hours', 'type': 'WeatherUnit'}, + 'past18_hours': {'key': 'past18Hours', 'type': 'WeatherUnit'}, + 'past24_hours': {'key': 'past24Hours', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + **kwargs + ): + super(PrecipitationSummary, self).__init__(**kwargs) + self.past_hour = kwargs.get('past_hour', None) + self.past3_hours = kwargs.get('past3_hours', None) + self.past6_hours = kwargs.get('past6_hours', None) + self.past9_hours = kwargs.get('past9_hours', None) + self.past12_hours = kwargs.get('past12_hours', None) + self.past18_hours = kwargs.get('past18_hours', None) + self.past24_hours = kwargs.get('past24_hours', None) + + +class PressureTendency(msrest.serialization.Model): + """PressureTendency. + + :param localized_description: Description of the pressure tendency in specified language. + :type localized_description: str + :param code: Pressure tendency code regardless of language. One of F=Falling, S=Steady, + R=Rising. + :type code: str + """ + + _attribute_map = { + 'localized_description': {'key': 'localizedDescription', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PressureTendency, self).__init__(**kwargs) + self.localized_description = kwargs.get('localized_description', None) + self.code = kwargs.get('code', None) + + +class QuarterDayForecast(msrest.serialization.Model): + """QuarterDayForecast. + + :param date: Date and time of the forecast in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. + :type date: str + :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: str + :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. + :type icon_code: int + :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.WeatherUnitRange + :param real_feel_temperature: RealFeel™ Temperature values for the quarter. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherUnitRange + :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.WeatherUnit + :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.WeatherUnit + :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 = zero, precipitationType is not present in the response. + :type precipitation_type: str + :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.WeatherUnit + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherUnit + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherUnit + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'str'}, + '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': 'WeatherUnitRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnitRange'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherUnit'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherUnit'}, + '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': 'WeatherUnit'}, + 'rain': {'key': 'rain', 'type': 'WeatherUnit'}, + 'snow': {'key': 'snow', 'type': 'WeatherUnit'}, + 'ice': {'key': 'ice', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + **kwargs + ): + super(QuarterDayForecast, self).__init__(**kwargs) + self.date = kwargs.get('date', 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. + + :param forecasts: Forecast data for each quarter in the response. + :type forecasts: list[~azure.maps.weather.models.QuarterDayForecast] + """ + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[QuarterDayForecast]'}, + } + + def __init__( + self, + **kwargs + ): + super(QuarterDayForecastResponse, self).__init__(**kwargs) + self.forecasts = kwargs.get('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 class_property: Classification of the alert. This field is not available for all + countries and therefore not always returned. + :type class_property: 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_areas: Information about the alert specific to the affected area(s). + :type alert_areas: list[~azure.maps.weather.models.AlertArea] + """ + + _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'}, + 'class_property': {'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_areas': {'key': 'alertAreas', 'type': '[AlertArea]'}, + } + + 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.class_property = kwargs.get('class_property', 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_areas = kwargs.get('alert_areas', None) + + +class SevereWeatherAlertDescription(msrest.serialization.Model): + """Description of a severe weather alert. + + :param localized: 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 localized: str + :param english: Description of the alert in English (en-US). + :type english: str + """ + + _attribute_map = { + 'localized': {'key': 'localized', 'type': 'str'}, + 'english': {'key': 'english', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SevereWeatherAlertDescription, self).__init__(**kwargs) + self.localized = kwargs.get('localized', None) + self.english = kwargs.get('english', None) + + +class SevereWeatherAlertsResponse(msrest.serialization.Model): + """This object is returned from a successful Get Severe Weather Alerts call. + + :param results: A list of all severe weather alerts for the queried location. + :type results: list[~azure.maps.weather.models.SevereWeatherAlert] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[SevereWeatherAlert]'}, + } + + def __init__( + self, + **kwargs + ): + super(SevereWeatherAlertsResponse, self).__init__(**kwargs) + self.results = kwargs.get('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 past6_hours: Summary of temperature fluctuations over the past 6 hours. + :type past6_hours: ~azure.maps.weather.models.TemperatureSummaryPast6Hours + :param past12_hours: Summary of temperature fluctuations over the past 12 hours. + :type past12_hours: ~azure.maps.weather.models.TemperatureSummaryPast12Hours + :param past24_hours: Summary of temperature fluctuations over the past 24 hours. + :type past24_hours: ~azure.maps.weather.models.TemperatureSummaryPast24Hours + """ + + _attribute_map = { + 'past6_hours': {'key': 'past6Hours', 'type': 'TemperatureSummaryPast6Hours'}, + 'past12_hours': {'key': 'past12Hours', 'type': 'TemperatureSummaryPast12Hours'}, + 'past24_hours': {'key': 'past24Hours', 'type': 'TemperatureSummaryPast24Hours'}, + } + + def __init__( + self, + **kwargs + ): + super(TemperatureSummary, self).__init__(**kwargs) + self.past6_hours = kwargs.get('past6_hours', None) + self.past12_hours = kwargs.get('past12_hours', None) + self.past24_hours = kwargs.get('past24_hours', None) + + +class TemperatureSummaryPast12Hours(msrest.serialization.Model): + """Summary of temperature fluctuations over the past 12 hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + **kwargs + ): + super(TemperatureSummaryPast12Hours, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + + +class TemperatureSummaryPast24Hours(msrest.serialization.Model): + """Summary of temperature fluctuations over the past 24 hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + **kwargs + ): + super(TemperatureSummaryPast24Hours, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + + +class TemperatureSummaryPast6Hours(msrest.serialization.Model): + """Summary of temperature fluctuations over the past 6 hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + **kwargs + ): + super(TemperatureSummaryPast6Hours, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', 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. + + :param summary: Short summary of the weather along the route. + :type summary: ~azure.maps.weather.models.WeatherAlongRouteSummary + :param waypoints: Data for each waypoint returned in the same order as specified in the + request. + :type waypoints: list[~azure.maps.weather.models.WeatherWaypoint] + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'WeatherAlongRouteSummary'}, + 'waypoints': {'key': 'waypoints', 'type': '[WeatherWaypoint]'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherAlongRouteResponse, self).__init__(**kwargs) + self.summary = kwargs.get('summary', None) + self.waypoints = kwargs.get('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. + :type icon_code: int + :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. + :type max_hazard_index: int + :param hazard_details: Details of the weather hazards affecting the trip. + :type hazard_details: list[~azure.maps.weather.models.HazardDetail] + """ + + _attribute_map = { + 'max_hazard_index': {'key': 'maxHazardIndex', 'type': 'int'}, + 'hazard_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.hazard_details = kwargs.get('hazard_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. + :type hazard_index: int + :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_phrase: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_phrase: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_phrase': {'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_phrase = kwargs.get('short_phrase', None) + + +class WeatherUnit(msrest.serialization.Model): + """Specific value of a given unit related to weather. + + :param value: Rounded value. + :type value: float + :param unit: Type of unit for the returned 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. + :type unit_type: int + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'float'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'unit_type': {'key': 'unitType', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherUnit, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.unit = kwargs.get('unit', None) + self.unit_type = kwargs.get('unit_type', None) + + +class WeatherUnitRange(msrest.serialization.Model): + """Returned temperature values. + + :param minimum: Minimum temperature for the time period. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: Maximum temperature for the time period. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + **kwargs + ): + super(WeatherUnitRange, self).__init__(**kwargs) + self.minimum = kwargs.get('minimum', None) + self.maximum = kwargs.get('maximum', None) + + +class WeatherWaypoint(msrest.serialization.Model): + """WeatherWaypoint. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :param short_phrase: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_phrase: str + :param is_day_time: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_day_time: 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.WeatherUnit + :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_phrase': {'key': 'shortPhrase', 'type': 'str'}, + 'is_day_time': {'key': 'isDayTime', 'type': 'bool'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherUnit'}, + '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(WeatherWaypoint, self).__init__(**kwargs) + self.icon_code = kwargs.get('icon_code', None) + self.short_phrase = kwargs.get('short_phrase', None) + self.is_day_time = kwargs.get('is_day_time', 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 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 localized_description: Direction abbreviation in the specified language. + :type localized_description: str + """ + + _attribute_map = { + 'degrees': {'key': 'degrees', 'type': 'int'}, + 'localized_description': {'key': 'localizedDescription', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WindDirection, self).__init__(**kwargs) + self.degrees = kwargs.get('degrees', None) + self.localized_description = kwargs.get('localized_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. + :type unit_type: int + """ + + _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..3a0a82fe26d9 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_models_py3.py @@ -0,0 +1,2239 @@ +# 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, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._weather_client_enums import * + + +class AirAndPollen(msrest.serialization.Model): + """AirAndPollen. + + :param name: Name of the pollen or pollutant. For example, grass, mold, weed, air quality, tree + and UV index. + :type name: 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 type: Only exists for air quality. Examples include ozone and particle pollution. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'int'}, + 'category': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[int] = None, + category: Optional[str] = None, + category_value: Optional[int] = None, + type: Optional[str] = None, + **kwargs + ): + super(AirAndPollen, self).__init__(**kwargs) + self.name = name + self.value = value + self.category = category + self.category_value = category_value + self.type = type + + +class AlertArea(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 summary: Text summarizing the alert in the returned area. + :type summary: 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: str + :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: str + :param latest_status: The latest status of the alert in the current area. + :type latest_status: ~azure.maps.weather.models.LatestStatus + :param alert_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 alert_details: str + :param alert_details_language_code: 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 alert_details_language_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'summary': {'key': 'summary', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'end_time': {'key': 'endTime', 'type': 'str'}, + 'latest_status': {'key': 'latestStatus', 'type': 'LatestStatus'}, + 'alert_details': {'key': 'alertDetails', 'type': 'str'}, + 'alert_details_language_code': {'key': 'alertDetailsLanguageCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + summary: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + latest_status: Optional["LatestStatus"] = None, + alert_details: Optional[str] = None, + alert_details_language_code: Optional[str] = None, + **kwargs + ): + super(AlertArea, self).__init__(**kwargs) + self.name = name + self.summary = summary + self.start_time = start_time + self.end_time = end_time + self.latest_status = latest_status + self.alert_details = alert_details + self.alert_details_language_code = alert_details_language_code + + +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: str + :param phrase: Phrase description of the current weather condition. Displayed in specified + language. + :type phrase: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: 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 is_day_time: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_day_time: bool + :param temperature: Temperature being returned. + :type temperature: ~azure.maps.weather.models.WeatherUnit + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :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_phrase: Phrase associated with the ``uvIndex``. + :type uv_index_phrase: 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.WeatherUnit + :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 ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the height of + the base of the lowest clouds. + :type ceiling: ~azure.maps.weather.models.WeatherUnit + :param pressure: Atmospheric pressure in specified unit. + :type pressure: ~azure.maps.weather.models.WeatherUnit + :param pressure_tendency: Atmospheric pressure change. + :type pressure_tendency: ~azure.maps.weather.models.PressureTendency + :param past24_hour_temperature_departure: Departure from the temperature observed 24 hours ago + in specified unit. + :type past24_hour_temperature_departure: ~azure.maps.weather.models.WeatherUnit + :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.WeatherUnit + :param wind_chill_temperature: Perceived air temperature on exposed skin due to wind. + :type wind_chill_temperature: ~azure.maps.weather.models.WeatherUnit + :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.WeatherUnit + :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': 'str'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'icon_code': {'key': 'iconCode', 'type': 'int'}, + 'has_precipitation': {'key': 'hasPrecipitation', 'type': 'bool'}, + 'is_day_time': {'key': 'isDayTime', 'type': 'bool'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherUnit'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnit'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherUnit'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherUnit'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_phrase': {'key': 'uvIndexPhrase', 'type': 'str'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherUnit'}, + 'obstructions_to_visibility': {'key': 'obstructionsToVisibility', 'type': 'str'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'ceiling': {'key': 'ceiling', 'type': 'WeatherUnit'}, + 'pressure': {'key': 'pressure', 'type': 'WeatherUnit'}, + 'pressure_tendency': {'key': 'pressureTendency', 'type': 'PressureTendency'}, + 'past24_hour_temperature_departure': {'key': 'past24HourTemperatureDeparture', 'type': 'WeatherUnit'}, + 'apparent_temperature': {'key': 'apparentTemperature', 'type': 'WeatherUnit'}, + 'wind_chill_temperature': {'key': 'windChillTemperature', 'type': 'WeatherUnit'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherUnit'}, + 'precipitation_summary': {'key': 'precipitationSummary', 'type': 'PrecipitationSummary'}, + 'temperature_summary': {'key': 'temperatureSummary', 'type': 'TemperatureSummary'}, + } + + def __init__( + self, + *, + date_time: Optional[str] = None, + phrase: Optional[str] = None, + icon_code: Optional[int] = None, + has_precipitation: Optional[bool] = None, + is_day_time: Optional[bool] = None, + temperature: Optional["WeatherUnit"] = None, + real_feel_temperature: Optional["WeatherUnit"] = None, + real_feel_temperature_shade: Optional["WeatherUnit"] = None, + relative_humidity: Optional[int] = None, + dew_point: Optional["WeatherUnit"] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + uv_index: Optional[int] = None, + uv_index_phrase: Optional[str] = None, + visibility: Optional["WeatherUnit"] = None, + obstructions_to_visibility: Optional[str] = None, + cloud_cover: Optional[int] = None, + ceiling: Optional["WeatherUnit"] = None, + pressure: Optional["WeatherUnit"] = None, + pressure_tendency: Optional["PressureTendency"] = None, + past24_hour_temperature_departure: Optional["WeatherUnit"] = None, + apparent_temperature: Optional["WeatherUnit"] = None, + wind_chill_temperature: Optional["WeatherUnit"] = None, + wet_bulb_temperature: Optional["WeatherUnit"] = None, + precipitation_summary: Optional["PrecipitationSummary"] = None, + temperature_summary: Optional["TemperatureSummary"] = None, + **kwargs + ): + super(CurrentConditions, self).__init__(**kwargs) + self.date_time = date_time + self.phrase = phrase + self.icon_code = icon_code + self.has_precipitation = has_precipitation + self.is_day_time = is_day_time + 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_phrase = uv_index_phrase + self.visibility = visibility + self.obstructions_to_visibility = obstructions_to_visibility + self.cloud_cover = cloud_cover + self.ceiling = ceiling + self.pressure = pressure + self.pressure_tendency = pressure_tendency + self.past24_hour_temperature_departure = past24_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. + + :param results: Detailed current weather conditions. + :type results: list[~azure.maps.weather.models.CurrentConditions] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[CurrentConditions]'}, + } + + def __init__( + self, + *, + results: Optional[List["CurrentConditions"]] = None, + **kwargs + ): + super(CurrentConditionsResponse, self).__init__(**kwargs) + self.results = results + + +class DailyForecast(msrest.serialization.Model): + """DailyForecast. + + :param date: Date and time of the current observation displayed in ISO 8601 format, for + example, 2019-10-27T19:39:57-08:00. + :type date: str + :param temperature: Temperature values for the day. + :type temperature: ~azure.maps.weather.models.WeatherUnitRange + :param real_feel_temperature: RealFeel™ Temperature being returned. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherUnitRange + :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.WeatherUnitRange + :param hours_of_sun: Hours of sun. + :type hours_of_sun: float + :param degree_day_summary: Summary of Heating Degree Day or Cooling Degree Day information. + :type degree_day_summary: ~azure.maps.weather.models.DegreeDaySummary + :param air_and_pollen: airAndPollen. + :type air_and_pollen: list[~azure.maps.weather.models.AirAndPollen] + :param day: Day. + :type day: ~azure.maps.weather.models.DayOrNight + :param night: Night. + :type night: ~azure.maps.weather.models.DayOrNight + :param sources: Source(s) of the forecast data. + :type sources: list[str] + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherUnitRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnitRange'}, + 'real_feel_temperature_shade': {'key': 'realFeelTemperatureShade', 'type': 'WeatherUnitRange'}, + 'hours_of_sun': {'key': 'hoursOfSun', 'type': 'float'}, + 'degree_day_summary': {'key': 'degreeDaySummary', 'type': 'DegreeDaySummary'}, + 'air_and_pollen': {'key': 'airAndPollen', 'type': '[AirAndPollen]'}, + 'day': {'key': 'day', 'type': 'DayOrNight'}, + 'night': {'key': 'night', 'type': 'DayOrNight'}, + 'sources': {'key': 'sources', 'type': '[str]'}, + } + + def __init__( + self, + *, + date: Optional[str] = None, + temperature: Optional["WeatherUnitRange"] = None, + real_feel_temperature: Optional["WeatherUnitRange"] = None, + real_feel_temperature_shade: Optional["WeatherUnitRange"] = None, + hours_of_sun: Optional[float] = None, + degree_day_summary: Optional["DegreeDaySummary"] = None, + air_and_pollen: Optional[List["AirAndPollen"]] = None, + day: Optional["DayOrNight"] = None, + night: Optional["DayOrNight"] = None, + sources: Optional[List[str]] = None, + **kwargs + ): + super(DailyForecast, self).__init__(**kwargs) + self.date = date + 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.degree_day_summary = degree_day_summary + self.air_and_pollen = air_and_pollen + self.day = day + self.night = night + self.sources = sources + + +class DailyForecastResponse(msrest.serialization.Model): + """DailyForecastResponse. + + :param summary: Summary for the main conditions for the requested time period. Notice that + summary can cover only part of the time period. + :type summary: ~azure.maps.weather.models.DailyForecastSummary + :param forecasts: Forecast data for each requested day. + :type forecasts: list[~azure.maps.weather.models.DailyForecast] + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'DailyForecastSummary'}, + 'forecasts': {'key': 'forecasts', 'type': '[DailyForecast]'}, + } + + def __init__( + self, + *, + summary: Optional["DailyForecastSummary"] = None, + forecasts: Optional[List["DailyForecast"]] = None, + **kwargs + ): + super(DailyForecastResponse, self).__init__(**kwargs) + self.summary = summary + self.forecasts = forecasts + + +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: str + :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: str + :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': 'str'}, + 'end_date': {'key': 'endDate', 'type': 'str'}, + 'severity': {'key': 'severity', 'type': 'int'}, + 'phrase': {'key': 'phrase', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + } + + def __init__( + self, + *, + start_date: Optional[str] = None, + end_date: Optional[str] = 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: str + :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: Textual description for ``categoryValue`` corresponding to the level that the + index value falls under, for example "Very Good". + :type category: 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 ascending: Describes the direction of the ``value`` and ``categoryValue``. For example, + when ``ascending``\ =True, the poorest index value is 0 and the best index value is 10. When + ``ascending``\ =True, the poorest index value is 10 and the best index value is 0. + :type 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': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, + 'category': {'key': 'category', 'type': 'str'}, + 'category_value': {'key': 'categoryValue', 'type': 'int'}, + '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[str] = None, + value: Optional[float] = None, + category: Optional[str] = None, + category_value: Optional[int] = None, + 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 = category + self.category_value = category_value + self.ascending = ascending + self.description = description + + +class DailyIndicesResponse(msrest.serialization.Model): + """This object is returned from a successful Get Daily Indices call. + + :param results: A list of all daily indices for the queried location. + :type results: list[~azure.maps.weather.models.DailyIndex] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[DailyIndex]'}, + } + + def __init__( + self, + *, + results: Optional[List["DailyIndex"]] = None, + **kwargs + ): + super(DailyIndicesResponse, self).__init__(**kwargs) + self.results = results + + +class DayOrNight(msrest.serialization.Model): + """DayOrNight. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :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 = zero, precipitationType is not present in the response. + :type precipitation_type: str + :param precipitation_intensity: Description of the intensity. + :type precipitation_intensity: str + :param short_phrase: 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_phrase: 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.WeatherUnit + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherUnit + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherUnit + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherUnit + :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_phrase': {'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': 'WeatherUnit'}, + 'rain': {'key': 'rain', 'type': 'WeatherUnit'}, + 'snow': {'key': 'snow', 'type': 'WeatherUnit'}, + 'ice': {'key': 'ice', 'type': 'WeatherUnit'}, + '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[int] = None, + icon_phrase: Optional[str] = None, + local_source: Optional["LocalSource"] = None, + has_precipitation: Optional[bool] = None, + precipitation_type: Optional[str] = None, + precipitation_intensity: Optional[str] = None, + short_phrase: 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["WeatherUnit"] = None, + rain: Optional["WeatherUnit"] = None, + snow: Optional["WeatherUnit"] = None, + ice: Optional["WeatherUnit"] = 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(DayOrNight, 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_phrase = short_phrase + 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 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.WeatherUnit + :param cooling: Number of degrees that the mean temperature is above 65 degrees F/ 18 degree C. + :type cooling: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'heating': {'key': 'heating', 'type': 'WeatherUnit'}, + 'cooling': {'key': 'cooling', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + heating: Optional["WeatherUnit"] = None, + cooling: Optional["WeatherUnit"] = 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: str + :param minute: The first minute for the interval. + :type minute: int + :param dbz: A unit that represents forecasted precipitation intensity. + :type dbz: float + :param short_phrase: A short phrase describing precipitation condition for the interval. + :type short_phrase: 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. + :type precipitation_type: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'minute': {'key': 'minute', 'type': 'int'}, + 'dbz': {'key': 'dbz', 'type': 'float'}, + 'short_phrase': {'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[str] = None, + minute: Optional[int] = None, + dbz: Optional[float] = None, + short_phrase: Optional[str] = None, + threshold: Optional[str] = None, + color: Optional["ColorValue"] = None, + simplified_color: Optional["ColorValue"] = None, + precipitation_type: Optional[str] = None, + icon_code: Optional[int] = None, + cloud_cover: Optional[int] = None, + **kwargs + ): + super(ForecastInterval, self).__init__(**kwargs) + self.start_time = start_time + self.minute = minute + self.dbz = dbz + self.short_phrase = short_phrase + 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. + :type hazard_index: int + :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_phrase: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_phrase: str + """ + + _attribute_map = { + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_phrase': {'key': 'shortPhrase', 'type': 'str'}, + } + + def __init__( + self, + *, + hazard_index: Optional[int] = None, + hazard_code: Optional[str] = None, + short_phrase: Optional[str] = None, + **kwargs + ): + super(HazardDetail, self).__init__(**kwargs) + self.hazard_index = hazard_index + self.hazard_code = hazard_code + self.short_phrase = short_phrase + + +class HourlyForecast(msrest.serialization.Model): + """HourlyForecast. + + :param date: Date and time of the forecast in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. + :type date: str + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :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.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :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.WeatherUnit + :param ceiling: Cloud ceiling in specified unit. The ceiling is a measurement of the height of + the base of the lowest clouds. + :type ceiling: ~azure.maps.weather.models.WeatherUnit + :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_phrase: Phrase associated with the ``uvIndex``. + :type uv_index_phrase: 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.WeatherUnit + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherUnit + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherUnit + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherUnit + :param cloud_cover: Percent representing cloud cover. + :type cloud_cover: int + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + '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': 'WeatherUnit'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnit'}, + 'wet_bulb_temperature': {'key': 'wetBulbTemperature', 'type': 'WeatherUnit'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherUnit'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherUnit'}, + 'ceiling': {'key': 'ceiling', 'type': 'WeatherUnit'}, + 'uv_index': {'key': 'uvIndex', 'type': 'int'}, + 'uv_index_phrase': {'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': 'WeatherUnit'}, + 'rain': {'key': 'rain', 'type': 'WeatherUnit'}, + 'snow': {'key': 'snow', 'type': 'WeatherUnit'}, + 'ice': {'key': 'ice', 'type': 'WeatherUnit'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + } + + def __init__( + self, + *, + date: Optional[str] = None, + icon_code: Optional[int] = None, + icon_phrase: Optional[str] = None, + has_precipitation: Optional[bool] = None, + is_daylight: Optional[bool] = None, + temperature: Optional["WeatherUnit"] = None, + real_feel_temperature: Optional["WeatherUnit"] = None, + wet_bulb_temperature: Optional["WeatherUnit"] = None, + dew_point: Optional["WeatherUnit"] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + relative_humidity: Optional[int] = None, + visibility: Optional["WeatherUnit"] = None, + ceiling: Optional["WeatherUnit"] = None, + uv_index: Optional[int] = None, + uv_index_phrase: 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["WeatherUnit"] = None, + rain: Optional["WeatherUnit"] = None, + snow: Optional["WeatherUnit"] = None, + ice: Optional["WeatherUnit"] = None, + cloud_cover: Optional[int] = None, + **kwargs + ): + super(HourlyForecast, self).__init__(**kwargs) + self.date = date + 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.ceiling = ceiling + self.uv_index = uv_index + self.uv_index_phrase = uv_index_phrase + 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. + + :param forecasts: Forecast data for each returned hour. + :type forecasts: list[~azure.maps.weather.models.HourlyForecast] + """ + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[HourlyForecast]'}, + } + + def __init__( + self, + *, + forecasts: Optional[List["HourlyForecast"]] = None, + **kwargs + ): + super(HourlyForecastResponse, self).__init__(**kwargs) + self.forecasts = forecasts + + +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_phrase: Short summary phrase. Phrase length is approximately 25 characters. + :type short_phrase: str + :param brief_phrase: Brief summary phrase. Phrase length is approximately 60 characters. + :type brief_phrase: 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. + :type icon_code: int + """ + + _attribute_map = { + 'start_minute': {'key': 'startMinute', 'type': 'int'}, + 'end_minute': {'key': 'endMinute', 'type': 'int'}, + 'total_minutes': {'key': 'totalMinutes', 'type': 'int'}, + 'short_phrase': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_phrase': {'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_phrase: Optional[str] = None, + brief_phrase: Optional[str] = None, + long_phrase: Optional[str] = None, + icon_code: Optional[int] = None, + **kwargs + ): + super(IntervalSummary, self).__init__(**kwargs) + self.start_minute = start_minute + self.end_minute = end_minute + self.total_minutes = total_minutes + self.short_phrase = short_phrase + self.brief_phrase = brief_phrase + 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. + + :param summary: Phrase summaries for the entire forecast period. + :type summary: ~azure.maps.weather.models.MinuteForecastSummary + :param interval_summaries: Summary information for each interval in the forecast. The Summaries + breaks down each potential interval where precipitation starts and stops. + :type interval_summaries: list[~azure.maps.weather.models.IntervalSummary] + :param intervals: Forecast data for each interval in the forecast. + :type intervals: list[~azure.maps.weather.models.ForecastInterval] + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'MinuteForecastSummary'}, + 'interval_summaries': {'key': 'intervalSummaries', 'type': '[IntervalSummary]'}, + 'intervals': {'key': 'intervals', 'type': '[ForecastInterval]'}, + } + + def __init__( + self, + *, + summary: Optional["MinuteForecastSummary"] = None, + interval_summaries: Optional[List["IntervalSummary"]] = None, + intervals: Optional[List["ForecastInterval"]] = None, + **kwargs + ): + super(MinuteForecastResponse, self).__init__(**kwargs) + self.summary = summary + self.interval_summaries = interval_summaries + self.intervals = intervals + + +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_phrase: Short summary phrase for the next 120 minutes. Phrase length is + approximately 25 characters. + :type short_phrase: str + :param brief_phrase: Summary phrase for the next 120 minutes. Phrase length is approximately 60 + characters. + :type brief_phrase: 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. + :type icon_code: int + """ + + _attribute_map = { + 'brief_phrase60': {'key': 'briefPhrase60', 'type': 'str'}, + 'short_phrase': {'key': 'shortPhrase', 'type': 'str'}, + 'brief_phrase': {'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_phrase: Optional[str] = None, + brief_phrase: Optional[str] = None, + long_phrase: Optional[str] = None, + icon_code: Optional[int] = None, + **kwargs + ): + super(MinuteForecastSummary, self).__init__(**kwargs) + self.brief_phrase60 = brief_phrase60 + self.short_phrase = short_phrase + self.brief_phrase = brief_phrase + self.long_phrase = long_phrase + self.icon_code = icon_code + + +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.WeatherUnit + :param past3_hours: The amount of precipitation (liquid equivalent) that has fallen in the past + three hours. + :type past3_hours: ~azure.maps.weather.models.WeatherUnit + :param past6_hours: The amount of precipitation (liquid equivalent) that has fallen in the past + six hours. Contains Metric and Imperial Values. + :type past6_hours: ~azure.maps.weather.models.WeatherUnit + :param past9_hours: The amount of precipitation (liquid equivalent) that has fallen in the past + nine hours. + :type past9_hours: ~azure.maps.weather.models.WeatherUnit + :param past12_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past 12 hours. + :type past12_hours: ~azure.maps.weather.models.WeatherUnit + :param past18_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past 18 hours. + :type past18_hours: ~azure.maps.weather.models.WeatherUnit + :param past24_hours: The amount of precipitation (liquid equivalent) that has fallen in the + past 24 hours. + :type past24_hours: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'past_hour': {'key': 'pastHour', 'type': 'WeatherUnit'}, + 'past3_hours': {'key': 'past3Hours', 'type': 'WeatherUnit'}, + 'past6_hours': {'key': 'past6Hours', 'type': 'WeatherUnit'}, + 'past9_hours': {'key': 'past9Hours', 'type': 'WeatherUnit'}, + 'past12_hours': {'key': 'past12Hours', 'type': 'WeatherUnit'}, + 'past18_hours': {'key': 'past18Hours', 'type': 'WeatherUnit'}, + 'past24_hours': {'key': 'past24Hours', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + past_hour: Optional["WeatherUnit"] = None, + past3_hours: Optional["WeatherUnit"] = None, + past6_hours: Optional["WeatherUnit"] = None, + past9_hours: Optional["WeatherUnit"] = None, + past12_hours: Optional["WeatherUnit"] = None, + past18_hours: Optional["WeatherUnit"] = None, + past24_hours: Optional["WeatherUnit"] = None, + **kwargs + ): + super(PrecipitationSummary, self).__init__(**kwargs) + self.past_hour = past_hour + self.past3_hours = past3_hours + self.past6_hours = past6_hours + self.past9_hours = past9_hours + self.past12_hours = past12_hours + self.past18_hours = past18_hours + self.past24_hours = past24_hours + + +class PressureTendency(msrest.serialization.Model): + """PressureTendency. + + :param localized_description: Description of the pressure tendency in specified language. + :type localized_description: str + :param code: Pressure tendency code regardless of language. One of F=Falling, S=Steady, + R=Rising. + :type code: str + """ + + _attribute_map = { + 'localized_description': {'key': 'localizedDescription', 'type': 'str'}, + 'code': {'key': 'code', 'type': 'str'}, + } + + def __init__( + self, + *, + localized_description: Optional[str] = None, + code: Optional[str] = None, + **kwargs + ): + super(PressureTendency, self).__init__(**kwargs) + self.localized_description = localized_description + self.code = code + + +class QuarterDayForecast(msrest.serialization.Model): + """QuarterDayForecast. + + :param date: Date and time of the forecast in ISO 8601 format, for example, + 2019-10-27T19:39:57-08:00. + :type date: str + :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: str + :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. + :type icon_code: int + :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.WeatherUnitRange + :param real_feel_temperature: RealFeel™ Temperature values for the quarter. + :type real_feel_temperature: ~azure.maps.weather.models.WeatherUnitRange + :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.WeatherUnit + :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.WeatherUnit + :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 = zero, precipitationType is not present in the response. + :type precipitation_type: str + :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.WeatherUnit + :param rain: Rain. + :type rain: ~azure.maps.weather.models.WeatherUnit + :param snow: Snow. + :type snow: ~azure.maps.weather.models.WeatherUnit + :param ice: Ice. + :type ice: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'date': {'key': 'date', 'type': 'str'}, + 'effective_date': {'key': 'effectiveDate', 'type': 'str'}, + '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': 'WeatherUnitRange'}, + 'real_feel_temperature': {'key': 'realFeelTemperature', 'type': 'WeatherUnitRange'}, + 'dew_point': {'key': 'dewPoint', 'type': 'WeatherUnit'}, + 'relative_humidity': {'key': 'relativeHumidity', 'type': 'int'}, + 'wind': {'key': 'wind', 'type': 'WindDetails'}, + 'wind_gust': {'key': 'windGust', 'type': 'WindDetails'}, + 'visibility': {'key': 'visibility', 'type': 'WeatherUnit'}, + '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': 'WeatherUnit'}, + 'rain': {'key': 'rain', 'type': 'WeatherUnit'}, + 'snow': {'key': 'snow', 'type': 'WeatherUnit'}, + 'ice': {'key': 'ice', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + date: Optional[str] = None, + effective_date: Optional[str] = None, + quarter: Optional[Union[int, "DayQuarter"]] = None, + icon_code: Optional[int] = None, + icon_phrase: Optional[str] = None, + phrase: Optional[str] = None, + temperature: Optional["WeatherUnitRange"] = None, + real_feel_temperature: Optional["WeatherUnitRange"] = None, + dew_point: Optional["WeatherUnit"] = None, + relative_humidity: Optional[int] = None, + wind: Optional["WindDetails"] = None, + wind_gust: Optional["WindDetails"] = None, + visibility: Optional["WeatherUnit"] = None, + cloud_cover: Optional[int] = None, + has_precipitation: Optional[bool] = None, + precipitation_type: Optional[str] = None, + precipitation_intensity: Optional[str] = None, + precipitation_probability: Optional[int] = None, + thunderstorm_probability: Optional[int] = None, + total_liquid: Optional["WeatherUnit"] = None, + rain: Optional["WeatherUnit"] = None, + snow: Optional["WeatherUnit"] = None, + ice: Optional["WeatherUnit"] = None, + **kwargs + ): + super(QuarterDayForecast, self).__init__(**kwargs) + self.date = date + 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. + + :param forecasts: Forecast data for each quarter in the response. + :type forecasts: list[~azure.maps.weather.models.QuarterDayForecast] + """ + + _attribute_map = { + 'forecasts': {'key': 'forecasts', 'type': '[QuarterDayForecast]'}, + } + + def __init__( + self, + *, + forecasts: Optional[List["QuarterDayForecast"]] = None, + **kwargs + ): + super(QuarterDayForecastResponse, self).__init__(**kwargs) + self.forecasts = forecasts + + +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 class_property: Classification of the alert. This field is not available for all + countries and therefore not always returned. + :type class_property: 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_areas: Information about the alert specific to the affected area(s). + :type alert_areas: list[~azure.maps.weather.models.AlertArea] + """ + + _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'}, + 'class_property': {'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_areas': {'key': 'alertAreas', 'type': '[AlertArea]'}, + } + + 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, + class_property: Optional[str] = None, + level: Optional[str] = None, + source: Optional[str] = None, + source_id: Optional[int] = None, + disclaimer: Optional[str] = None, + alert_areas: Optional[List["AlertArea"]] = 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.class_property = class_property + self.level = level + self.source = source + self.source_id = source_id + self.disclaimer = disclaimer + self.alert_areas = alert_areas + + +class SevereWeatherAlertDescription(msrest.serialization.Model): + """Description of a severe weather alert. + + :param localized: 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 localized: str + :param english: Description of the alert in English (en-US). + :type english: str + """ + + _attribute_map = { + 'localized': {'key': 'localized', 'type': 'str'}, + 'english': {'key': 'english', 'type': 'str'}, + } + + def __init__( + self, + *, + localized: Optional[str] = None, + english: Optional[str] = None, + **kwargs + ): + super(SevereWeatherAlertDescription, self).__init__(**kwargs) + self.localized = localized + self.english = english + + +class SevereWeatherAlertsResponse(msrest.serialization.Model): + """This object is returned from a successful Get Severe Weather Alerts call. + + :param results: A list of all severe weather alerts for the queried location. + :type results: list[~azure.maps.weather.models.SevereWeatherAlert] + """ + + _attribute_map = { + 'results': {'key': 'results', 'type': '[SevereWeatherAlert]'}, + } + + def __init__( + self, + *, + results: Optional[List["SevereWeatherAlert"]] = None, + **kwargs + ): + super(SevereWeatherAlertsResponse, self).__init__(**kwargs) + self.results = results + + +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 past6_hours: Summary of temperature fluctuations over the past 6 hours. + :type past6_hours: ~azure.maps.weather.models.TemperatureSummaryPast6Hours + :param past12_hours: Summary of temperature fluctuations over the past 12 hours. + :type past12_hours: ~azure.maps.weather.models.TemperatureSummaryPast12Hours + :param past24_hours: Summary of temperature fluctuations over the past 24 hours. + :type past24_hours: ~azure.maps.weather.models.TemperatureSummaryPast24Hours + """ + + _attribute_map = { + 'past6_hours': {'key': 'past6Hours', 'type': 'TemperatureSummaryPast6Hours'}, + 'past12_hours': {'key': 'past12Hours', 'type': 'TemperatureSummaryPast12Hours'}, + 'past24_hours': {'key': 'past24Hours', 'type': 'TemperatureSummaryPast24Hours'}, + } + + def __init__( + self, + *, + past6_hours: Optional["TemperatureSummaryPast6Hours"] = None, + past12_hours: Optional["TemperatureSummaryPast12Hours"] = None, + past24_hours: Optional["TemperatureSummaryPast24Hours"] = None, + **kwargs + ): + super(TemperatureSummary, self).__init__(**kwargs) + self.past6_hours = past6_hours + self.past12_hours = past12_hours + self.past24_hours = past24_hours + + +class TemperatureSummaryPast12Hours(msrest.serialization.Model): + """Summary of temperature fluctuations over the past 12 hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + minimum: Optional["WeatherUnit"] = None, + maximum: Optional["WeatherUnit"] = None, + **kwargs + ): + super(TemperatureSummaryPast12Hours, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + + +class TemperatureSummaryPast24Hours(msrest.serialization.Model): + """Summary of temperature fluctuations over the past 24 hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + minimum: Optional["WeatherUnit"] = None, + maximum: Optional["WeatherUnit"] = None, + **kwargs + ): + super(TemperatureSummaryPast24Hours, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + + +class TemperatureSummaryPast6Hours(msrest.serialization.Model): + """Summary of temperature fluctuations over the past 6 hours. + + :param minimum: minimum. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: maximum. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + minimum: Optional["WeatherUnit"] = None, + maximum: Optional["WeatherUnit"] = None, + **kwargs + ): + super(TemperatureSummaryPast6Hours, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + + +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. + + :param summary: Short summary of the weather along the route. + :type summary: ~azure.maps.weather.models.WeatherAlongRouteSummary + :param waypoints: Data for each waypoint returned in the same order as specified in the + request. + :type waypoints: list[~azure.maps.weather.models.WeatherWaypoint] + """ + + _attribute_map = { + 'summary': {'key': 'summary', 'type': 'WeatherAlongRouteSummary'}, + 'waypoints': {'key': 'waypoints', 'type': '[WeatherWaypoint]'}, + } + + def __init__( + self, + *, + summary: Optional["WeatherAlongRouteSummary"] = None, + waypoints: Optional[List["WeatherWaypoint"]] = None, + **kwargs + ): + super(WeatherAlongRouteResponse, self).__init__(**kwargs) + self.summary = summary + self.waypoints = waypoints + + +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. + :type icon_code: int + :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[int] = 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. + :type max_hazard_index: int + :param hazard_details: Details of the weather hazards affecting the trip. + :type hazard_details: list[~azure.maps.weather.models.HazardDetail] + """ + + _attribute_map = { + 'max_hazard_index': {'key': 'maxHazardIndex', 'type': 'int'}, + 'hazard_details': {'key': 'hazardDetails', 'type': '[HazardDetail]'}, + } + + def __init__( + self, + *, + max_hazard_index: Optional[int] = None, + hazard_details: Optional[List["HazardDetail"]] = None, + **kwargs + ): + super(WeatherHazards, self).__init__(**kwargs) + self.max_hazard_index = max_hazard_index + self.hazard_details = hazard_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. + :type hazard_index: int + :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_phrase: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_phrase: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'hazard_index': {'key': 'hazardIndex', 'type': 'int'}, + 'hazard_code': {'key': 'hazardCode', 'type': 'str'}, + 'short_phrase': {'key': 'shortPhrase', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + hazard_index: Optional[int] = None, + hazard_code: Optional[str] = None, + short_phrase: Optional[str] = None, + **kwargs + ): + super(WeatherNotification, self).__init__(**kwargs) + self.type = type + self.hazard_index = hazard_index + self.hazard_code = hazard_code + self.short_phrase = short_phrase + + +class WeatherUnit(msrest.serialization.Model): + """Specific value of a given unit related to weather. + + :param value: Rounded value. + :type value: float + :param unit: Type of unit for the returned 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. + :type unit_type: int + """ + + _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[int] = None, + **kwargs + ): + super(WeatherUnit, self).__init__(**kwargs) + self.value = value + self.unit = unit + self.unit_type = unit_type + + +class WeatherUnitRange(msrest.serialization.Model): + """Returned temperature values. + + :param minimum: Minimum temperature for the time period. + :type minimum: ~azure.maps.weather.models.WeatherUnit + :param maximum: Maximum temperature for the time period. + :type maximum: ~azure.maps.weather.models.WeatherUnit + """ + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'WeatherUnit'}, + 'maximum': {'key': 'maximum', 'type': 'WeatherUnit'}, + } + + def __init__( + self, + *, + minimum: Optional["WeatherUnit"] = None, + maximum: Optional["WeatherUnit"] = None, + **kwargs + ): + super(WeatherUnitRange, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + + +class WeatherWaypoint(msrest.serialization.Model): + """WeatherWaypoint. + + :param icon_code: Numeric value representing an image that displays the ``iconPhrase``. Please + refer to `Weather Service Concepts `_ for details. + :type icon_code: int + :param short_phrase: A displayable short phrase describing the forecasted conditions and + precipitation intensity/type. + :type short_phrase: str + :param is_day_time: Indicates the time of the day. True indicates 'day',', false indicates + 'night. + :type is_day_time: 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.WeatherUnit + :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_phrase': {'key': 'shortPhrase', 'type': 'str'}, + 'is_day_time': {'key': 'isDayTime', 'type': 'bool'}, + 'cloud_cover': {'key': 'cloudCover', 'type': 'int'}, + 'temperature': {'key': 'temperature', 'type': 'WeatherUnit'}, + '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[int] = None, + short_phrase: Optional[str] = None, + is_day_time: Optional[bool] = None, + cloud_cover: Optional[int] = None, + temperature: Optional["WeatherUnit"] = 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(WeatherWaypoint, self).__init__(**kwargs) + self.icon_code = icon_code + self.short_phrase = short_phrase + self.is_day_time = is_day_time + 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 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 localized_description: Direction abbreviation in the specified language. + :type localized_description: str + """ + + _attribute_map = { + 'degrees': {'key': 'degrees', 'type': 'int'}, + 'localized_description': {'key': 'localizedDescription', 'type': 'str'}, + } + + def __init__( + self, + *, + degrees: Optional[int] = None, + localized_description: Optional[str] = None, + **kwargs + ): + super(WindDirection, self).__init__(**kwargs) + self.degrees = degrees + self.localized_description = localized_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. + :type unit_type: int + """ + + _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[int] = 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..2800ea303b60 --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/models/_weather_client_enums.py @@ -0,0 +1,91 @@ +# 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. + ZERO = 0 + #: 1:00 pm - 7:00 pm/ 13:00- 19:00. + ONE = 1 + #: 7:00 pm - 1:00 am/ 19:00 - 01:00. + TWO = 2 + #: 1:00 am - 7:00 am/ 01:00 - 07:00. + THREE = 3 + +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 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 + #: ``alertAreas``\ , ``startTime``\ , ``endTime``\ , or ``class``. + CONTINUE_ENUM = "Continue" + #: "Update" - the alert has been updated since its initial issuance. + UPDATE = "Update" + +class ResponseFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + #: `The JavaScript Object Notation Data Interchange Format + #: `_. + JSON = "json" + +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..5e626ffd970f --- /dev/null +++ b/sdk/maps/azure-maps-weather/azure/maps/weather/operations/_weather_operations.py @@ -0,0 +1,881 @@ +# 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 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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which hourly forecast information is requested. + The applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which minute forecast information is requested. + The applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which quarter-day forecast information is + requested. The applicable query is specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which current conditions information is + requested. The applicable query is specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which current conditions information is + requested. The applicable query is specified as a comma separated string composed by latitude + followed by longitude e.g. "47.641268,-122.125679". + :type query: str + :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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :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 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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which severe weather alerts are requested. The + applicable query is specified as a comma separated string composed by latitude followed by + longitude e.g. "47.641268,-122.125679". + :type query: 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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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, + format, # type: Union[str, "_models.ResponseFormat"] + query, # type: str + 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 format: Desired format of the response. Only ``json`` format is supported. + :type format: str or ~azure.maps.weather.models.ResponseFormat + :param query: Coordinates of the location for which daily indices are requested. The applicable + query is specified as a comma separated string composed by latitude followed by longitude e.g. + "47.641268,-122.125679". + :type query: 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. Default value is en-us. + + 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 = { + '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') + 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.x_ms_client_id is not None: + header_parameters['x-ms-client-id'] = self._serialize.header("self._config.x_ms_client_id", self._config.x_ms_client_id, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('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..b1d4b8d376f2 --- /dev/null +++ b/sdk/maps/azure-maps-weather/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-maps-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.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.maps', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-maps-nspkg'], + } +)