66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
9- from typing import TYPE_CHECKING
9+ from copy import deepcopy
10+ from typing import Any , Optional , TYPE_CHECKING
1011
12+ from azure .core .rest import HttpRequest , HttpResponse
1113from azure .mgmt .core import ARMPipelineClient
1214from msrest import Deserializer , Serializer
1315
16+ from . import models
17+ from ._configuration import PolicyInsightsClientConfiguration
18+ from .operations import AttestationsOperations , Operations , PolicyEventsOperations , PolicyMetadataOperations , PolicyRestrictionsOperations , PolicyStatesOperations , PolicyTrackedResourcesOperations , RemediationsOperations
19+
1420if TYPE_CHECKING :
1521 # pylint: disable=unused-import,ungrouped-imports
16- from typing import Any , Optional
17-
1822 from azure .core .credentials import TokenCredential
19- from azure .core .pipeline .transport import HttpRequest , HttpResponse
20-
21- from ._configuration import PolicyInsightsClientConfiguration
22- from .operations import PolicyTrackedResourcesOperations
23- from .operations import RemediationsOperations
24- from .operations import PolicyEventsOperations
25- from .operations import PolicyStatesOperations
26- from .operations import Operations
27- from .operations import PolicyMetadataOperations
28- from .operations import PolicyRestrictionsOperations
29- from .operations import AttestationsOperations
30- from . import models
31-
3223
33- class PolicyInsightsClient ( object ) :
24+ class PolicyInsightsClient :
3425 """PolicyInsightsClient.
3526
3627 :ivar policy_tracked_resources: PolicyTrackedResourcesOperations operations
37- :vartype policy_tracked_resources: azure.mgmt.policyinsights.operations.PolicyTrackedResourcesOperations
28+ :vartype policy_tracked_resources:
29+ azure.mgmt.policyinsights.operations.PolicyTrackedResourcesOperations
3830 :ivar remediations: RemediationsOperations operations
3931 :vartype remediations: azure.mgmt.policyinsights.operations.RemediationsOperations
4032 :ivar policy_events: PolicyEventsOperations operations
@@ -53,62 +45,61 @@ class PolicyInsightsClient(object):
5345 :type credential: ~azure.core.credentials.TokenCredential
5446 :param subscription_id: Microsoft Azure subscription ID.
5547 :type subscription_id: str
56- :param str base_url: Service URL
57- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
48+ :param base_url: Service URL. Default value is 'https://management.azure.com'.
49+ :type base_url: str
50+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
51+ Retry-After header is present.
5852 """
5953
6054 def __init__ (
6155 self ,
62- credential , # type: "TokenCredential"
63- subscription_id , # type: str
64- base_url = None , # type: Optional[str]
65- ** kwargs # type: Any
66- ):
67- # type: (...) -> None
68- if not base_url :
69- base_url = 'https://management.azure.com'
70- self ._config = PolicyInsightsClientConfiguration (credential , subscription_id , ** kwargs )
56+ credential : "TokenCredential" ,
57+ subscription_id : str ,
58+ base_url : str = "https://management.azure.com" ,
59+ ** kwargs : Any
60+ ) -> None :
61+ self ._config = PolicyInsightsClientConfiguration (credential = credential , subscription_id = subscription_id , ** kwargs )
7162 self ._client = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
7263
7364 client_models = {k : v for k , v in models .__dict__ .items () if isinstance (v , type )}
7465 self ._serialize = Serializer (client_models )
75- self ._serialize .client_side_validation = False
7666 self ._deserialize = Deserializer (client_models )
67+ self ._serialize .client_side_validation = False
68+ self .policy_tracked_resources = PolicyTrackedResourcesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
69+ self .remediations = RemediationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
70+ self .policy_events = PolicyEventsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
71+ self .policy_states = PolicyStatesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
72+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
73+ self .policy_metadata = PolicyMetadataOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
74+ self .policy_restrictions = PolicyRestrictionsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
75+ self .attestations = AttestationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
7776
78- self .policy_tracked_resources = PolicyTrackedResourcesOperations (
79- self ._client , self ._config , self ._serialize , self ._deserialize )
80- self .remediations = RemediationsOperations (
81- self ._client , self ._config , self ._serialize , self ._deserialize )
82- self .policy_events = PolicyEventsOperations (
83- self ._client , self ._config , self ._serialize , self ._deserialize )
84- self .policy_states = PolicyStatesOperations (
85- self ._client , self ._config , self ._serialize , self ._deserialize )
86- self .operations = Operations (
87- self ._client , self ._config , self ._serialize , self ._deserialize )
88- self .policy_metadata = PolicyMetadataOperations (
89- self ._client , self ._config , self ._serialize , self ._deserialize )
90- self .policy_restrictions = PolicyRestrictionsOperations (
91- self ._client , self ._config , self ._serialize , self ._deserialize )
92- self .attestations = AttestationsOperations (
93- self ._client , self ._config , self ._serialize , self ._deserialize )
94-
95- def _send_request (self , http_request , ** kwargs ):
96- # type: (HttpRequest, Any) -> HttpResponse
77+
78+ def _send_request (
79+ self ,
80+ request , # type: HttpRequest
81+ ** kwargs : Any
82+ ) -> HttpResponse :
9783 """Runs the network request through the client's chained policies.
9884
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.
85+ >>> from azure.core.rest import HttpRequest
86+ >>> request = HttpRequest("GET", "https://www.example.org/")
87+ <HttpRequest [GET], url: 'https://www.example.org/'>
88+ >>> response = client._send_request(request)
89+ <HttpResponse: 200 OK>
90+
91+ For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
92+
93+ :param request: The network request you want to make. Required.
94+ :type request: ~azure.core.rest.HttpRequest
95+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
10296 :return: The response of your network call. Does not do error handling on your response.
103- :rtype: ~azure.core.pipeline.transport .HttpResponse
97+ :rtype: ~azure.core.rest .HttpResponse
10498 """
105- path_format_arguments = {
106- 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , '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
99+
100+ request_copy = deepcopy (request )
101+ request_copy .url = self ._client .format_url (request_copy .url )
102+ return self ._client .send_request (request_copy , ** kwargs )
112103
113104 def close (self ):
114105 # type: () -> None
0 commit comments