|
1 | 1 | # coding=utf-8 |
2 | 2 | # -------------------------------------------------------------------------- |
3 | 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 | | -# |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
7 | 5 | # Code generated by Microsoft (R) AutoRest Code Generator. |
8 | | -# Changes may cause incorrect behavior and will be lost if the code is |
9 | | -# regenerated. |
| 6 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
10 | 7 | # -------------------------------------------------------------------------- |
11 | 8 |
|
12 | | -from msrest.service_client import SDKClient |
13 | | -from msrest import Serializer, Deserializer |
| 9 | +from typing import TYPE_CHECKING |
| 10 | + |
| 11 | +from azure.mgmt.core import ARMPipelineClient |
| 12 | +from msrest import Deserializer, Serializer |
| 13 | + |
| 14 | +if TYPE_CHECKING: |
| 15 | + # pylint: disable=unused-import,ungrouped-imports |
| 16 | + from typing import Any, Optional |
| 17 | + |
| 18 | + from azure.core.credentials import TokenCredential |
14 | 19 |
|
15 | 20 | from ._configuration import OperationsManagementClientConfiguration |
16 | 21 | from .operations import SolutionsOperations |
|
20 | 25 | from . import models |
21 | 26 |
|
22 | 27 |
|
23 | | -class OperationsManagementClient(SDKClient): |
24 | | - """Operations Management Client |
| 28 | +class OperationsManagementClient(object): |
| 29 | + """Operations Management Client. |
25 | 30 |
|
26 | | - :ivar config: Configuration for client. |
27 | | - :vartype config: OperationsManagementClientConfiguration |
28 | | -
|
29 | | - :ivar solutions: Solutions operations |
30 | | - :vartype solutions: azure.mgmt.operationsmanagement.operations.SolutionsOperations |
31 | | - :ivar management_associations: ManagementAssociations operations |
32 | | - :vartype management_associations: azure.mgmt.operationsmanagement.operations.ManagementAssociationsOperations |
33 | | - :ivar management_configurations: ManagementConfigurations operations |
34 | | - :vartype management_configurations: azure.mgmt.operationsmanagement.operations.ManagementConfigurationsOperations |
| 31 | + :ivar solutions: SolutionsOperations operations |
| 32 | + :vartype solutions: operations_management_client.operations.SolutionsOperations |
| 33 | + :ivar management_associations: ManagementAssociationsOperations operations |
| 34 | + :vartype management_associations: operations_management_client.operations.ManagementAssociationsOperations |
| 35 | + :ivar management_configurations: ManagementConfigurationsOperations operations |
| 36 | + :vartype management_configurations: operations_management_client.operations.ManagementConfigurationsOperations |
35 | 37 | :ivar operations: Operations operations |
36 | | - :vartype operations: azure.mgmt.operationsmanagement.operations.Operations |
37 | | -
|
38 | | - :param credentials: Credentials needed for the client to connect to Azure. |
39 | | - :type credentials: :mod:`A msrestazure Credentials |
40 | | - object<msrestazure.azure_active_directory>` |
41 | | - :param subscription_id: Gets subscription credentials which uniquely |
42 | | - identify Microsoft Azure subscription. The subscription ID forms part of |
43 | | - the URI for every service call. |
| 38 | + :vartype operations: operations_management_client.operations.Operations |
| 39 | + :param credential: Credential needed for the client to connect to Azure. |
| 40 | + :type credential: ~azure.core.credentials.TokenCredential |
| 41 | + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
44 | 42 | :type subscription_id: str |
45 | 43 | :param provider_name: Provider name for the parent resource. |
46 | 44 | :type provider_name: str |
47 | | - :param resource_type: Resource type for the parent resource |
| 45 | + :param resource_type: Resource type for the parent resource. |
48 | 46 | :type resource_type: str |
49 | 47 | :param resource_name: Parent resource name. |
50 | 48 | :type resource_name: str |
51 | 49 | :param str base_url: Service URL |
| 50 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. |
52 | 51 | """ |
53 | 52 |
|
54 | 53 | def __init__( |
55 | | - self, credentials, subscription_id, provider_name, resource_type, resource_name, base_url=None): |
56 | | - |
57 | | - self.config = OperationsManagementClientConfiguration(credentials, subscription_id, provider_name, resource_type, resource_name, base_url) |
58 | | - super(OperationsManagementClient, self).__init__(self.config.credentials, self.config) |
| 54 | + self, |
| 55 | + credential, # type: "TokenCredential" |
| 56 | + subscription_id, # type: str |
| 57 | + provider_name, # type: str |
| 58 | + resource_type, # type: str |
| 59 | + resource_name, # type: str |
| 60 | + base_url=None, # type: Optional[str] |
| 61 | + **kwargs # type: Any |
| 62 | + ): |
| 63 | + # type: (...) -> None |
| 64 | + if not base_url: |
| 65 | + base_url = 'https://management.azure.com' |
| 66 | + self._config = OperationsManagementClientConfiguration(credential, subscription_id, provider_name, resource_type, resource_name, **kwargs) |
| 67 | + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
59 | 68 |
|
60 | 69 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
61 | | - self.api_version = '2015-11-01-preview' |
62 | 70 | self._serialize = Serializer(client_models) |
| 71 | + self._serialize.client_side_validation = False |
63 | 72 | self._deserialize = Deserializer(client_models) |
64 | 73 |
|
65 | 74 | self.solutions = SolutionsOperations( |
66 | | - self._client, self.config, self._serialize, self._deserialize) |
| 75 | + self._client, self._config, self._serialize, self._deserialize) |
67 | 76 | self.management_associations = ManagementAssociationsOperations( |
68 | | - self._client, self.config, self._serialize, self._deserialize) |
| 77 | + self._client, self._config, self._serialize, self._deserialize) |
69 | 78 | self.management_configurations = ManagementConfigurationsOperations( |
70 | | - self._client, self.config, self._serialize, self._deserialize) |
| 79 | + self._client, self._config, self._serialize, self._deserialize) |
71 | 80 | self.operations = Operations( |
72 | | - self._client, self.config, self._serialize, self._deserialize) |
| 81 | + self._client, self._config, self._serialize, self._deserialize) |
| 82 | + |
| 83 | + def close(self): |
| 84 | + # type: () -> None |
| 85 | + self._client.close() |
| 86 | + |
| 87 | + def __enter__(self): |
| 88 | + # type: () -> OperationsManagementClient |
| 89 | + self._client.__enter__() |
| 90 | + return self |
| 91 | + |
| 92 | + def __exit__(self, *exc_details): |
| 93 | + # type: (Any) -> None |
| 94 | + self._client.__exit__(*exc_details) |
0 commit comments