|
| 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 |
| 5 | +# license information. |
| 6 | +# |
| 7 | +# Code generated by Microsoft (R) AutoRest Code Generator. |
| 8 | +# Changes may cause incorrect behavior and will be lost if the code is |
| 9 | +# regenerated. |
| 10 | +# -------------------------------------------------------------------------- |
| 11 | + |
| 12 | +from azure.mgmt.core import AsyncARMPipelineClient |
| 13 | +from msrest import Serializer, Deserializer |
| 14 | + |
| 15 | +from azure.profiles import KnownProfiles, ProfileDefinition |
| 16 | +from azure.profiles.multiapiclient import MultiApiClientMixin |
| 17 | +from ._configuration import AdpManagementClientConfiguration |
| 18 | + |
| 19 | +class _SDKClient(object): |
| 20 | + def __init__(self, *args, **kwargs): |
| 21 | + """This is a fake class to support current implemetation of MultiApiClientMixin." |
| 22 | + Will be removed in final version of multiapi azure-core based client |
| 23 | + """ |
| 24 | + pass |
| 25 | + |
| 26 | +class AdpManagementClient(MultiApiClientMixin, _SDKClient): |
| 27 | + """Microsoft Autonomous Development Platform. |
| 28 | +
|
| 29 | + This ready contains multiple API versions, to help you deal with all of the Azure clouds |
| 30 | + (Azure Stack, Azure Government, Azure China, etc.). |
| 31 | + By default, it uses the latest API version available on public Azure. |
| 32 | + For production, you should stick to a particular api-version and/or profile. |
| 33 | + The profile sets a mapping between an operation group and its API version. |
| 34 | + The api-version parameter sets the default API version if the operation |
| 35 | + group is not described in the profile. |
| 36 | +
|
| 37 | + :param credential: Credential needed for the client to connect to Azure. |
| 38 | + :type credential: ~azure.core.credentials_async.AsyncTokenCredential |
| 39 | + :param subscription_id: The ID of the target subscription. |
| 40 | + :type subscription_id: str |
| 41 | + :param str api_version: API version to use if no profile is provided, or if |
| 42 | + missing in profile. |
| 43 | + :param str base_url: Service URL |
| 44 | + :param profile: A profile definition, from KnownProfiles to dict. |
| 45 | + :type profile: azure.profiles.KnownProfiles |
| 46 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. |
| 47 | + """ |
| 48 | + |
| 49 | + DEFAULT_API_VERSION = '2020-07-01-preview' |
| 50 | + _PROFILE_TAG = "azure.mgmt.adp.AdpManagementClient" |
| 51 | + LATEST_PROFILE = ProfileDefinition({ |
| 52 | + _PROFILE_TAG: { |
| 53 | + None: DEFAULT_API_VERSION, |
| 54 | + }}, |
| 55 | + _PROFILE_TAG + " latest" |
| 56 | + ) |
| 57 | + |
| 58 | + def __init__( |
| 59 | + self, |
| 60 | + credential, # type: "AsyncTokenCredential" |
| 61 | + subscription_id, # type: str |
| 62 | + api_version=None, |
| 63 | + base_url=None, |
| 64 | + profile=KnownProfiles.default, |
| 65 | + **kwargs # type: Any |
| 66 | + ) -> None: |
| 67 | + if not base_url: |
| 68 | + base_url = 'https://management.azure.com' |
| 69 | + self._config = AdpManagementClientConfiguration(credential, subscription_id, **kwargs) |
| 70 | + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 71 | + super(AdpManagementClient, self).__init__( |
| 72 | + api_version=api_version, |
| 73 | + profile=profile |
| 74 | + ) |
| 75 | + |
| 76 | + @classmethod |
| 77 | + def _models_dict(cls, api_version): |
| 78 | + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} |
| 79 | + |
| 80 | + @classmethod |
| 81 | + def models(cls, api_version=DEFAULT_API_VERSION): |
| 82 | + """Module depends on the API version: |
| 83 | +
|
| 84 | + * 2020-07-01-preview: :mod:`v2020_07_01_preview.models<azure.mgmt.adp.v2020_07_01_preview.models>` |
| 85 | + """ |
| 86 | + if api_version == '2020-07-01-preview': |
| 87 | + from ..v2020_07_01_preview import models |
| 88 | + return models |
| 89 | + raise ValueError("API version {} is not available".format(api_version)) |
| 90 | + |
| 91 | + @property |
| 92 | + def accounts(self): |
| 93 | + """Instance depends on the API version: |
| 94 | +
|
| 95 | + * 2020-07-01-preview: :class:`AccountsOperations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.AccountsOperations>` |
| 96 | + """ |
| 97 | + api_version = self._get_api_version('accounts') |
| 98 | + if api_version == '2020-07-01-preview': |
| 99 | + from ..v2020_07_01_preview.aio.operations import AccountsOperations as OperationClass |
| 100 | + else: |
| 101 | + raise ValueError("API version {} does not have operation group 'accounts'".format(api_version)) |
| 102 | + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 103 | + |
| 104 | + @property |
| 105 | + def data_pools(self): |
| 106 | + """Instance depends on the API version: |
| 107 | +
|
| 108 | + * 2020-07-01-preview: :class:`DataPoolsOperations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.DataPoolsOperations>` |
| 109 | + """ |
| 110 | + api_version = self._get_api_version('data_pools') |
| 111 | + if api_version == '2020-07-01-preview': |
| 112 | + from ..v2020_07_01_preview.aio.operations import DataPoolsOperations as OperationClass |
| 113 | + else: |
| 114 | + raise ValueError("API version {} does not have operation group 'data_pools'".format(api_version)) |
| 115 | + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 116 | + |
| 117 | + @property |
| 118 | + def operations(self): |
| 119 | + """Instance depends on the API version: |
| 120 | +
|
| 121 | + * 2020-07-01-preview: :class:`Operations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.Operations>` |
| 122 | + """ |
| 123 | + api_version = self._get_api_version('operations') |
| 124 | + if api_version == '2020-07-01-preview': |
| 125 | + from ..v2020_07_01_preview.aio.operations import Operations as OperationClass |
| 126 | + else: |
| 127 | + raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) |
| 128 | + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 129 | + |
| 130 | + async def close(self): |
| 131 | + await self._client.close() |
| 132 | + async def __aenter__(self): |
| 133 | + await self._client.__aenter__() |
| 134 | + return self |
| 135 | + async def __aexit__(self, *exc_details): |
| 136 | + await self._client.__aexit__(*exc_details) |
0 commit comments