|
6 | 6 | # Changes may cause incorrect behavior and will be lost if the code is regenerated. |
7 | 7 | # -------------------------------------------------------------------------- |
8 | 8 |
|
9 | | -from typing import TYPE_CHECKING |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, TYPE_CHECKING |
10 | 11 |
|
11 | | -from azure.mgmt.core import ARMPipelineClient |
12 | 12 | from msrest import Deserializer, Serializer |
13 | 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 |
19 | | - from azure.core.pipeline.transport import HttpRequest, HttpResponse |
| 14 | +from azure.core.rest import HttpRequest, HttpResponse |
| 15 | +from azure.mgmt.core import ARMPipelineClient |
20 | 16 |
|
21 | | -from ._configuration import GuestConfigurationClientConfiguration |
22 | | -from .operations import GuestConfigurationAssignmentsOperations |
23 | | -from .operations import GuestConfigurationAssignmentReportsOperations |
24 | | -from .operations import GuestConfigurationHCRPAssignmentsOperations |
25 | | -from .operations import GuestConfigurationHCRPAssignmentReportsOperations |
26 | | -from .operations import Operations |
27 | 17 | from . import models |
| 18 | +from ._configuration import GuestConfigurationClientConfiguration |
| 19 | +from .operations import GuestConfigurationAssignmentReportsOperations, GuestConfigurationAssignmentReportsVMSSOperations, GuestConfigurationAssignmentsOperations, GuestConfigurationAssignmentsVMSSOperations, GuestConfigurationHCRPAssignmentReportsOperations, GuestConfigurationHCRPAssignmentsOperations, Operations |
28 | 20 |
|
| 21 | +if TYPE_CHECKING: |
| 22 | + # pylint: disable=unused-import,ungrouped-imports |
| 23 | + from azure.core.credentials import TokenCredential |
29 | 24 |
|
30 | | -class GuestConfigurationClient(object): |
| 25 | +class GuestConfigurationClient: # pylint: disable=too-many-instance-attributes |
31 | 26 | """Guest Configuration Client. |
32 | 27 |
|
33 | 28 | :ivar guest_configuration_assignments: GuestConfigurationAssignmentsOperations operations |
34 | | - :vartype guest_configuration_assignments: azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentsOperations |
35 | | - :ivar guest_configuration_assignment_reports: GuestConfigurationAssignmentReportsOperations operations |
36 | | - :vartype guest_configuration_assignment_reports: azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentReportsOperations |
37 | | - :ivar guest_configuration_hcrp_assignments: GuestConfigurationHCRPAssignmentsOperations operations |
38 | | - :vartype guest_configuration_hcrp_assignments: azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentsOperations |
39 | | - :ivar guest_configuration_hcrp_assignment_reports: GuestConfigurationHCRPAssignmentReportsOperations operations |
40 | | - :vartype guest_configuration_hcrp_assignment_reports: azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentReportsOperations |
| 29 | + :vartype guest_configuration_assignments: |
| 30 | + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentsOperations |
| 31 | + :ivar guest_configuration_assignment_reports: GuestConfigurationAssignmentReportsOperations |
| 32 | + operations |
| 33 | + :vartype guest_configuration_assignment_reports: |
| 34 | + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentReportsOperations |
| 35 | + :ivar guest_configuration_hcrp_assignments: GuestConfigurationHCRPAssignmentsOperations |
| 36 | + operations |
| 37 | + :vartype guest_configuration_hcrp_assignments: |
| 38 | + azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentsOperations |
| 39 | + :ivar guest_configuration_hcrp_assignment_reports: |
| 40 | + GuestConfigurationHCRPAssignmentReportsOperations operations |
| 41 | + :vartype guest_configuration_hcrp_assignment_reports: |
| 42 | + azure.mgmt.guestconfig.operations.GuestConfigurationHCRPAssignmentReportsOperations |
| 43 | + :ivar guest_configuration_assignments_vmss: GuestConfigurationAssignmentsVMSSOperations |
| 44 | + operations |
| 45 | + :vartype guest_configuration_assignments_vmss: |
| 46 | + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentsVMSSOperations |
| 47 | + :ivar guest_configuration_assignment_reports_vmss: |
| 48 | + GuestConfigurationAssignmentReportsVMSSOperations operations |
| 49 | + :vartype guest_configuration_assignment_reports_vmss: |
| 50 | + azure.mgmt.guestconfig.operations.GuestConfigurationAssignmentReportsVMSSOperations |
41 | 51 | :ivar operations: Operations operations |
42 | 52 | :vartype operations: azure.mgmt.guestconfig.operations.Operations |
43 | 53 | :param credential: Credential needed for the client to connect to Azure. |
44 | 54 | :type credential: ~azure.core.credentials.TokenCredential |
45 | | - :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
| 55 | + :param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. |
| 56 | + The subscription ID forms part of the URI for every service call. |
46 | 57 | :type subscription_id: str |
47 | | - :param str base_url: Service URL |
| 58 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 59 | + :type base_url: str |
| 60 | + :keyword api_version: Api Version. Default value is "2022-01-25". Note that overriding this |
| 61 | + default value may result in unsupported behavior. |
| 62 | + :paramtype api_version: str |
48 | 63 | """ |
49 | 64 |
|
50 | 65 | def __init__( |
51 | 66 | self, |
52 | | - credential, # type: "TokenCredential" |
53 | | - subscription_id, # type: str |
54 | | - base_url=None, # type: Optional[str] |
55 | | - **kwargs # type: Any |
56 | | - ): |
57 | | - # type: (...) -> None |
58 | | - if not base_url: |
59 | | - base_url = 'https://management.azure.com' |
60 | | - self._config = GuestConfigurationClientConfiguration(credential, subscription_id, **kwargs) |
| 67 | + credential: "TokenCredential", |
| 68 | + subscription_id: str, |
| 69 | + base_url: str = "https://management.azure.com", |
| 70 | + **kwargs: Any |
| 71 | + ) -> None: |
| 72 | + self._config = GuestConfigurationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) |
61 | 73 | self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
62 | 74 |
|
63 | 75 | client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} |
64 | 76 | self._serialize = Serializer(client_models) |
65 | | - self._serialize.client_side_validation = False |
66 | 77 | self._deserialize = Deserializer(client_models) |
| 78 | + self._serialize.client_side_validation = False |
| 79 | + self.guest_configuration_assignments = GuestConfigurationAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 80 | + self.guest_configuration_assignment_reports = GuestConfigurationAssignmentReportsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 81 | + self.guest_configuration_hcrp_assignments = GuestConfigurationHCRPAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 82 | + self.guest_configuration_hcrp_assignment_reports = GuestConfigurationHCRPAssignmentReportsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 83 | + self.guest_configuration_assignments_vmss = GuestConfigurationAssignmentsVMSSOperations(self._client, self._config, self._serialize, self._deserialize) |
| 84 | + self.guest_configuration_assignment_reports_vmss = GuestConfigurationAssignmentReportsVMSSOperations(self._client, self._config, self._serialize, self._deserialize) |
| 85 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 86 | + |
67 | 87 |
|
68 | | - self.guest_configuration_assignments = GuestConfigurationAssignmentsOperations( |
69 | | - self._client, self._config, self._serialize, self._deserialize) |
70 | | - self.guest_configuration_assignment_reports = GuestConfigurationAssignmentReportsOperations( |
71 | | - self._client, self._config, self._serialize, self._deserialize) |
72 | | - self.guest_configuration_hcrp_assignments = GuestConfigurationHCRPAssignmentsOperations( |
73 | | - self._client, self._config, self._serialize, self._deserialize) |
74 | | - self.guest_configuration_hcrp_assignment_reports = GuestConfigurationHCRPAssignmentReportsOperations( |
75 | | - self._client, self._config, self._serialize, self._deserialize) |
76 | | - self.operations = Operations( |
77 | | - self._client, self._config, self._serialize, self._deserialize) |
78 | | - |
79 | | - def _send_request(self, http_request, **kwargs): |
80 | | - # type: (HttpRequest, Any) -> HttpResponse |
| 88 | + def _send_request( |
| 89 | + self, |
| 90 | + request: HttpRequest, |
| 91 | + **kwargs: Any |
| 92 | + ) -> HttpResponse: |
81 | 93 | """Runs the network request through the client's chained policies. |
82 | 94 |
|
83 | | - :param http_request: The network request you want to make. Required. |
84 | | - :type http_request: ~azure.core.pipeline.transport.HttpRequest |
85 | | - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. |
| 95 | + >>> from azure.core.rest import HttpRequest |
| 96 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 97 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 98 | + >>> response = client._send_request(request) |
| 99 | + <HttpResponse: 200 OK> |
| 100 | +
|
| 101 | + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart |
| 102 | +
|
| 103 | + :param request: The network request you want to make. Required. |
| 104 | + :type request: ~azure.core.rest.HttpRequest |
| 105 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
86 | 106 | :return: The response of your network call. Does not do error handling on your response. |
87 | | - :rtype: ~azure.core.pipeline.transport.HttpResponse |
| 107 | + :rtype: ~azure.core.rest.HttpResponse |
88 | 108 | """ |
89 | | - path_format_arguments = { |
90 | | - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), |
91 | | - } |
92 | | - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) |
93 | | - stream = kwargs.pop("stream", True) |
94 | | - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) |
95 | | - return pipeline_response.http_response |
| 109 | + |
| 110 | + request_copy = deepcopy(request) |
| 111 | + request_copy.url = self._client.format_url(request_copy.url) |
| 112 | + return self._client.send_request(request_copy, **kwargs) |
96 | 113 |
|
97 | 114 | def close(self): |
98 | 115 | # type: () -> None |
|
0 commit comments