|
| 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 import PipelineClient |
| 12 | +from msrest import Deserializer, Serializer |
| 13 | + |
| 14 | +if TYPE_CHECKING: |
| 15 | + # pylint: disable=unused-import,ungrouped-imports |
| 16 | + from typing import Any, Optional, Union |
| 17 | + |
| 18 | + from azure.core.credentials import TokenCredential |
| 19 | + from azure.core.pipeline.transport import HttpRequest, HttpResponse |
| 20 | + |
| 21 | +from ._configuration import CreatorClientConfiguration |
| 22 | +from .operations import AliasOperations |
| 23 | +from .operations import DataOperations |
| 24 | +from .operations import DatasetOperations |
| 25 | +from .operations import ConversionOperations |
| 26 | +from .operations import FeatureStateOperations |
| 27 | +from .operations import SpatialOperations |
| 28 | +from .operations import TilesetOperations |
| 29 | +from .operations import WFSOperations |
| 30 | +from . import models |
| 31 | + |
| 32 | + |
| 33 | +class CreatorClient(object): |
| 34 | + """APIs for managing aliases in Azure Maps. |
| 35 | +
|
| 36 | + :ivar alias: AliasOperations operations |
| 37 | + :vartype alias: azure.maps.creator.operations.AliasOperations |
| 38 | + :ivar data: DataOperations operations |
| 39 | + :vartype data: azure.maps.creator.operations.DataOperations |
| 40 | + :ivar dataset: DatasetOperations operations |
| 41 | + :vartype dataset: azure.maps.creator.operations.DatasetOperations |
| 42 | + :ivar conversion: ConversionOperations operations |
| 43 | + :vartype conversion: azure.maps.creator.operations.ConversionOperations |
| 44 | + :ivar feature_state: FeatureStateOperations operations |
| 45 | + :vartype feature_state: azure.maps.creator.operations.FeatureStateOperations |
| 46 | + :ivar spatial: SpatialOperations operations |
| 47 | + :vartype spatial: azure.maps.creator.operations.SpatialOperations |
| 48 | + :ivar tileset: TilesetOperations operations |
| 49 | + :vartype tileset: azure.maps.creator.operations.TilesetOperations |
| 50 | + :ivar wfs: WFSOperations operations |
| 51 | + :vartype wfs: azure.maps.creator.operations.WFSOperations |
| 52 | + :param credential: Credential needed for the client to connect to Azure. |
| 53 | + :type credential: ~azure.core.credentials.TokenCredential |
| 54 | + :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. |
| 55 | + :type client_id: str |
| 56 | + :param geography: This parameter specifies where the Azure Maps Creator resource is located. Valid values are us and eu. |
| 57 | + :type geography: str or ~azure.maps.creator.models.Geography |
| 58 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. |
| 59 | + """ |
| 60 | + |
| 61 | + def __init__( |
| 62 | + self, |
| 63 | + credential, # type: "TokenCredential" |
| 64 | + client_id=None, # type: Optional[str] |
| 65 | + geography="us", # type: Union[str, "_models.Geography"] |
| 66 | + **kwargs # type: Any |
| 67 | + ): |
| 68 | + # type: (...) -> None |
| 69 | + base_url = 'https://{geography}.atlas.microsoft.com' |
| 70 | + self._config = CreatorClientConfiguration(credential, client_id, geography, **kwargs) |
| 71 | + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 72 | + |
| 73 | + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
| 74 | + self._serialize = Serializer(client_models) |
| 75 | + self._serialize.client_side_validation = False |
| 76 | + self._deserialize = Deserializer(client_models) |
| 77 | + |
| 78 | + self.alias = AliasOperations( |
| 79 | + self._client, self._config, self._serialize, self._deserialize) |
| 80 | + self.data = DataOperations( |
| 81 | + self._client, self._config, self._serialize, self._deserialize) |
| 82 | + self.dataset = DatasetOperations( |
| 83 | + self._client, self._config, self._serialize, self._deserialize) |
| 84 | + self.conversion = ConversionOperations( |
| 85 | + self._client, self._config, self._serialize, self._deserialize) |
| 86 | + self.feature_state = FeatureStateOperations( |
| 87 | + self._client, self._config, self._serialize, self._deserialize) |
| 88 | + self.spatial = SpatialOperations( |
| 89 | + self._client, self._config, self._serialize, self._deserialize) |
| 90 | + self.tileset = TilesetOperations( |
| 91 | + self._client, self._config, self._serialize, self._deserialize) |
| 92 | + self.wfs = WFSOperations( |
| 93 | + self._client, self._config, self._serialize, self._deserialize) |
| 94 | + |
| 95 | + def _send_request(self, http_request, **kwargs): |
| 96 | + # type: (HttpRequest, Any) -> HttpResponse |
| 97 | + """Runs the network request through the client's chained policies. |
| 98 | +
|
| 99 | + :param http_request: The network request you want to make. Required. |
| 100 | + :type http_request: ~azure.core.pipeline.transport.HttpRequest |
| 101 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. |
| 102 | + :return: The response of your network call. Does not do error handling on your response. |
| 103 | + :rtype: ~azure.core.pipeline.transport.HttpResponse |
| 104 | + """ |
| 105 | + path_format_arguments = { |
| 106 | + 'geography': self._serialize.url("self._config.geography", self._config.geography, 'str'), |
| 107 | + } |
| 108 | + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) |
| 109 | + stream = kwargs.pop("stream", True) |
| 110 | + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) |
| 111 | + return pipeline_response.http_response |
| 112 | + |
| 113 | + def close(self): |
| 114 | + # type: () -> None |
| 115 | + self._client.close() |
| 116 | + |
| 117 | + def __enter__(self): |
| 118 | + # type: () -> CreatorClient |
| 119 | + self._client.__enter__() |
| 120 | + return self |
| 121 | + |
| 122 | + def __exit__(self, *exc_details): |
| 123 | + # type: (Any) -> None |
| 124 | + self._client.__exit__(*exc_details) |
0 commit comments