22# --------------------------------------------------------------------------
33# Copyright (c) Microsoft Corporation. All rights reserved.
44# Licensed under the MIT License. See License.txt in the project root for license information.
5- # Code generated by Microsoft (R) AutoRest Code Generator.
5+ # Code generated by Microsoft (R) Python Code Generator.
66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
15- from . import models as _models
1618from ._configuration import NetworkAnalyticsMgmtClientConfiguration
1719from ._serialization import Deserializer , Serializer
1820from .operations import DataProductsCatalogsOperations , DataProductsOperations , DataTypesOperations , Operations
1921
2022if TYPE_CHECKING :
21- # pylint: disable=unused-import,ungrouped-imports
2223 from azure .core .credentials import TokenCredential
2324
2425
25- class NetworkAnalyticsMgmtClient : # pylint: disable=client-accepts-api-version-keyword
26+ class NetworkAnalyticsMgmtClient :
2627 """NetworkAnalyticsMgmtClient.
2728
2829 :ivar operations: Operations operations
2930 :vartype operations: azure.mgmt.networkanalytics.operations.Operations
30- :ivar data_products: DataProductsOperations operations
31- :vartype data_products: azure.mgmt.networkanalytics.operations.DataProductsOperations
3231 :ivar data_products_catalogs: DataProductsCatalogsOperations operations
3332 :vartype data_products_catalogs:
3433 azure.mgmt.networkanalytics.operations.DataProductsCatalogsOperations
3534 :ivar data_types: DataTypesOperations operations
3635 :vartype data_types: azure.mgmt.networkanalytics.operations.DataTypesOperations
37- :param credential: Credential needed for the client to connect to Azure. Required.
36+ :ivar data_products: DataProductsOperations operations
37+ :vartype data_products: azure.mgmt.networkanalytics.operations.DataProductsOperations
38+ :param credential: Credential used to authenticate requests to the service. Required.
3839 :type credential: ~azure.core.credentials.TokenCredential
39- :param subscription_id: The ID of the target subscription. Required.
40+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4041 :type subscription_id: str
41- :param base_url: Service URL . Default value is "https://management.azure.com".
42+ :param base_url: Service host . Default value is "https://management.azure.com".
4243 :type base_url: str
43- :keyword api_version: Api Version . Default value is "2023-11-15". Note that overriding this
44- default value may result in unsupported behavior.
44+ :keyword api_version: The API version to use for this operation . Default value is "2023-11-15".
45+ Note that overriding this default value may result in unsupported behavior.
4546 :paramtype api_version: str
4647 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4748 Retry-After header is present.
@@ -54,29 +55,47 @@ def __init__(
5455 base_url : str = "https://management.azure.com" ,
5556 ** kwargs : Any
5657 ) -> None :
58+ _endpoint = "{endpoint}"
5759 self ._config = NetworkAnalyticsMgmtClientConfiguration (
58- credential = credential , subscription_id = subscription_id , ** kwargs
60+ credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
5961 )
60- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
61-
62- client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
63- self ._serialize = Serializer (client_models )
64- self ._deserialize = Deserializer (client_models )
62+ _policies = kwargs .pop ("policies" , None )
63+ if _policies is None :
64+ _policies = [
65+ policies .RequestIdPolicy (** kwargs ),
66+ self ._config .headers_policy ,
67+ self ._config .user_agent_policy ,
68+ self ._config .proxy_policy ,
69+ policies .ContentDecodePolicy (** kwargs ),
70+ ARMAutoResourceProviderRegistrationPolicy (),
71+ self ._config .redirect_policy ,
72+ self ._config .retry_policy ,
73+ self ._config .authentication_policy ,
74+ self ._config .custom_hook_policy ,
75+ self ._config .logging_policy ,
76+ policies .DistributedTracingPolicy (** kwargs ),
77+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
78+ self ._config .http_logging_policy ,
79+ ]
80+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
81+
82+ self ._serialize = Serializer ()
83+ self ._deserialize = Deserializer ()
6584 self ._serialize .client_side_validation = False
6685 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
67- self .data_products = DataProductsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
6886 self .data_products_catalogs = DataProductsCatalogsOperations (
6987 self ._client , self ._config , self ._serialize , self ._deserialize
7088 )
7189 self .data_types = DataTypesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
90+ self .data_products = DataProductsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
7291
73- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
92+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
7493 """Runs the network request through the client's chained policies.
7594
7695 >>> from azure.core.rest import HttpRequest
7796 >>> request = HttpRequest("GET", "https://www.example.org/")
7897 <HttpRequest [GET], url: 'https://www.example.org/'>
79- >>> response = client._send_request (request)
98+ >>> response = client.send_request (request)
8099 <HttpResponse: 200 OK>
81100
82101 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -89,13 +108,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
89108 """
90109
91110 request_copy = deepcopy (request )
92- request_copy .url = self ._client .format_url (request_copy .url )
93- return self ._client .send_request (request_copy , ** kwargs )
111+ path_format_arguments = {
112+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
113+ }
114+
115+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
116+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
94117
95118 def close (self ) -> None :
96119 self ._client .close ()
97120
98- def __enter__ (self ) -> "NetworkAnalyticsMgmtClient" :
121+ def __enter__ (self ) -> Self :
99122 self ._client .__enter__ ()
100123 return self
101124
0 commit comments