|
6 | 6 | # Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
7 | 7 | # --------------------------------------------------------------------------
|
8 | 8 |
|
| 9 | +import sys |
9 | 10 | from typing import Any, TYPE_CHECKING
|
10 | 11 |
|
11 | 12 | from azure.core.configuration import Configuration
|
|
14 | 15 |
|
15 | 16 | from ._version import VERSION
|
16 | 17 |
|
| 18 | +if sys.version_info >= (3, 8): |
| 19 | + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports |
| 20 | +else: |
| 21 | + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports |
| 22 | + |
17 | 23 | if TYPE_CHECKING:
|
18 | 24 | # pylint: disable=unused-import,ungrouped-imports
|
19 | 25 | from azure.core.credentials import TokenCredential
|
20 | 26 |
|
21 | 27 |
|
22 |
| -class SignalRManagementClientConfiguration(Configuration): |
| 28 | +class SignalRManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes |
23 | 29 | """Configuration for SignalRManagementClient.
|
24 | 30 |
|
25 | 31 | Note that all parameters used to create this instance are saved as instance
|
26 | 32 | attributes.
|
27 | 33 |
|
28 |
| - :param credential: Credential needed for the client to connect to Azure. |
| 34 | + :param credential: Credential needed for the client to connect to Azure. Required. |
29 | 35 | :type credential: ~azure.core.credentials.TokenCredential
|
30 |
| - :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. |
| 36 | + :param subscription_id: Gets subscription Id which uniquely identify the Microsoft Azure |
| 37 | + subscription. The subscription ID forms part of the URI for every service call. Required. |
31 | 38 | :type subscription_id: str
|
| 39 | + :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding |
| 40 | + this default value may result in unsupported behavior. |
| 41 | + :paramtype api_version: str |
32 | 42 | """
|
33 | 43 |
|
34 |
| - def __init__( |
35 |
| - self, |
36 |
| - credential: "TokenCredential", |
37 |
| - subscription_id: str, |
38 |
| - **kwargs: Any |
39 |
| - ) -> None: |
| 44 | + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: |
40 | 45 | super(SignalRManagementClientConfiguration, self).__init__(**kwargs)
|
| 46 | + api_version = kwargs.pop("api_version", "2022-08-01-preview") # type: Literal["2022-08-01-preview"] |
| 47 | + |
41 | 48 | if credential is None:
|
42 | 49 | raise ValueError("Parameter 'credential' must not be None.")
|
43 | 50 | if subscription_id is None:
|
44 | 51 | raise ValueError("Parameter 'subscription_id' must not be None.")
|
45 | 52 |
|
46 | 53 | self.credential = credential
|
47 | 54 | self.subscription_id = subscription_id
|
48 |
| - self.api_version = "2022-02-01" |
49 |
| - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) |
50 |
| - kwargs.setdefault('sdk_moniker', 'mgmt-signalr/{}'.format(VERSION)) |
| 55 | + self.api_version = api_version |
| 56 | + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) |
| 57 | + kwargs.setdefault("sdk_moniker", "mgmt-signalr/{}".format(VERSION)) |
51 | 58 | self._configure(**kwargs)
|
52 | 59 |
|
53 | 60 | def _configure(
|
54 |
| - self, |
55 |
| - **kwargs # type: Any |
| 61 | + self, **kwargs # type: Any |
56 | 62 | ):
|
57 | 63 | # type: (...) -> None
|
58 |
| - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) |
59 |
| - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) |
60 |
| - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) |
61 |
| - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) |
62 |
| - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) |
63 |
| - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) |
64 |
| - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) |
65 |
| - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) |
66 |
| - self.authentication_policy = kwargs.get('authentication_policy') |
| 64 | + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) |
| 65 | + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) |
| 66 | + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) |
| 67 | + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) |
| 68 | + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) |
| 69 | + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) |
| 70 | + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) |
| 71 | + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) |
| 72 | + self.authentication_policy = kwargs.get("authentication_policy") |
67 | 73 | if self.credential and not self.authentication_policy:
|
68 |
| - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) |
| 74 | + self.authentication_policy = ARMChallengeAuthenticationPolicy( |
| 75 | + self.credential, *self.credential_scopes, **kwargs |
| 76 | + ) |
0 commit comments