|
12 | 12 | from msrest.service_client import SDKClient
|
13 | 13 | from msrest import Serializer, Deserializer
|
14 | 14 |
|
| 15 | +from azure.profiles import KnownProfiles, ProfileDefinition |
| 16 | +from azure.profiles.multiapiclient import MultiApiClientMixin |
15 | 17 | from ._configuration import AppPlatformManagementClientConfiguration
|
16 |
| -from .operations import ServicesOperations |
17 |
| -from .operations import AppsOperations |
18 |
| -from .operations import BindingsOperations |
19 |
| -from .operations import DeploymentsOperations |
20 |
| -from .operations import Operations |
21 |
| -from . import models |
22 | 18 |
|
23 | 19 |
|
24 |
| -class AppPlatformManagementClient(SDKClient): |
| 20 | + |
| 21 | +class AppPlatformManagementClient(MultiApiClientMixin, SDKClient): |
25 | 22 | """REST API for Azure Spring Cloud
|
26 | 23 |
|
| 24 | + This ready contains multiple API versions, to help you deal with all Azure clouds |
| 25 | + (Azure Stack, Azure Government, Azure China, etc.). |
| 26 | + By default, uses latest API version available on public Azure. |
| 27 | + For production, you should stick a particular api-version and/or profile. |
| 28 | + The profile sets a mapping between the operation group and an API version. |
| 29 | + The api-version parameter sets the default API version if the operation |
| 30 | + group is not described in the profile. |
| 31 | +
|
27 | 32 | :ivar config: Configuration for client.
|
28 | 33 | :vartype config: AppPlatformManagementClientConfiguration
|
29 | 34 |
|
30 |
| - :ivar services: Services operations |
31 |
| - :vartype services: azure.mgmt.appplatform.operations.ServicesOperations |
32 |
| - :ivar apps: Apps operations |
33 |
| - :vartype apps: azure.mgmt.appplatform.operations.AppsOperations |
34 |
| - :ivar bindings: Bindings operations |
35 |
| - :vartype bindings: azure.mgmt.appplatform.operations.BindingsOperations |
36 |
| - :ivar deployments: Deployments operations |
37 |
| - :vartype deployments: azure.mgmt.appplatform.operations.DeploymentsOperations |
38 |
| - :ivar operations: Operations operations |
39 |
| - :vartype operations: azure.mgmt.appplatform.operations.Operations |
40 |
| -
|
41 | 35 | :param credentials: Credentials needed for the client to connect to Azure.
|
42 | 36 | :type credentials: :mod:`A msrestazure Credentials
|
43 | 37 | object<msrestazure.azure_active_directory>`
|
44 |
| - :param subscription_id: Gets subscription ID which uniquely identify the |
| 38 | + :param subscription_id: Subscription credentials which uniquely identify |
45 | 39 | Microsoft Azure subscription. The subscription ID forms part of the URI
|
46 | 40 | for every service call.
|
47 | 41 | :type subscription_id: str
|
| 42 | + :param str api_version: API version to use if no profile is provided, or if |
| 43 | + missing in profile. |
48 | 44 | :param str base_url: Service URL
|
| 45 | + :param profile: A profile definition, from KnownProfiles to dict. |
| 46 | + :type profile: azure.profiles.KnownProfiles |
49 | 47 | """
|
50 | 48 |
|
51 |
| - def __init__( |
52 |
| - self, credentials, subscription_id, base_url=None): |
| 49 | + DEFAULT_API_VERSION = '2020-07-01' |
| 50 | + _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" |
| 51 | + LATEST_PROFILE = ProfileDefinition({ |
| 52 | + _PROFILE_TAG: { |
| 53 | + None: DEFAULT_API_VERSION, |
| 54 | + 'sku': '2019-05-01-preview', |
| 55 | + }}, |
| 56 | + _PROFILE_TAG + " latest" |
| 57 | + ) |
53 | 58 |
|
| 59 | + def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): |
54 | 60 | self.config = AppPlatformManagementClientConfiguration(credentials, subscription_id, base_url)
|
55 |
| - super(AppPlatformManagementClient, self).__init__(self.config.credentials, self.config) |
56 |
| - |
57 |
| - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
58 |
| - self.api_version = '2019-05-01-preview' |
59 |
| - self._serialize = Serializer(client_models) |
60 |
| - self._deserialize = Deserializer(client_models) |
61 |
| - |
62 |
| - self.services = ServicesOperations( |
63 |
| - self._client, self.config, self._serialize, self._deserialize) |
64 |
| - self.apps = AppsOperations( |
65 |
| - self._client, self.config, self._serialize, self._deserialize) |
66 |
| - self.bindings = BindingsOperations( |
67 |
| - self._client, self.config, self._serialize, self._deserialize) |
68 |
| - self.deployments = DeploymentsOperations( |
69 |
| - self._client, self.config, self._serialize, self._deserialize) |
70 |
| - self.operations = Operations( |
71 |
| - self._client, self.config, self._serialize, self._deserialize) |
| 61 | + super(AppPlatformManagementClient, self).__init__( |
| 62 | + credentials, |
| 63 | + self.config, |
| 64 | + api_version=api_version, |
| 65 | + profile=profile |
| 66 | + ) |
| 67 | + |
| 68 | + @classmethod |
| 69 | + def _models_dict(cls, api_version): |
| 70 | + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} |
| 71 | + |
| 72 | + @classmethod |
| 73 | + def models(cls, api_version=DEFAULT_API_VERSION): |
| 74 | + """Module depends on the API version: |
| 75 | +
|
| 76 | + * 2019-05-01-preview: :mod:`v2019_05_01_preview.models<azure.mgmt.appplatform.v2019_05_01_preview.models>` |
| 77 | + * 2020-07-01: :mod:`v2020_07_01.models<azure.mgmt.appplatform.v2020_07_01.models>` |
| 78 | + """ |
| 79 | + if api_version == '2019-05-01-preview': |
| 80 | + from .v2019_05_01_preview import models |
| 81 | + return models |
| 82 | + elif api_version == '2020-07-01': |
| 83 | + from .v2020_07_01 import models |
| 84 | + return models |
| 85 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 86 | + |
| 87 | + @property |
| 88 | + def apps(self): |
| 89 | + """Instance depends on the API version: |
| 90 | +
|
| 91 | + * 2019-05-01-preview: :class:`AppsOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.AppsOperations>` |
| 92 | + * 2020-07-01: :class:`AppsOperations<azure.mgmt.appplatform.v2020_07_01.operations.AppsOperations>` |
| 93 | + """ |
| 94 | + api_version = self._get_api_version('apps') |
| 95 | + if api_version == '2019-05-01-preview': |
| 96 | + from .v2019_05_01_preview.operations import AppsOperations as OperationClass |
| 97 | + elif api_version == '2020-07-01': |
| 98 | + from .v2020_07_01.operations import AppsOperations as OperationClass |
| 99 | + else: |
| 100 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 101 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 102 | + |
| 103 | + @property |
| 104 | + def bindings(self): |
| 105 | + """Instance depends on the API version: |
| 106 | +
|
| 107 | + * 2019-05-01-preview: :class:`BindingsOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.BindingsOperations>` |
| 108 | + * 2020-07-01: :class:`BindingsOperations<azure.mgmt.appplatform.v2020_07_01.operations.BindingsOperations>` |
| 109 | + """ |
| 110 | + api_version = self._get_api_version('bindings') |
| 111 | + if api_version == '2019-05-01-preview': |
| 112 | + from .v2019_05_01_preview.operations import BindingsOperations as OperationClass |
| 113 | + elif api_version == '2020-07-01': |
| 114 | + from .v2020_07_01.operations import BindingsOperations as OperationClass |
| 115 | + else: |
| 116 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 117 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 118 | + |
| 119 | + @property |
| 120 | + def certificates(self): |
| 121 | + """Instance depends on the API version: |
| 122 | +
|
| 123 | + * 2019-05-01-preview: :class:`CertificatesOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.CertificatesOperations>` |
| 124 | + * 2020-07-01: :class:`CertificatesOperations<azure.mgmt.appplatform.v2020_07_01.operations.CertificatesOperations>` |
| 125 | + """ |
| 126 | + api_version = self._get_api_version('certificates') |
| 127 | + if api_version == '2019-05-01-preview': |
| 128 | + from .v2019_05_01_preview.operations import CertificatesOperations as OperationClass |
| 129 | + elif api_version == '2020-07-01': |
| 130 | + from .v2020_07_01.operations import CertificatesOperations as OperationClass |
| 131 | + else: |
| 132 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 133 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 134 | + |
| 135 | + @property |
| 136 | + def config_servers(self): |
| 137 | + """Instance depends on the API version: |
| 138 | +
|
| 139 | + * 2020-07-01: :class:`ConfigServersOperations<azure.mgmt.appplatform.v2020_07_01.operations.ConfigServersOperations>` |
| 140 | + """ |
| 141 | + api_version = self._get_api_version('config_servers') |
| 142 | + if api_version == '2020-07-01': |
| 143 | + from .v2020_07_01.operations import ConfigServersOperations as OperationClass |
| 144 | + else: |
| 145 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 146 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 147 | + |
| 148 | + @property |
| 149 | + def custom_domains(self): |
| 150 | + """Instance depends on the API version: |
| 151 | +
|
| 152 | + * 2019-05-01-preview: :class:`CustomDomainsOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.CustomDomainsOperations>` |
| 153 | + * 2020-07-01: :class:`CustomDomainsOperations<azure.mgmt.appplatform.v2020_07_01.operations.CustomDomainsOperations>` |
| 154 | + """ |
| 155 | + api_version = self._get_api_version('custom_domains') |
| 156 | + if api_version == '2019-05-01-preview': |
| 157 | + from .v2019_05_01_preview.operations import CustomDomainsOperations as OperationClass |
| 158 | + elif api_version == '2020-07-01': |
| 159 | + from .v2020_07_01.operations import CustomDomainsOperations as OperationClass |
| 160 | + else: |
| 161 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 162 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 163 | + |
| 164 | + @property |
| 165 | + def deployments(self): |
| 166 | + """Instance depends on the API version: |
| 167 | +
|
| 168 | + * 2019-05-01-preview: :class:`DeploymentsOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.DeploymentsOperations>` |
| 169 | + * 2020-07-01: :class:`DeploymentsOperations<azure.mgmt.appplatform.v2020_07_01.operations.DeploymentsOperations>` |
| 170 | + """ |
| 171 | + api_version = self._get_api_version('deployments') |
| 172 | + if api_version == '2019-05-01-preview': |
| 173 | + from .v2019_05_01_preview.operations import DeploymentsOperations as OperationClass |
| 174 | + elif api_version == '2020-07-01': |
| 175 | + from .v2020_07_01.operations import DeploymentsOperations as OperationClass |
| 176 | + else: |
| 177 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 178 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 179 | + |
| 180 | + @property |
| 181 | + def monitoring_settings(self): |
| 182 | + """Instance depends on the API version: |
| 183 | +
|
| 184 | + * 2020-07-01: :class:`MonitoringSettingsOperations<azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations>` |
| 185 | + """ |
| 186 | + api_version = self._get_api_version('monitoring_settings') |
| 187 | + if api_version == '2020-07-01': |
| 188 | + from .v2020_07_01.operations import MonitoringSettingsOperations as OperationClass |
| 189 | + else: |
| 190 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 191 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 192 | + |
| 193 | + @property |
| 194 | + def operations(self): |
| 195 | + """Instance depends on the API version: |
| 196 | +
|
| 197 | + * 2019-05-01-preview: :class:`Operations<azure.mgmt.appplatform.v2019_05_01_preview.operations.Operations>` |
| 198 | + * 2020-07-01: :class:`Operations<azure.mgmt.appplatform.v2020_07_01.operations.Operations>` |
| 199 | + """ |
| 200 | + api_version = self._get_api_version('operations') |
| 201 | + if api_version == '2019-05-01-preview': |
| 202 | + from .v2019_05_01_preview.operations import Operations as OperationClass |
| 203 | + elif api_version == '2020-07-01': |
| 204 | + from .v2020_07_01.operations import Operations as OperationClass |
| 205 | + else: |
| 206 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 207 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 208 | + |
| 209 | + @property |
| 210 | + def services(self): |
| 211 | + """Instance depends on the API version: |
| 212 | +
|
| 213 | + * 2019-05-01-preview: :class:`ServicesOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.ServicesOperations>` |
| 214 | + * 2020-07-01: :class:`ServicesOperations<azure.mgmt.appplatform.v2020_07_01.operations.ServicesOperations>` |
| 215 | + """ |
| 216 | + api_version = self._get_api_version('services') |
| 217 | + if api_version == '2019-05-01-preview': |
| 218 | + from .v2019_05_01_preview.operations import ServicesOperations as OperationClass |
| 219 | + elif api_version == '2020-07-01': |
| 220 | + from .v2020_07_01.operations import ServicesOperations as OperationClass |
| 221 | + else: |
| 222 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 223 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 224 | + |
| 225 | + @property |
| 226 | + def sku(self): |
| 227 | + """Instance depends on the API version: |
| 228 | +
|
| 229 | + * 2019-05-01-preview: :class:`SkuOperations<azure.mgmt.appplatform.v2019_05_01_preview.operations.SkuOperations>` |
| 230 | + """ |
| 231 | + api_version = self._get_api_version('sku') |
| 232 | + if api_version == '2019-05-01-preview': |
| 233 | + from .v2019_05_01_preview.operations import SkuOperations as OperationClass |
| 234 | + else: |
| 235 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 236 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
| 237 | + |
| 238 | + @property |
| 239 | + def skus(self): |
| 240 | + """Instance depends on the API version: |
| 241 | +
|
| 242 | + * 2020-07-01: :class:`SkusOperations<azure.mgmt.appplatform.v2020_07_01.operations.SkusOperations>` |
| 243 | + """ |
| 244 | + api_version = self._get_api_version('skus') |
| 245 | + if api_version == '2020-07-01': |
| 246 | + from .v2020_07_01.operations import SkusOperations as OperationClass |
| 247 | + else: |
| 248 | + raise NotImplementedError("APIVersion {} is not available".format(api_version)) |
| 249 | + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) |
0 commit comments