Skip to content

Commit

Permalink
CodeGen from PR 19044 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Introduce changes to elevation.json to fix bug on x-ms-skip-url-encoding (Azure#19044)
  • Loading branch information
SDKAuto committed May 17, 2022
1 parent f222839 commit 85bfc63
Show file tree
Hide file tree
Showing 21 changed files with 1,971 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sdk/maps/azure-maps-elevation/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.7.2",
"use": [
"@autorest/python@5.16.0",
"@autorest/modelerfour@4.19.3"
],
"commit": "b57f77a456c355c535e0f0c01a37b3b826e71125",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/maps/data-plane/DEM/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2 --version-tolerant",
"readme": "specification/maps/data-plane/DEM/readme.md"
}
1 change: 1 addition & 0 deletions sdk/maps/azure-maps-elevation/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
1 change: 1 addition & 0 deletions sdk/maps/azure-maps-elevation/azure/maps/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
23 changes: 23 additions & 0 deletions sdk/maps/azure-maps-elevation/azure/maps/elevation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import ElevationClient
from ._version import VERSION

__version__ = VERSION

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['ElevationClient']
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
109 changes: 109 additions & 0 deletions sdk/maps/azure-maps-elevation/azure/maps/elevation/_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from copy import deepcopy
from typing import Any, Optional, TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.core import PipelineClient
from azure.core.rest import HttpRequest, HttpResponse

from ._configuration import ElevationClientConfiguration
from .operations import ElevationOperations

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Dict

from azure.core.credentials import TokenCredential

class ElevationClient:
"""The Azure Maps Elevation API provides an HTTP interface to query elevation data on the surface
of the Earth. Elevation data can be retrieved at specific locations by sending lat/lon
coordinates, by defining an ordered set of vertices that form a Polyline and a number of
sample points along the length of a Polyline, or by defining a bounding box that consists of
equally spaced vertices as rows and columns. The vertical datum is EPSG:3855. This datum uses
the EGM2008 geoid model applied to the WGS84 ellipsoid as its zero height reference surface.
The vertical unit is measured in meters, the spatial resolution of the elevation data is 0.8
arc-second for global coverage (~24 meters).
:ivar elevation: ElevationOperations operations
:vartype elevation: azure.maps.elevation.operations.ElevationOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param client_id: Specifies which account is intended for usage in conjunction with the Azure
AD security model. It represents a unique ID for the Azure Maps account and can be retrieved
from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see
the following `articles <https://aka.ms/amauthdetails>`_ for guidance. Default value is None.
:type client_id: str
:keyword endpoint: Service URL. Default value is "https://atlas.microsoft.com".
:paramtype endpoint: str
:keyword api_version: Api Version. Default value is "1.0". Note that overriding this default
value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
client_id: Optional[str] = None,
*,
endpoint: str = "https://atlas.microsoft.com",
**kwargs: Any
) -> None:

self._config = ElevationClientConfiguration(credential=credential, client_id=client_id, **kwargs)
self._client = PipelineClient(base_url=endpoint, config=self._config, **kwargs)

self._serialize = Serializer()
self._deserialize = Deserializer()
self._serialize.client_side_validation = False
self.elevation = ElevationOperations(
self._client, self._config, self._serialize, self._deserialize
)


def send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

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)
Original file line number Diff line number Diff line change
@@ -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 Any, Optional, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class ElevationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for ElevationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param client_id: Specifies which account is intended for usage in conjunction with the Azure
AD security model. It represents a unique ID for the Azure Maps account and can be retrieved
from the Azure Maps management plane Account API. To use Azure AD security in Azure Maps see
the following `articles <https://aka.ms/amauthdetails>`_ for guidance. Default value is None.
:type client_id: str
:keyword api_version: Api Version. Default value is "1.0". Note that overriding this default
value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self,
credential: "TokenCredential",
client_id: Optional[str] = None,
**kwargs: Any
) -> None:
super(ElevationClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop('api_version', "1.0") # type: str

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")

self.credential = credential
self.client_id = client_id
self.api_version = api_version
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)
19 changes: 19 additions & 0 deletions sdk/maps/azure-maps-elevation/azure/maps/elevation/_patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level

def patch_sdk():
"""Do not remove from this file.
`patch_sdk` is a last resort escape hatch that allows you to do customizations
you can't accomplish using the techniques described in
https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
21 changes: 21 additions & 0 deletions sdk/maps/azure-maps-elevation/azure/maps/elevation/_vendor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------




def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
formatted_components = template.split("/")
components = [
c for c in formatted_components if "{}".format(key.args[0]) not in c
]
template = "/".join(components)
Original file line number Diff line number Diff line change
@@ -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"
20 changes: 20 additions & 0 deletions sdk/maps/azure-maps-elevation/azure/maps/elevation/aio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._client import ElevationClient

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk
__all__ = ['ElevationClient']
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Loading

0 comments on commit 85bfc63

Please sign in to comment.