77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
1820from . import models as _models
1921from ._configuration import NginxManagementClientConfiguration
20- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
2123from .operations import (
2224 ApiKeysOperations ,
2325 CertificatesOperations ,
2426 ConfigurationsOperations ,
27+ DefaultWafPolicyOperations ,
2528 DeploymentsOperations ,
2629 Operations ,
30+ WafPolicyOperations ,
2731)
2832
2933if TYPE_CHECKING :
3034 from azure .core .credentials import TokenCredential
3135
3236
33- class NginxManagementClient :
37+ class NginxManagementClient : # pylint: disable=too-many-instance-attributes
3438 """NginxManagementClient.
3539
3640 :ivar api_keys: ApiKeysOperations operations
@@ -41,31 +45,37 @@ class NginxManagementClient:
4145 :vartype configurations: azure.mgmt.nginx.operations.ConfigurationsOperations
4246 :ivar deployments: DeploymentsOperations operations
4347 :vartype deployments: azure.mgmt.nginx.operations.DeploymentsOperations
48+ :ivar waf_policy: WafPolicyOperations operations
49+ :vartype waf_policy: azure.mgmt.nginx.operations.WafPolicyOperations
50+ :ivar default_waf_policy: DefaultWafPolicyOperations operations
51+ :vartype default_waf_policy: azure.mgmt.nginx.operations.DefaultWafPolicyOperations
4452 :ivar operations: Operations operations
4553 :vartype operations: azure.mgmt.nginx.operations.Operations
4654 :param credential: Credential needed for the client to connect to Azure. Required.
4755 :type credential: ~azure.core.credentials.TokenCredential
4856 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4957 :type subscription_id: str
50- :param base_url: Service URL. Default value is "https://management.azure.com" .
58+ :param base_url: Service URL. Default value is None .
5159 :type base_url: str
52- :keyword api_version: Api Version. Default value is "2024-11 -01-preview". Note that overriding
60+ :keyword api_version: Api Version. Default value is "2025-03 -01-preview". Note that overriding
5361 this default value may result in unsupported behavior.
5462 :paramtype api_version: str
5563 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5664 Retry-After header is present.
5765 """
5866
5967 def __init__ (
60- self ,
61- credential : "TokenCredential" ,
62- subscription_id : str ,
63- base_url : str = "https://management.azure.com" ,
64- ** kwargs : Any
68+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
6569 ) -> None :
70+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
71+ _endpoints = get_arm_endpoints (_cloud )
72+ if not base_url :
73+ base_url = _endpoints ["resource_manager" ]
74+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
6675 self ._config = NginxManagementClientConfiguration (
67- credential = credential , subscription_id = subscription_id , ** kwargs
76+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6877 )
78+
6979 _policies = kwargs .pop ("policies" , None )
7080 if _policies is None :
7181 _policies = [
@@ -84,7 +94,7 @@ def __init__(
8494 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
8595 self ._config .http_logging_policy ,
8696 ]
87- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
97+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
8898
8999 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
90100 self ._serialize = Serializer (client_models )
@@ -94,6 +104,10 @@ def __init__(
94104 self .certificates = CertificatesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
95105 self .configurations = ConfigurationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
96106 self .deployments = DeploymentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
107+ self .waf_policy = WafPolicyOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
108+ self .default_waf_policy = DefaultWafPolicyOperations (
109+ self ._client , self ._config , self ._serialize , self ._deserialize
110+ )
97111 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
98112
99113 def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
0 commit comments