7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
- from typing import Any , TYPE_CHECKING
10
+ from typing import Any , Optional , TYPE_CHECKING , cast
11
11
from typing_extensions import Self
12
12
13
13
from azure .core .pipeline import policies
14
14
from azure .core .rest import HttpRequest , HttpResponse
15
+ from azure .core .settings import settings
15
16
from azure .mgmt .core import ARMPipelineClient
16
17
from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18
+ from azure .mgmt .core .tools import get_arm_endpoints
17
19
18
20
from . import models as _models
19
21
from ._configuration import NginxManagementClientConfiguration
20
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
21
23
from .operations import (
22
24
ApiKeysOperations ,
23
25
CertificatesOperations ,
24
26
ConfigurationsOperations ,
27
+ DefaultWafPolicyOperations ,
25
28
DeploymentsOperations ,
26
29
Operations ,
30
+ WafPolicyOperations ,
27
31
)
28
32
29
33
if TYPE_CHECKING :
30
34
from azure .core .credentials import TokenCredential
31
35
32
36
33
- class NginxManagementClient :
37
+ class NginxManagementClient : # pylint: disable=too-many-instance-attributes
34
38
"""NginxManagementClient.
35
39
36
40
:ivar api_keys: ApiKeysOperations operations
@@ -41,31 +45,37 @@ class NginxManagementClient:
41
45
:vartype configurations: azure.mgmt.nginx.operations.ConfigurationsOperations
42
46
:ivar deployments: DeploymentsOperations operations
43
47
: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
44
52
:ivar operations: Operations operations
45
53
:vartype operations: azure.mgmt.nginx.operations.Operations
46
54
:param credential: Credential needed for the client to connect to Azure. Required.
47
55
:type credential: ~azure.core.credentials.TokenCredential
48
56
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
49
57
: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 .
51
59
: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
53
61
this default value may result in unsupported behavior.
54
62
:paramtype api_version: str
55
63
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
56
64
Retry-After header is present.
57
65
"""
58
66
59
67
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
65
69
) -> 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" ])
66
75
self ._config = NginxManagementClientConfiguration (
67
- credential = credential , subscription_id = subscription_id , ** kwargs
76
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
68
77
)
78
+
69
79
_policies = kwargs .pop ("policies" , None )
70
80
if _policies is None :
71
81
_policies = [
@@ -84,7 +94,7 @@ def __init__(
84
94
policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
85
95
self ._config .http_logging_policy ,
86
96
]
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 )
88
98
89
99
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
90
100
self ._serialize = Serializer (client_models )
@@ -94,6 +104,10 @@ def __init__(
94
104
self .certificates = CertificatesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
95
105
self .configurations = ConfigurationsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
96
106
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
+ )
97
111
self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
98
112
99
113
def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
0 commit comments