Skip to content

Commit a8977f2

Browse files
committed
init
1 parent 64ba554 commit a8977f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+12759
-0
lines changed
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 0.1.0 (Unreleased)
4+
5+
* Initial Release

sdk/maps/azure-maps-route/MANIFEST.in

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
recursive-include tests *.py *.yaml
2+
recursive-include samples *.py *.md
3+
include *.md
4+
include LICENSE
5+
include azure/__init__.py
6+
include azure/maps/__init__.py
7+
include azure/maps/route/py.typed

sdk/maps/azure-maps-route/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Microsoft Azure SDK for Python
2+
3+
This is the Microsoft Azure MyService Management Client Library.
4+
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
5+
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
6+
7+
8+
# Usage
9+
10+
11+
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
12+
13+
14+
15+
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
16+
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.
17+
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
18+
19+
20+
# Provide Feedback
21+
22+
If you encounter any bugs or have suggestions, please file an issue in the
23+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
24+
section of the project.
25+
26+
27+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-maps-route%2FREADME.png)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._version import VERSION
10+
from ._route_client import RouteClient
11+
12+
__all__ = [
13+
'RouteClient'
14+
]
15+
__version__ = VERSION
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
6+
from typing import Union, TYPE_CHECKING
7+
from azure.core.pipeline.policies import AzureKeyCredentialPolicy
8+
from azure.core.credentials import AzureKeyCredential
9+
from ._generated import RouteClient as _RouteClient
10+
from ._version import VERSION
11+
if TYPE_CHECKING:
12+
from azure.core.credentials import TokenCredential
13+
14+
# To check the credential is either AzureKeyCredential or TokenCredential
15+
def _authentication_policy(credential):
16+
authentication_policy = None
17+
if credential is None:
18+
raise ValueError("Parameter 'credential' must not be None.")
19+
if isinstance(credential, AzureKeyCredential):
20+
authentication_policy = AzureKeyCredentialPolicy(
21+
name="subscription-key", credential=credential
22+
)
23+
elif credential is not None and not hasattr(credential, "get_token"):
24+
raise TypeError(
25+
"Unsupported credential: {}. Use an instance of AzureKeyCredential "
26+
"or a token credential from azure.identity".format(type(credential))
27+
)
28+
return authentication_policy
29+
30+
class RouteClientBase:
31+
def __init__(
32+
self,
33+
credential, #type: Union[AzureKeyCredential, TokenCredential]
34+
**kwargs #type Any
35+
):
36+
# type: (...) -> None
37+
38+
self._route_client = _RouteClient(
39+
credential=credential, # type: ignore
40+
api_version=kwargs.pop("api_version", VERSION),
41+
authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)),
42+
**kwargs
43+
).route
44+
45+
def __enter__(self):
46+
self._route_client.__enter__() # pylint:disable=no-member
47+
return self
48+
49+
def __exit__(self, *args):
50+
self._route_client.__exit__(*args) # pylint:disable=no-member

sdk/maps/azure-maps-route/azure/maps/route/_common/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._route_client import RouteClient
10+
from ._version import VERSION
11+
12+
__version__ = VERSION
13+
__all__ = ['RouteClient']
14+
15+
try:
16+
from ._patch import patch_sdk # type: ignore
17+
patch_sdk()
18+
except ImportError:
19+
pass
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from typing import TYPE_CHECKING
10+
11+
from azure.core.configuration import Configuration
12+
from azure.core.pipeline import policies
13+
14+
from ._version import VERSION
15+
16+
if TYPE_CHECKING:
17+
# pylint: disable=unused-import,ungrouped-imports
18+
from typing import Any, Optional, Union
19+
20+
from azure.core.credentials import TokenCredential
21+
22+
23+
class RouteClientConfiguration(Configuration):
24+
"""Configuration for RouteClient.
25+
26+
Note that all parameters used to create this instance are saved as instance
27+
attributes.
28+
29+
:param credential: Credential needed for the client to connect to Azure.
30+
:type credential: ~azure.core.credentials.TokenCredential
31+
: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 <https://aka.ms/amauthdetails>`_ for guidance.
32+
:type x_ms_client_id: str
33+
:param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.
34+
:type geography: str or ~azure.maps.route.models.Geography
35+
"""
36+
37+
def __init__(
38+
self,
39+
credential, # type: "TokenCredential"
40+
x_ms_client_id=None, # type: Optional[str]
41+
geography="us", # type: Union[str, "_models.Geography"]
42+
**kwargs # type: Any
43+
):
44+
# type: (...) -> None
45+
if credential is None:
46+
raise ValueError("Parameter 'credential' must not be None.")
47+
if geography is None:
48+
raise ValueError("Parameter 'geography' must not be None.")
49+
super(RouteClientConfiguration, self).__init__(**kwargs)
50+
51+
self.credential = credential
52+
self.x_ms_client_id = x_ms_client_id
53+
self.geography = geography
54+
self.api_version = "1.0"
55+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://atlas.microsoft.com/.default'])
56+
kwargs.setdefault('sdk_moniker', 'maps-route/{}'.format(VERSION))
57+
self._configure(**kwargs)
58+
59+
def _configure(
60+
self,
61+
**kwargs # type: Any
62+
):
63+
# type: (...) -> None
64+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
65+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
66+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
67+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
68+
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
69+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
70+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
71+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
72+
self.authentication_policy = kwargs.get('authentication_policy')
73+
if self.credential and not self.authentication_policy:
74+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"chosen_version": "1.0",
3+
"total_api_version_list": ["1.0"],
4+
"client": {
5+
"name": "RouteClient",
6+
"filename": "_route_client",
7+
"description": "Azure Maps Route REST APIs.",
8+
"base_url": null,
9+
"custom_base_url": "\u0027https://{geography}.atlas.microsoft.com\u0027",
10+
"azure_arm": false,
11+
"has_lro_operations": true,
12+
"client_side_validation": false,
13+
"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\"]}}}",
14+
"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\"]}}}"
15+
},
16+
"global_parameters": {
17+
"sync": {
18+
"credential": {
19+
"signature": "credential, # type: \"TokenCredential\"",
20+
"description": "Credential needed for the client to connect to Azure.",
21+
"docstring_type": "~azure.core.credentials.TokenCredential",
22+
"required": true
23+
},
24+
"x_ms_client_id": {
25+
"signature": "x_ms_client_id=None, # type: Optional[str]",
26+
"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.",
27+
"docstring_type": "str",
28+
"required": false
29+
},
30+
"geography": {
31+
"signature": "geography=\"us\", # type: Union[str, \"_models.Geography\"]",
32+
"description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.",
33+
"docstring_type": "str or ~azure.maps.route.models.Geography",
34+
"required": true
35+
}
36+
},
37+
"async": {
38+
"credential": {
39+
"signature": "credential: \"AsyncTokenCredential\",",
40+
"description": "Credential needed for the client to connect to Azure.",
41+
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
42+
"required": true
43+
},
44+
"x_ms_client_id": {
45+
"signature": "x_ms_client_id: Optional[str] = None,",
46+
"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.",
47+
"docstring_type": "str",
48+
"required": false
49+
},
50+
"geography": {
51+
"signature": "geography: Union[str, \"_models.Geography\"] = \"us\",",
52+
"description": "This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu.",
53+
"docstring_type": "str or ~azure.maps.route.models.Geography",
54+
"required": true
55+
}
56+
},
57+
"constant": {
58+
},
59+
"call": "credential, x_ms_client_id, geography",
60+
"service_client_specific": {
61+
"sync": {
62+
"api_version": {
63+
"signature": "api_version=None, # type: Optional[str]",
64+
"description": "API version to use if no profile is provided, or if missing in profile.",
65+
"docstring_type": "str",
66+
"required": false
67+
},
68+
"profile": {
69+
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
70+
"description": "A profile definition, from KnownProfiles to dict.",
71+
"docstring_type": "azure.profiles.KnownProfiles",
72+
"required": false
73+
}
74+
},
75+
"async": {
76+
"api_version": {
77+
"signature": "api_version: Optional[str] = None,",
78+
"description": "API version to use if no profile is provided, or if missing in profile.",
79+
"docstring_type": "str",
80+
"required": false
81+
},
82+
"profile": {
83+
"signature": "profile: KnownProfiles = KnownProfiles.default,",
84+
"description": "A profile definition, from KnownProfiles to dict.",
85+
"docstring_type": "azure.profiles.KnownProfiles",
86+
"required": false
87+
}
88+
}
89+
}
90+
},
91+
"config": {
92+
"credential": true,
93+
"credential_scopes": ["https://atlas.microsoft.com/.default"],
94+
"credential_default_policy_type": "BearerTokenCredentialPolicy",
95+
"credential_default_policy_type_has_async_version": true,
96+
"credential_key_header_name": null,
97+
"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\"]}}}",
98+
"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\"]}}}"
99+
},
100+
"operation_groups": {
101+
"route": "RouteOperations"
102+
}
103+
}

0 commit comments

Comments
 (0)